I want to store weak references in an NSPointerArray
but I get an error:
public var objectWithReloadFRC = NSPointerArray(options: NSPointerFunctionsWeakMemory)
objectWithReloadFRC.addPointer(self) //self is an UIViewController subclass
tried this too:
objectWithReloadFRC.addPointer(UnsafePointer(self)
You can get a pointer to the storage used for an object with
unsafeAddressOf()
. SinceaddPointer()
requires a mutable pointer, another conversion is needed:Swift 3: