1

Xcode 8.3.3, Swift 3

I have viewController that sets itself as the window delegate in its viewDidLoad() method.

override func viewDidLoad() {
  super.viewDidLoad()
  self.view.window?.delegate = self
}

It also implements the NSWindowDelegate protocol in an extension.

extension EditCustomerViewController: NSWindowDelegate {
    func windowDidMove(_ notification: Notification) {
        print("Window moved\n" + notification.description)
    }
}

The windowDidMove() method never gets called.

Just for kicks, I implemented a custom window class that implements windowDidMove() and set the window's class to that class in the storyboard. That never got called either.

I'm obviously missing something basic here.

Leo Dabus
  • 229,809
  • 59
  • 489
  • 571
David Patterson
  • 1,780
  • 3
  • 17
  • 40
  • @Leo Dabus, This is not an "exact duplicate" of that question. That question does not contain "windowDidMove" anywhere in the question or answers. Yes. it IS the correct answer, but there was no way for me to know to search for those other terms. Thanks. – David Patterson Jul 15 '17 at 23:50
  • you are welcome – Leo Dabus Jul 15 '17 at 23:56

0 Answers0