Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let myLocation = PFGeoPoint(latitude: 34.415075, longitude: -119.862538)
- var results = ATMsAroundMe(myLocation)
- func ATMsAroundMe(myLocation : PFGeoPoint) -> [ATM]{
- var results = [ATM]()
- var query = PFQuery(className: "ATMs")
- query.whereKey("location", nearGeoPoint: myLocation, withinMiles: 5)
- query.limit = 10
- query.findObjectsInBackgroundWithBlock { (atms: [PFObject]?, error: NSError?) -> Void in
- if (error == nil) {
- for atm in atms! {
- if let result : ATM? = ATM.init(id: atm.objectId!){
- //Add the result to the results array
- print("Successful")
- print(result?.bank)
- results.append(result!)
- }
- else{
- }
- }
- } else {
- // Log details of the failure
- }
- }
- return results
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement