Retrieving data from closure in quick

I ran the query in parsing and extracted an array of GeoPoint coordinates. This was done in closing. I can only access array values ​​inside this closure. I need to be able to use these values ​​so that they can be used as annotations on the map, but I cannot get to them. Can someone tell me how to get array values ​​from closure.

the code:

var user = PFUser.currentUser()
user["location"] = geopoint

var query = PFUser.query()
query.whereKey("location", nearGeoPoint:geopoint)
query.limit = 10
query.findObjectsInBackgroundWithBlock({ (objects: [AnyObject]!, error: NSError!) -> Void in

    for object in objects {

        var user:PFUser = object as PFUser
        var otherUsersCoord = [PFGeoPoint]()
        otherUsersCoord.append(user["location"] as PFGeoPoint)

        println("The other users coords are: \(otherUsersCoord)")
    }

})}
+4
source share
2 answers

otherUsersCoord var , . , . "" otherUsersCoord. - , .

, , , , , . . , ( , -, " " ).

+4

- :

, , . , ( ) ( ).

, , , / .

0

Source: https://habr.com/ru/post/1569891/


All Articles