I'm trying to do a custom migration, following the instructions found here, changing an attribute name and type but it doesn't seem to be running the mapping.
Old model has an attribute names "roundDrill" which is a Boolean. The new model has this removed and a new attribute called "drillType" which is a String.
I have a mapping model called "V2V3.xcmappingmodel" where the entity has a custom policy set "Diamond_Painting_Logbok.V2V3". The new attribute has a value of "FUNCTION($entityPolicy, "roundToType:" , $source.roundDrill)"
In the "V2V3.swift" I have the below code
import UIKit
import CoreData
class V2V3: NSEntityMigrationPolicy {
func roundToType(isRound:NSNumber) -> String {
NSLog("Round: \(isRound)")
if isRound.boolValue {
return "Round"
} else {
return "Square"
}
}
}
When I print out the value of drillType, I'm getting nil. The NSLog on the function isn't being printed at all. If I change the custom policy name, its not giving me an error so appears as though its being ignored completely