its better to use closure because its work in background but it stores strong reference of object so whenever operation finish you get data back and also after that you make an operation on data.

Example code

func retrivingData(completion : (()->())){

// do opearation

completion(data)

}

retrivingdata(){ data in

print(data)

}

You may also like

Leave a Reply