Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CloudKit by Mustafa Yusuf

CloudKit by Mustafa Yusuf

Swift India Bangalore meet up - Chapter #20

Eeb061c8b2816b771920da1b3e7904a3?s=128

Swift India

December 14, 2019
Tweet

Transcript

  1. CLOUDKIT Why did I not use it earlier?

  2. aNdrOid

  3. How many of you have or had an app idea?

  4. None
  5. IDEA

  6. PLAN IDEA

  7. PLAN TEAM IDEA

  8. THE HONEYMOON PERIOD

  9. None
  10. • Why CloudKit • How to integrate • What are

    the best practices
  11. WHY CLOUDKIT • The free quota • Pagination • Sync

    across all devices • Scales with your user base • No auth required to save personal data • Notifications setup made easy with CKSubscriptions • One of the best in class infrastructure • Uploading images, video, audio or any data, is so easy.
  12. WHY CLOUDKIT • The free quota • Pagination • Sync

    across all devices • Scales with your user base • No auth required to save personal data • Notifications setup made easy with CKSubscriptions • One of the best in class infrastructure • Uploading images, video, audio or any data, is so easy. I got 99 problems, but a dependency ain’t one “ - Jay-Z
  13. HOW TO INTEGRATE IT

  14. HOW TO INTEGRATE IT • Checkbox Approach • Step 1:

    Check the box • Step 2: Save all data to CoreData
  15. HOW TO INTEGRATE IT • Checkbox Approach • Step 1:

    Check the box • Step 2: Save all data to CoreData
  16. HOW TO INTEGRATE IT • Checkbox Approach • Step 1:

    Check the box • Step 2: Save all data to CoreData • Non checkbox approach • Convert your NSManagedObject to a CKRecord • Upload the record(s) using one of the APIs
  17. HOW TO INTEGRATE IT • Checkbox Approach • Step 1:

    Check the box • Step 2: Save all data to CoreData • Non checkbox approach • Convert your NSManagedObject to a CKRecord • Upload the record(s) using one of the APIs
  18. SAMPLE CODE

  19. None
  20. ACCESSING CONTAINERS

  21. SETTING UP YOUR CUSTOM ZONE

  22. SETTING UP SUBSCRIPTIONS

  23. CURSORS FOR PAGINATION

  24. FETCHING CUSTOM ZONE CHANGES

  25. App Container 1 Container 2 Container 3 Private Database Public

    Database Default Zone Default Zone Custom Zones Custom Zone 1 Custom Zone 2 App App Shared Database
  26. THE BEST PRACTICES • Refer WWDC videos • Custom Zones

    >>>>> Default Zones • CKSubscriptions be smart about using them • CKQueryCursor • Make bulk uploads • Listen to the errors, they are extremely handy • Write a wrapper over CloudKit api’s so you can easily replace it • Do not perform nested CloudKit calls • CloudKit should be called minimal times, always store the data offline
  27. THINGS I HATE ABOUT CLOUDKIT • The checkbox option, does

    not allow you to customise • Missing out on android • CloudKit Dashboard gives no analytics
  28. @mufasaYC twitter | instagram Lingo - Pocket English School Powered

    by CloudKit
  29. @mufasaYC twitter | instagram Lingo - Pocket English School Powered

    by CloudKit