I think you made your type (enum) unnecessary complex, the following works:

protocol Element {
    
}

enum ElementNode {
    case element(Element)
    case empty
}

var childElements = [ElementNode]()


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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to