[swift-users] Using 'SomeProtocol' as a concrete type conforming to protocol 'SomeProtocol' is not supported
Rien
Rien at Balancingrock.nl
Thu Dec 29 03:13:57 CST 2016
As to the why question: (just guessing here)
By the time the compiler want to know what type will be in the array, it cannot do so. The enum is a generic and thus without full type information (it only has partial type information).
Regards,
Rien
Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Swiftrien
Project: http://swiftfire.nl
> On 29 Dec 2016, at 00:41, Brandon Knope via swift-users <swift-users at swift.org> wrote:
>
> I don’t understand why this is a problem
>
> protocol Element {
>
> }
>
> enum ElementNode<T: Element> {
> case element(T)
> case empty
> }
>
> var childElements = [ElementNode<Element>]()
>
> I need to represent an array of my nodes that could be multiple kinds of elements
>
> Is there a workaround?
>
> Brandon
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
More information about the swift-users
mailing list