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!
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 trial
shane reichefeldCourses Plus Student 2,232 Points
Swift App Question
OK so i have 2 views, view1 and view2. in view1 there are 3 textfields and in view2 there are 3 labels. I need the numbers entered in the 3 textfields to be saved so its in the app and then i need it to be put into view2 and set to the labels. Also i need it so if the textfield enters a second+ number for it to add it to the last number so they keep adding up.
How would i do this? I tried NSUserdefaults and trying to move it to another view but it doesnt work.
If you need to save the data on disk, you can try Core Data. (Create an app with a core data stack or add one.)
- Create an entity
- Add three attributes (one for each textField Value)
- Save the values
- Fetch the values (make sure to use the same MOC in the second view)