必须致电超级类别的指定初始化程序' NSWindow':
import Cocoa
class MyWindow: NSWindow {
init(contentRect: NSRect, styleMask aStyle: Int, backing bufferingType: NSWindow.BackingStoreType, defer flag: Bool) {
super.init(contentRect: contentRect, styleMask: NSWindow.StyleMask(rawValue: NSWindow.StyleMask.RawValue(aStyle)), backing: bufferingType, defer: flag)
self.titleVisibility = .hidden
}
required init?(coder: NSCoder) { // error: Cannot override 'init' which has been marked unavailable AND Failable initializer 'init(coder:)' cannot override a non-failable initializer
super.init(coder: coder) // error: 'init(coder:)' is unavailable
} }
答案 0 :(得分:0)
NSWindow
does not support coding.您可能没有,也不需要实施init(coder:)
。只需删除该方法;无论如何,你没有做任何事情。