Realm documentation says that there is user object which contain flexibleSyncConfiguration method but actually it doesn't exist

46 Views Asked by At

below I will try to use user.flexibleSyncConfiguration, but it does not exit , but documentation. says it is, I use latest realm sdk 10.44. What is the issue over here?

@MainActor
func openSyncedRealm(user: User) async {
    do {
        var config = user.flexibleSyncConfiguration(initialSubscriptions: { subs in
            subs.append(
                QuerySubscription<Todo> {
                    $0.ownerId == user.id
                })
        })
        // Pass object types to the Flexible Sync configuration
        // as a temporary workaround for not being able to add a
        // complete schema for a Flexible Sync app.
        config.objectTypes = [Todo.self]
        let realm = try await Realm(configuration: config, downloadBeforeOpen: .always)
        useRealm(realm, user)
    } catch {
        print("Error opening realm: \(error.localizedDescription)")
    }
}

I tried to use synced user but it does not exist in realm swift.

0

There are 0 best solutions below