Search code examples
ioscloudkit

Is it a way to easily copy records from one CloudKit container to an other?


I have an other project and some of the records I need there too. Is it an easy way to copy them?


Solution

  • In one app you can access multiple containers. instead of using:

        container = CKContainer.defaultContainer()
    

    you can use:

        container = CKContainer(identifier: "another_container")
    

    as the identifier use whatever you have specified at your application Capabilities (Specify custom containers)

    You can then read records from 1 container and write them to the other.