1. warement's Avatar
    I am looking for a way to sync my core data using cloud kit across devices. Using Swift language
    I Have read many books but i found nowhere something helpful.
    Can someone give me a demo project with a simple core data syncing with icloud in swift.
    Last edited by kch50428; 07-04-2015 at 06:10 PM. Reason: Title fixed for clarification.
    07-04-2015 06:02 PM
  2. kch50428's Avatar
    If you're in Apple's developer program, they have extensive resources there that likely will steer you in he right direction.
    07-05-2015 07:46 PM
  3. warement's Avatar
    I am but the resources are still in objective c.
    isn't anyone here who knows how to do it?
    07-06-2015 10:24 AM
  4. Scatabrain's Avatar
    I am but the resources are still in objective c.
    isn't anyone here who knows how to do it?
    A couple of things come to mind:
    - At WWDC 2014, the slides showing CloudKit were all in swift. These sessions are all online and are a great intro to it.
    - many of the guides are in ObjC but it is not difficult to translate into swift IF
    - you also read the API reference for functions you are using. These are very good. They show the differences for both languages and the prototypes for both in all cases.
    - use youtube for a first look on how to use swift with CloudKit. Then read the API.
    - get comfortable with the code complete in xcode. It gives you the syntax in Swift for you just by typing the the func name.
    - use stack overflow to get code examples when you are stuck
    - there is no core data to cloudkit hook up. It is designed as 2 systems with different purposes. You are meant to write your own interface between them where you see fit.

    Start with youtube.
    Read the APIs.
    Search stack overflow when stuck or have an error you can't figure out.

    Hope that helps.
    07-06-2015 11:34 AM
  5. Scatabrain's Avatar
    A couple of things come to mind:
    - At WWDC 2014, the slides showing CloudKit were all in swift. These sessions are all online and are a great intro to it.
    - many of the guides are in ObjC but it is not difficult to translate into swift IF
    - you also read the API reference for functions you are using. These are very good. They show the differences for both languages and the prototypes for both in all cases.
    - use youtube for a first look on how to use swift with CloudKit. Then read the API.
    - get comfortable with the code complete in xcode. It gives you the syntax in Swift for you just by typing the the func name.
    - use stack overflow to get code examples when you are stuck
    - there is no core data to cloudkit hook up. It is designed as 2 systems with different purposes. You are meant to write your own interface between them where you see fit.

    Start with youtube.
    Read the APIs.
    Search stack overflow when stuck or have an error you can't figure out.

    Hope that helps.
    I use cloudkit to store:
    - data you want the user to have if device is repaced
    - and from multiple devices

    Use core data for:
    - settings specific only to one device
    - needs to be available for offline use

    I don't bother trying to replicate one to the other. I use each where it makes sense. It seems as if you are trying to replicate core data to CloudKit. I personally wouldn't do that directly. I would decide where each makes sense.
    07-06-2015 11:41 AM
  6. warement's Avatar
    I just want what i have on one phone to be available to my other phones.
    i looked tutorials but i didnt found somethin for that only key value storage which is not what i want.
    i just asked for a simple demo project that it would sync my app data to all my devices but be also aivalable offline.
    It was the base idea that thing of icloud the data you have on one device be available to other devices too, but i cant find a simple tutorial to do that thing.
    07-07-2015 04:35 PM
  7. Scatabrain's Avatar
    I just want what i have on one phone to be available to my other phones.
    i looked tutorials but i didnt found somethin for that only key value storage which is not what i want.
    i just asked for a simple demo project that it would sync my app data to all my devices but be also aivalable offline.
    It was the base idea that thing of icloud the data you have on one device be available to other devices too, but i cant find a simple tutorial to do that thing.
    Core Data isn't meant to be shared storage. CloudKit isn't meant to sync Core Data. I am sure someone has done what you need. However, it is against the intended use for each. So finding examples may be difficult.

    I for one love that CloudKit is not designed as a sync for core data. If you spend a bit of time with CloudKit you'll adapt your way of looking at it with the benefit of being able to do so much more.
    07-07-2015 04:52 PM
  8. warement's Avatar
    in apple developers program it says exactly
    "The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your app’s existing data and store it in the cloud so that the user can access it on multiple devices." THats what i want. to take my existing data store it in a container and sync with other devices. where am i wrong?
    07-07-2015 05:05 PM
  9. Scatabrain's Avatar
    in apple developers program it says exactly
    "The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your apps existing data and store it in the cloud so that the user can access it on multiple devices." THats what i want. to take my existing data store it in a container and sync with other devices. where am i wrong?
    I believe you are thinking you can take a core data setup and hooking up cloudkit to it without writing much code. Check out this tutorial:

    07-07-2015 05:12 PM
  10. warement's Avatar
    i saw the video but doesnt help me, it does not using any existing data.
    i think what i need is this
    https://developer.apple.com/library/...ithiCloud.html
    but in swift.
    07-07-2015 05:52 PM
  11. warement's Avatar
    i found that tutorial

    i think it does what i want, i will give it a closer look tomorrow.
    07-07-2015 06:14 PM
  12. Scatabrain's Avatar
    i found that tutorial

    i think it does what i want, i will give it a closer look tomorrow.
    Hat looks like it could work for you. Looks like a lot of work in order to stay with core data. That is what you were looking for.
    07-07-2015 07:25 PM

Similar Threads

  1. Replies: 2
    Last Post: 07-08-2015, 02:18 PM
  2. Why won't my phone pair to Ford sync even though Bluetooth is switched on?
    By iMore Question in forum General Apple News & Discussion
    Replies: 3
    Last Post: 07-04-2015, 04:01 PM
  3. Why can't I pair my phone to Ford sync?
    By iMore Question in forum General Apple News & Discussion
    Replies: 1
    Last Post: 07-04-2015, 11:04 AM
  4. Syncing music from mac
    By MrRJ in forum iOS 8
    Replies: 2
    Last Post: 07-04-2015, 01:15 AM
  5. The best Mac games: Comedy Dating Sim Edition
    By iMore.com in forum iMore.com News Discussion
    Replies: 0
    Last Post: 07-03-2015, 11:12 AM
LINK TO POST COPIED TO CLIPBOARD