Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
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

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:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.