Enum with unowned associated value

Hi,


I didn't found any documentation about making associated values for enums unowned or weak. I already tries to add keywords "unowned" and "weak" but it did not work.


E.g. i want the associated value for MyEnum.Wall to be weak:


enum MyEnum {
 case None
 case Wall(SKNode)
}



Thanks.


thomas

Answered by QuinceyMorris in 111338022

Could you not define a struct type with a single member that is the required unowned reference?


I can't think of any conceptual problem with an enum case that has a weak or unowned reference to its associated value, but I think the tuple syntax just doesn't provide for this,

Accepted Answer

Could you not define a struct type with a single member that is the required unowned reference?


I can't think of any conceptual problem with an enum case that has a weak or unowned reference to its associated value, but I think the tuple syntax just doesn't provide for this,

Enum with unowned associated value
 
 
Q