I am relatively new in this field, and really stuck here as how to get the current schemaVersion of realm.
I tried Below code to check my schemaVersion
let configCheck = Realm.Configuration();
let configCheck2 = Realm.Configuration.defaultConfiguration;
let schemaVersion = configCheck.schemaVersion
print("Schema version \(schemaVersion) and configCheck2 \(configCheck2.schemaVersion)")
but Output was coming zero always
Schema version 0 and configCheck2 0
But I have already changed my schemaVersion when Migrated, by This
let config = Realm.Configuration(
schemaVersion: 2,
migrationBlock: { migration, oldSchemaVersion in
if (oldSchemaVersion < 2) {
// Nothing to do!
}
})
Realm.Configuration.defaultConfiguration = config
I found This Answer
schemaVersionAtPath(_:encryptionKey:error:).
I am not understanding the parameters. Any example with prameters would be really helpful.