Join Todd Perkins for an in-depth discussion in this video Saving data to a file, part of Building a Note-Taking App for iOS 8.
- For the application we're developing in this course…we're only going to save data to…persistent storage using an S users defaults…as we've already looked at.…However, it may be of use to you…to know how to save data to a file,…should you ever like to do it.…For that reason I'm going to include…that in this movie.…I'm in Note.Swift and I've made…a couple of very small changes to our code.…I've changed our data model, instead of using…an array of notes, I've made it an NSMutableArray.…
This is a data type that allows us…to easily save data to a file.…That's why I made that change.…Since I changed the data type,…I've had to change a couple of methods.…For example, on line 31 of my code…where I declare aDictionaries,…I changed that data type to NSMutableArray as well.…Then I'm using the add object method…instead of the append method to…place the object in the array.…I'd doing the same thing in my code on line 45.…
The most complicated part of saving…data to a file in Swift is getting…the path to the file.…Once you've got that, everything…
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