I get the message Unable to load nib file: MainMenu, exiting (Ironically, the build shows up as successful but no window pops up.) I am using Swift 4.0 with Xcode 9. Any suggestions?
My MainWindowController.swift code:
import Cocoa
class MainWindowController: NSWindowController{
override var windowNibName: NSNib.Name?{
return NSNib.Name(rawValue: “MainWindowController”)
}
}
My AppDelegate.swift code:
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var mainWindowController: MainWindowController?
func applicationDidFinishLaunching(_ aNotification: Notification) {
//Create a window controller
//Put the window of the window controller on screen
//set the property to point ot the window controller
let mainWindowController = MainWindowController()
mainWindowController.showWindow(self)
self.mainWindowController = mainWindowController
}
I get Build Succeeded, then in the bottom pane I get the error message: 2018-04-03 11:25:04.890160-0500 RGBWell[10057:2124151] Unable to load nib file: MainMenu, exiting
I have an RGB Wheel that works using the NSView Controller, so sad though, a brand new book that = useless.
Here is the MainWindowController.swift contents:
import Cocoa
class MainWindowController: NSWindowController {
override var windowNibName: NSNib.Name? {
return NSNib.Name(rawValue: “MainWindowController”)
}
@IBOutlet weak var mySlider: NSSlider!
}
Here are the AppDelegate.swift contents:
import Cocoa @NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var mainWindowController: MainWindowController?
func applicationDidFinishLaunching(aNotification: NSNotification) {
let mainWindowController = MainWindowController()
mainWindowController.showWindow(self)
self.mainWindowController = mainWindowController
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
}
I started everything from scratch and it seems to be working. I followed an IBOutlet and it seemed to be going to some Dummy file I had called DeleteMe…