Join Todd Perkins for an in-depth discussion in this video Creating global properties to manage data, part of Building a Note-Taking App for iOS 8.
- Now let's create some global variables…to manage our data.…If you're wondering why I'm not using class…variables instead, that's because…at the time of this recording class variables…are not supported in Swift.…So above our class I'm going…to declare three variables.…Now the first one is going to be called allNotes.…This is going to be an array of notes…that will of course represent all…of the notes that have been created.…To create an array of notes we use…the square brackets and our note data type inside.…
I'm going to initialize that to an empty array.…On the next line we'll create a variable…called currentNoteIndex.…This will be an integer and I'll…initialize it to negative one.…This is going to refer to the current index…in the note array.…So once we select a note to edit, the current note…index is going to save which note we're editing.…Finally, we're going to create one more variable…that's going to reference the table of notes.…So the table view is that list view…that shows up when we launch our application.…
Each of these courses helps you build a complete mobile app from scratch; this installment uses the iOS SDK and Xcode to get the job done. Author Todd Perkins shows you how to create an Xcode project, lay out apps visually, connect UI elements to code, and save data to persistent storage. Start here with iOS 8, and compare your results with the Android and Windows Phone courses to learn about the differences and similarities of these mobile platforms.
- Previewing the note-taking app's features
- Creating the Xcode project
- Using local data storage
- Creating a data class
- Saving data to a file or user defaults
- Understanding screens and storyboards
- Controlling transitions between views
- Connecting the controller to the data
- Creating, editing, and deleting notes