Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJack Porco
6,388 PointsProper data storage, retrieve, modify setup
Given the following scenario, how should I set this up in Swift?
For my application: -- I need to store 24 related objects with ten attributes (both Integers and Strings) per object. -- I need to lookup values for these related objects based on a key value. -- I need to continually modify the object values based on user input.
What data storage approach should I take? I have not grasped the proper data storage approach for Swift. I simply need to store, reference and modify stored data based on a key value. Should I be creating a class, then defining 24 unique variables instances of the class? If so, how do I "lookup" the instances by a key value? Should the objects reside in a PList? I'd like someone to explain to me the proper way to setup this simple data model. Thank you.
EDIT - As I wrote this out, I did some additional searching and found that Core Data could be one valid method to set this project up. I didn't realize that was an option because I've not gotten that far in the Swift training in Treehouse. I'm nearly done with the intermediate training (just starting the Restaurant Review app) and I've not run into the Core Data concept yet. For those that are experienced Swift programmers, let me know if you agree with the Core Data approach to this scenario. Thank you.