You need to add
override init(window: NSWindow?) {
super.init(window: window)
}
in your subclass.
See https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization/
which say:
Rule 1
If your subclass doesn’t define any designated initializers, it automatically inherits all of its superclass designated initializers.
Rule 2
If your subclass provides an implementation of all of its superclass designated initializers — either by inheriting them as per rule 1, or by providing a custom implementation as part of its definition — then it automatically inherits all of the superclass convenience initializers.
The (unstated) corollary here is that if you only override some of the superclass's designated initializers, you inherit none of them.
in your case, you'd overridden init(coder:) not init(window:), so the compiler didn't 'see' an init(window:) at all.
I'm not smart enough to figure this out on my own, I asked an LLM and then asked it to show me the documentation, because you really can't trust those guys. ;)
Topic:
Programming Languages
SubTopic:
Swift
Tags: