OSX application without storyboard or xib files using Swift

后端 未结 3 796

Unfortunately, I haven\'t found anything useful on the Internet - I wanted to know, what code I actually have to type for initializing an application without using storyboar

3条回答
  •  时光取名叫无心
    2020-11-30 23:03

    The top level code sample above no longer works in recent versions of Xcode. Instead use this:

    import Cocoa
    
    let delegate = AppDelegate() //alloc main app's delegate class
    NSApplication.shared().delegate = delegate //set as app's delegate
    
    let ret = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
    

提交回复
热议问题