lundi 20 avril 2015

Fastest and efficient way to populate an array based on Parse query swift

Vote count: 0

I am populating the array based on Parse query, one by one. Is there a faster and more efficient way?

func loadDistricts() {
  var query = PFQuery(className: RFIstanbulDistrictsClassKey)
  query.whereKey(RFIstanbulDistrictsDistrictKey, notEqualTo: "")
  query.orderByAscending(RFIstanbulDistrictsDistrictKey)
  //query.limit = 1000
  districts.removeAll(keepCapacity: true)

  query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
    if error == nil {
      for object in objects {
        let district : String = object[RFIstanbulDistrictsDistrictKey] as!     String
        districts.append(district)
      }
    }
  }
}

asked 2 mins ago



Fastest and efficient way to populate an array based on Parse query swift

Aucun commentaire:

Enregistrer un commentaire