Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I share iOS Realm Databases with App Groups?

Can I share iOS Realm Databases with App Groups? If yes, how? If not, how can I share my Realm Database to my other apps?

like image 764
Berry Avatar asked Jun 04 '17 01:06

Berry


People also ask

What is iOS realm database?

Realm Database stores objects in realm files on your device, or you can open an in-memory realm which does not create a file. Configure and open a realm to get started reading and writing data. 4.

How do I view realm database iOS?

Right-click the downloaded file and "Show Package Contents." You'll find your Realm files under AppData/Documents/mongodb-realm/<app-name>/????? . Find the file for the realm you're interested in and double-click it to open it in Realm Studio.

What is realm mobile database?

Realm is an open source object database management system, initially for mobile operating systems (Android/iOS) but also available for platforms such as Xamarin, React Native, and others, including desktop applications (Windows), and is licensed under the Apache License.

Is realm database online?

Storing, accessing, and updating your data is simple and lightweight as it accesses objects using the native query language for each platform. Realm offers Network Reliability: The Realm database is offline-first. It means that you always read from and write to the local database and not over the network.


1 Answers

To share Realms between apps in the same iOS app group, you'll need to specify a common location for the 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)
like image 109
jpsim Avatar answered Oct 07 '22 21:10

jpsim