I'm trying to migrate a Realm and assign a property to be a primary key - but setDefaultRealmSchemaVersion seems like its not being executed:  
func applicationDidFinishLaunching(aNotification: NSNotification) {
    // prints "Current Version: 3"
    println("Current version \(schemaVersionAtPath(Realm.defaultPath, encryptionKey: nil, error: nil)!)")
    let migrationBlock: MigrationBlock = { migration, oldSchemaVersion in
        if oldSchemaVersion < 4 {
            migration.enumerate(Fruits.className()) {oldObject, newObject in
                    let id = oldObject!["id"] as! Int
                    newObject!["primaryKeyProperty"] = id
            }
        }
        println("Migration complete")
    }
    setDefaultRealmSchemaVersion(4, migrationBlock)
    // prints "New Version: 3"
    println("New Version: \(schemaVersionAtPath(Realm.defaultPath, encryptionKey: nil, error: nil)!)")  
}
Any ideas why is that? Thanks in advance!
 
                        
Your
Realm's migration block will only be executed if you explicitly migrate the Realm, or create the Realm viaRealm().