How to define my objectTypes in Synced Realm?



Earlier i could define a synced realm in my App so:
let syncConfig: SyncConfiguration = SyncConfiguration(user: GV.myUser!, realmURL: GV.REALM_URL)
let config = Realm.Configuration(syncConfiguration: syncConfig, objectTypes: [BestScoreSync.self, PlayerActivity.self])
realmSync = try! Realm(configuration: config)
It worked fine, but i became the warning: ‘init(user:realmURL:enableSSLValidation:isPartial:urlPrefix:)’ is deprecated: Use SyncUser.configuration() instead’

I have founded in Realm documentation, how to solve this warning:
let syncConfig = GV.myUser!.configuration(realmURL:GV.REALM_URL)
realmSync = try! Realm(configuration: syncConfig)

It works nice, but now in Realm Platform are my local tables too.

Is it possible, to define in Synced Realm only my synced models BestScoreSync.self, PlayerActivity.self?

Thank You!


@Jogax You just set objectTypes on the returned object. Only the SyncConfiguration properties are arguments to the function.


Thank you for your answer, it has worked for me!!!
Jozsef :wink: