Hi Guys,
I am trying to learn Core Data using Swift, however I am lost at how to implement some more technical features.
Specifically I would like to have a function run before data is saved to the database, for example this could be used to verify or format the data before being saved.
On a normal class object I can use the below code
What is the best way to extend the NSManagedObject class
I am trying to learn Core Data using Swift, however I am lost at how to implement some more technical features.
Specifically I would like to have a function run before data is saved to the database, for example this could be used to verify or format the data before being saved.
On a normal class object I can use the below code
Code:
var lastAccuracyString: String {
get {
if (monitoring) {
return NSString(format:"%.2f meters", lastAccuracy) as String
} else {
return "Unmonitored"
}
}
}
What is the best way to extend the NSManagedObject class
Last edited by a moderator: