Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Creating the Model Layer
In this section, you are going to create a new file that will contain the code that creates a random string. The MainWindowController will receive input from the view layer (a click of the button), call a function in the model layer to do the real-world work (generate a random string), and then update the view layer (display the string in the text field).
In the project navigator, Control-click the RandomPassword group and select New File.... From the Source section under OS X, choose Swift File (Figure 1.26). Save the file as GeneratePassword in the default location.
Figure 1.26 Creating a new Swift file
Xcode will open the GeneratePassword.swift file. At the top of the file, add an array named ...