I have a vc with a dynamic var "value" and i need to know when it's changed in a closure in the calling cv.
target vc:
@objc dynamic var value: String = ""
source:
if let vc: TagButtonPopupViewController = sb.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("TagPopupViewController")) as? TagButtonPopupViewController {
// configure vc
vc.value = sender.title
// observe
_ = vc.observe(\.value) { (tbvc, change) in
print("new string")
}
// present popup
presentViewController(vc, asPopoverRelativeTo: sender.bounds, of: sender, preferredEdge: NSRectEdge.maxY, behavior: NSPopover.Behavior.transient)
}
but "observe" is never called. Any Ideas how to get notified in a closure whenever "value" has changed in Swift4?