Can I use iOS Realm Databases with App Groups?

Can I use iOS Realm Databases with App Groups? If so, how? If not, how can I share my Realm database with other apps?

+3


source to share


1 answer


To share Realms between apps in the same iOS app group, you need to provide a shared location for Realm:



let fileURL = FileManager.default
    .containerURL(forSecurityApplicationGroupIdentifier: "group.io.realm.app_group")!
    .appendingPathComponent("default.realm")
let config = Realm.Configuration(fileURL: fileURL)
let realm = try Realm(configuration: config)

      

+3


source







All Articles