extension NSManagedObject{
/// Perform on main context asynchrounously
/// SaveContext will be called after the block() is executed
/// - Parameter block: The blcok of code passing context as param
class func performOnMainContext(_ block:@escaping ClosureTypes.managedObjectContextClosure){
let context:NSManagedObjectContext! = appDataController().mainContext()
context.perform {
block(context)
context.saveContext()
}
}
}
答案 0 :(得分:0)
没有保留周期,但是这段代码没有意义。