Join John Nastos for an in-depth discussion in this video Creating a new contact in code, part of Building an iOS Address Book App.
- [Voiceover] Now that I've added the new text fields…in the UI, I need to make sure…that they're attached to the code.…I'm going to go back to the AddViewController.swift file.…The first thing that I'm going to do is make sure…there are properties to represent each field.…So I'm going to copy this line…and paste it and change the name of the property…to reflect these different fields.…So I'll call this one "lastNameField…"phoneField…"emailField…and "addressField"…Then I want to go back to the storyboard…and connect all of those outlets.…
So I'm going to control click on the Add View Controller.…And connect nameField to First name,…lastNameField to Last name…phoneField to Phone…emailField to Email…and addressField to Address.…Then I'm going to take my addButtonPressed selector…and tie it to the Add Button and again choose…Touch Up Inside.…
And in fact, while I'm at it,…I'm going to change the text here from Add to Done.…Now back in the Add View Controller,…I'm going to add some code to make sure…that when I'm done typing in one of the text fields…
Build the project step-by-step and then use what you've learned to explore your own app ideas.
- Creating the project in Xcode
- Using Auto Layout to design the UI
- Attaching the interface to the code
- Creating the data model, including a Person class
- Adding stored data to the UI
- Displaying a contact's address with MapKit
- Linking contact info to other iOS apps
- Adding persistence
- Working with table views
- Writing tests
- Preparing to publish the app in the App Store