I created a storyboard project using Xcode (9.2).
I then created a custom subclass of NSWindow and used the storyboard editor to set that as the class for my window.
class CustomWindow: NSWindow {
init() {
super.init(contentRect: NSRect.zero, styleMask: .borderless, backing: .buffered, defer: true)
self.setFrame(NSScreen.screens[0].visibleFrame, display: false)
}
}
[Edited for clarity]
The project complies ok, but upon running throws up this error on the line containing the super.init()
call:
Fatal error: Use of unimplemented initializer 'init(contentRect:styleMask:backing:defer:)'
Wouldn't the super class (NSWindow
) already contain that implementation?
What am I missing?
If you use it in the storyboard then you need to implement the init method you get an error about since it is the designated one for NSWindow.
See this question Fatal error: use of unimplemented initializer 'init(coder:)' for class for example