The error says ItemProtocol does not conform to ItemProtocol.
That doesn't make sense. It seems this should work fine.
// It's all clean until the last line
protocol ItemProtocol : class {
var message: String { get }
}
// heterogenious types
class A : ItemProtocol {
var message = "A"
}
class B : ItemProtocol {
var message = "B"
}
var items: [ItemProtocol] = [A(), B()]
func someFunc<T: ItemProtocol>(items: [T]) {
for item in items {
print(item.message)
}
}
// Everything compiles fine until this
someFunc(items: items)
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users