defaultConfiguration


#1

I am new to Realm. I followed the configuration example from the documentation, but do not see the expected change.

    func changeConfig() {
        var config = Realm.Configuration()
        print(config)

        config.deleteRealmIfMigrationNeeded = true
        Realm.Configuration.defaultConfiguration = config

        let newConfig = Realm.Configuration()
        print(newConfig)
    }

will output:

Realm.Configuration {
	fileURL = file:///Users/xxx/Library/Application%20Support/yyy/default.realm;
	inMemoryIdentifier = (null);
	encryptionKey = (null);
	readOnly = 0;
	schemaVersion = 0;
	migrationBlock = (null);
	deleteRealmIfMigrationNeeded = 0;
	shouldCompactOnLaunch = (null);
	dynamic = 0;
	customSchema = (null);
}
Realm.Configuration {
	fileURL = file:///Users/xxx/Library/Application%20Support/yyy/default.realm;
	inMemoryIdentifier = (null);
	encryptionKey = (null);
	readOnly = 0;
	schemaVersion = 0;
	migrationBlock = (null);
	deleteRealmIfMigrationNeeded = 0;
	shouldCompactOnLaunch = (null);
	dynamic = 0;
	customSchema = (null);
}

Ergo: no changes. I’d expect to see deleteRealmIfMigrationNeeded = 1; in the second configuration.

What am I doing wrong? Am I overlooking something?