i’m new with the development of ios app , i’m working with realm database , now i want to work with realm cloud instead of using realm file , can someone help me to do that ?
i did use this :
let config = SyncUser.current?.configuration(realmURL: Constants.REALM_URL, fullSynchronization:true )
var realm = try! Realm(configuration: config)
Just a cursory observation, but you are opening your realm as if it were a local realm. If you are using realm cloud with a MongoDB Realm app you should probably use asyncOpen instead of the synchronous Realm open try! Realm(configuration: config). It should look something like this
if let user = self.app.currentUser {
let uid = user.id
// open user realm
Realm.asyncOpen(configuration: user.configuration(partitionValue: uid),
callback: { result in
switch result {
case .success(let realm):
self.userRealm = realm
case .failure(let error):
fatalError("Failed to open realm: \(error)")
}
})
}