0

I'm building a class to retrieve METAR data (weather info) for certain location. in class initializer im using swiftHTTP to make HTTP post request to retrieve XML with data.once I have the XML data I parse it and retrieve the temperature info and assigning it to class property.

The problem is that when I instantiate the class and try to access the temperature property it is still empty.

I know that its because the call is asynchronous , but how do I design this all correct so that after instantiating I can get the temperature property already with the retrieved value ?

Thanks

Yuval

Yuval
  • 3
  • 4
  • would it be suit to you? http://stackoverflow.com/questions/31557688/synchronous-url-request-on-swift-2 – Jacky Shek Jun 14 '16 at 04:57
  • You should use a callback. I've got a few [examples](http://stackoverflow.com/search?q=user%3A2227743+callback). – Eric Aya Jun 14 '16 at 10:13

0 Answers0