https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
l

Luiz Aguiar

02/23/2023, 11:25 PM
Hello folks, Is there any sample on how to use a custom KMM data models instead of Swift CoreData and save these models using CloudKit? I’m starting an iPhone app and would like to share the data model via KMM from the beginning.
h

hfhbd

02/24/2023, 10:48 AM
What do you want? In theory, you could use core data directly in Kotlin, but not the code generator. CD is a objective c framework, but the last time I tried it there was a problem when subclassing CDEntity in Kotlin and instantiating this in Swift. Maybe this is fixed in the meantime. AFAIK you could also use core data with cloud kit (native on swift) and simply use a cloudkit client to fetch the from android for example: https://github.com/hfhbd/CloudKitClient I did a similar thing in my playground app: I use cloudkit as a persistent server db, but all clients fetch the data from my server: https://github.com/hfhbd/ComposeTodo
l

Luiz Aguiar

02/24/2023, 2:45 PM
Thanks, will have a look in your project. I want to store custom documents using CloudKit, without relying on CoreData, I'm not a big fan tbh.
34 Views