UserDefaults was a great way to save data but is limited to certain types. In this lesson we'll create a custom Location class that implements the NSCoding protocol so we can save and retrieve more structured data.
The "Saved Locations" screen has had a major flaw to this point — it didn't actually save the list of locations when one was added. We'll be tackling that issue in this lesson, using the UserDefaults system object to save and store our locations.
Not everything needs to be written from scratch, and there's tons of useful code out there ready to be integrated into your project. Cocoapods provides a really easy way to do this and to manage dependencies.
In this episode, you'll add a bit of functionality to the Saved Locations screen. We need a way to save our current location to the list, and we'll accomplish this by adding a plus button on the Saved Locations tableview controller.