A CoreData Journey

639 views

Published on

A CoreData Journey, presentation given at CodeCamp on 10 Mai 2014.

Published in: Mobile, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
639
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

A CoreData Journey

  1. 1. A Core Data Journey
  2. 2. Who Am I? • Alex Terente • Mainly iOS developer • Consultant and working @ TAGonSoft • alex.terente@TAGonSoft.ro
  3. 3. What is Core Data? “The Core Data framework provides generalized and automated solutions to common tasks associated with object life- cycle and object graph management, including persistence.”
  4. 4. What is Core Data? • Allows definition of Managed Objects • Functionality to create, update, delete, query • Multiple back-end storage options
  5. 5. Storage Options • Binary • In-memory • XML • Not available on the iPhone • SQLite • Only option that does not require the entire store to reside in memory
  6. 6. What is not Core Data • Core Data is not a relational database or a relational database management system • Core Data is not a silver bullet.
  7. 7. Core Data vs. SQLite SQLite Core Data Bulk/Set Operations Yes No Automatic object population No Yes Custom SQL Yes No Select only certain fields Yes No Automated Migrations No Yes Less Complex Code No Yes
  8. 8. Interface to Core Data NSPersistentStore NSPersistentStoreCoordinator NSManagedObjectContext
  9. 9. NSPersistentStoreCoordinat or
  10. 10. NSManagedObjectModel
  11. 11. Model Demo
  12. 12. NSManagedObjectConte xt
  13. 13. Inserting an Object
  14. 14. Querying for Objects
  15. 15. Deleting an Object
  16. 16. Updating an Object • Same as insert • Make changes followed by ManagedObjectContext save
  17. 17. Save Context
  18. 18. Code Demo
  19. 19. Migration • Lightweight Migration • Model versioning
  20. 20. Lightweight migration • Adding or removing entity, relation or attribute • Making attribute non optional • Making non optional attribute optional • Renaming an atribute or entity
  21. 21. Lightweight migration
  22. 22. Model Versioning
  23. 23. Model Versioning
  24. 24. Model Versioning
  25. 25. Code Demo
  26. 26. Threading • Must create a new NSManagedObjectContext for each thread • NSManagedObjects are associated with a particular context • NSManagedObjectContext can be updated with changes from other contexts
  27. 27. Code Demo
  28. 28. Core Data and iCloud • Enabling • Add iCloud Persistent Store
  29. 29. Enabling iCloud
  30. 30. Enabling iCloud
  31. 31. iCloud Persistent Store
  32. 32. Resources • Core Data Programming Guide • Core Data Model Versioning and Data Migration • iCloud Programming Guide for Core Data • iCloud Design Guide • Code Sample https://github.com/TAGonSoft/CoreD ata_CodeCamp
  33. 33. Q & A
  34. 34. Thank You Please feel the evaluation form A Core Data Journey Alex Terente TAGonSoft.com

×