I have a label with a binding to a variable inside an instance. When I change the variable, I can print out the new content but the label keeps the original content.
class myClass: NSObject {
var text : String = "Initial"
override init() {
text = "Init"
}
func change() {
text = "Changed"
}
}
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var instance = myClass()
func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application
instance.change()
print(instance.text)
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
}
}
print(instance.text) gives me "Changed" but the label keeps "Init".
Why does the binding not work in this case?
The label has a "Bind to App Controller" "self.instance.text" binding
Thanks