Greetings
Now we've got generic subscripts, I thought I'd play…
protocol DataProvider
{
subscript<itemType>(index: Int) -> itemType { get }
}
class Test : DataProvider // error : Type 'Test' does not conform to protocol
'DataProvider'
{
subscript(index: Int) -> String
{
return "Fred"
}
}
Simple questions:
1. why does this not compile?
2. should it?
3. is there a workaround without declaring an associated type in the protocol?
Joanna
--
Joanna Carter
Carter Consulting
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users