title: Create an array of CLLocation coordinates from Core Data
body: <p>Perhaps I can't find an answer to this question because it's something so very simple that I should be able to figure it out, but I'm stumped. Oh, and apologies if some of my terminology is off - I'm still learning.</p>
  
  <p>I'm using Swift and have an array derived from Core Data. So far, so good. Two elements within this array are Doubles/NSNumbers storing latitude and longitude. I'll be using these two elements to draw on to a map, but I can't figure out how to get these two into an array of CLLocations of their own.</p>
  
  <p>So, I've got my array of all the data in Core Data:</p>
  
  <pre><code>var locationsList: [Locations] = []
  
   var context = (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext!
      var request = NSFetchRequest(entityName: "Locations")
      let pred = NSPredicate(format: "game = %d", passedGameNumber)
      request.predicate = pred
      request.sortDescriptors = [NSSortDescriptor(key:"time", ascending: false)]
      self.locationsList = context.executeFetchRequest(requestMap, error: nil)! as [Locations]
  </code></pre>
  
  <p>But it holds data from everything in Core Data (filtered by game):</p>
  
  <pre><code>class Locations: NSManagedObject {
  
  @NSManaged var game: NSNumber
  @NSManaged var time: NSDate
  @NSManaged var latitude: NSNumber
  @NSManaged var longitude: NSNumber
  
  }
  </code></pre>
  
  <p>And I only need an array containing latitude and longitude, which I will need to convert to CLLocation to put on a map. I should have the map part figured out - it's just this array that has me scratching my head! Thanks.</p>