Hi, I'm using Xcode 10 and macOS 10.14, I have a problem with IBAction method...
I created OtherViewController.swift/OtherViewController.xib, created a IBAction method (closeView:) which simply calls removeFromSuperview, and connected action (button) to file's owner (OtherViewController).
class OtherViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
}
@IBAction func closeView(_ sender: NSButton) {
print("closeView()")
self.view.removeFromSuperview()
}
}
When i run the app, hit the button, the action is not called.
I just called a method like below when I hit main window button...
@IBAction func showOtherView(_ sender: NSButton) {
let otherView : OtherViewController! = OtherViewController()
otherView.view.frame = tabView.frame
tabView.isHidden = true
window.contentView?.addSubview(otherView.view)
}
I can't figure it out what is the problem. I thought it should be work in older version of xcode...