I have a struct setting that accepts a link as the only initialization parameter:
internal struct NodeState: Equatable { weak var node: Node! = nil
I want to instantiate NodeState as a member of the Node class, passing self in to set this weak link:
public class Node: NSObject { internal var state = NodeState(node: self)
... but I get this strange compilation error:
Cannot convert value of type 'NSObject → () → Node' to the expected argument type 'Node'
Am I not allowed to refer to self in a member declaration in Swift?
source share