My function is like this:
class function functionName(..args) ->NSData {
var data : NSData?
object1.operation(arg1,arg2, onComplete:{
(error:NSError) -> Void in
/*My Code For Downloading data goes Goes Here*/
data = downloadedData
})
return data
}
So, what happening is before the execution of object1.operation
, my code is getting to return data
statement.
How can I prevent further execution of my function until the object1.operation
method gets completed? I've tried dispatch_semaphone
, dispatch_group
, dispatch_async
, dispatch_sync
, etc .. none of them helped.