title: How to save a location breadcrumb to CoreData in Swift
body: <p>I'm trying to save a users journey as a breadcrumb in CoreData so I can retrieve it even if they quit the app. At the moment the following code saves their location to CloudKit but I've been told in order to retrieve their breadcrumb it's best to save it to Core Data. </p>
  
  <p>Just wondering how I go about that? </p>
  
  <pre><code>func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
       let location = locations.last!
       let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
       addCrumbPoint(center)
  
       // Add to Cloudkit
       let locationRecord = CKRecord(recordType: "location")
       locationRecord["location"] = location
       let publicData = CKContainer.defaultContainer().publicCloudDatabase
       publicData.saveRecord(locationRecord) { 
           record, error in
       }
  }
  </code></pre>