I am using the 5th edition of the Cocoa Programming for OS X: The Big Nerd Ranch Guide with Xcode 7.2. I am building the PasswordGenerator program. I can’t get by this step:
“First, return to the project navigator and open MainMenu.xib. In the document outline, select RandomPassword, which is the window shown in the canvas. Press Delete to delete this window from the file and the application.”
I have four folders in the document outline: RandomPassword, RandomPasswordTests, RandomPasswordUITests, and products. Under the products folder, there is a RandomPassword.app. When I deleted the RandomPassword folder, I do longer had the AppDelegate.swift file, which I need for the next step in the book. So, what am I supposed to delete? Additionally, when I delete something, I have the choice to either “Remove Reference” or “Move to Trash”. I assume I should select the “Move to Trash” for whatever it is I am supposed to delete.
Within the RandomPassword folder you should have several files listed… something like… AppDelegate.swift, Assets.xcassets, MainMenu.xib, Info.plist, MainWindowController.swift, and MainWindowController.xib. You select MainMenu.xib; THEN within the editor window in the middle of Xcode you should see two sections: (1) one section on the left with a list of Placeholders and Objects, and (2) one section on the right with a visual example of the menu bar for the RandomPassword app as well as a blank window for RandomPassword. These two middle sections, are in addition to the still existing Xcode project navigator on the left and the Xcode utilities area on the right. Your screen may vary slightly based on what sections you have selected within Xcode. Almost all of the various windows can be hidden or collapsed.
Within that middle-left Placeholders/Objects listing of MainMenu.xib, you should see an object at the bottom called Window. The book says it will be titled “RandomPassword” but I believe Xcode simply calls it Window, as I recall. Anyway, that is the object you are supposed to delete… not the overall RandomPassword folder within the Xcode navigator. When you delete the MainMenu.xib “Window” object… the blank window that was graphically in the middle-right editor area of Xcode should now go away. That’s what the book wants you to get rid of… the default window that gets created as part of MainMenu.xib. They want you to create a separate Cocoa class called MainWindowController that is a subclass of NSWindowController. This new class will have its own default window also, if you select the “create XIB file” option when you add the new Cocoa class from NSWindowController.