optimize fetching objects with NSManagedObjectIDs

This commit is contained in:
John Rommel Estropia
2015-08-26 23:59:18 +09:00
parent 10e0cf8d2c
commit 16aabe1f3b
8 changed files with 67 additions and 93 deletions

View File

@@ -159,13 +159,14 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec
if let mapView = self.mapView, let gesture = sender as? UILongPressGestureRecognizer where gesture.state == .Began {
let coordinate = mapView.convertPoint(
gesture.locationInView(mapView),
toCoordinateFromView: mapView
)
CoreStore.beginAsynchronous { (transaction) -> Void in
let place = transaction.edit(Static.placeController.object)
place?.coordinate = mapView.convertPoint(
gesture.locationInView(mapView),
toCoordinateFromView: mapView
)
place?.coordinate = coordinate
transaction.commit { (_) -> Void in }
}
}