Join John Nastos for an in-depth discussion in this video Data validation, part of Building an iOS Address Book App.
- In the last video, I set up a very basic person class…with a few fields.…First and last name, address, phone and email address.…Right now, all of those variables…are defined as optional variables,…since they may or may not contain data.…If they do contain data,…I'm going to want to make sure…that the data that I'm trying to set is valid.…Meaning, for example, I don't want…to let the user create the contact…without a first name.…Or I don't want them to be able…to enter a phone number…that doesn't have any digits in it.…
So I'll need some sort of data validation in place…to make sure that these values are acceptable.…Let's take a look at a solution to implement that…in the person class.…First, I'm going to change the definition…of these properties or variables slightly.…Right now, these properties are all public…and can be read or set from both inside the class…and outside it.…Because I want some data validation…to take place before setting any of these properties,…I'm going to make sure that they can't be set…from outside the class.…
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