I’m using Swift & I have connected the button in XCode as described (control drag from button to File’s Owner). When I try to run in Fire I get this message: Could not connect action, target class MainWindowController does not respond to -sayHello:
@IBAction func sayHello(sender: Any?) { // NW5 IBAction/objc methods should have an unlabeled prefix for the first parameter
// label.stringValue = "hello, "+edit.stringValue
print("Hello")
}
(that warning might be new for the upcoming 9.1, so maybe you don’t see that yet). you need to add underscore, because otherwise your sayHello method won’t be called sayHello:, but has an external prefix for the first parameter.
@IBAction func sayHello(_ sender: Any?) { /
will work.
That said, this method should not even have made it thru to the Xcode sync as id did, i will log an issue for that.
Thanks, logged as bugs://77833: Swift methods with prefix should not sync prefix-less to Xcode.
This won’t make it into the upcoming release, as that’s locked down and will (hopefully) be finalized friday, but I’ve given this priory’s for the next 9.2 interim.