Learn swift on the mac

Page 192

CHAPTER 20: Working with Core Data

195

Figure 20-10.  Editor Controller with Navigation Controller

Then add a date-picker object where you can set the year for the car. Also add Save and Cancel buttons so you can either save or dismiss the view controller depending on whether you want to save or cancel the new Car. Next you need to add code to populate the view with your data if you have an existing object, or you need to create a new one. Connect each of these items to your controller outlets. Select the view controller and open the assistant editor. Select each item and then press the control key and drag to the source file (this is called control-drag). This will create outlets for each item. You should now have five outlets with appropriate names. Once you control-drag to your source file, the editor will ask you to name each outlet. The editor will prefill most of the defaults for the outlet that make sense. All you have to do is enter the name of the outlet (Figure 20-11).


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.