offers this scenario
asynchronous network operation method
func asyncMethodA() -> String? { result : String? Alamofire.manager.request(.POST, "https://www.apiweb.com/apimethod", parameters: parameters, encoding:.JSON) .response { (request, response, rawdata, error) in if (response?.statusCode == 200) {
another method with asynchronous network operations
func asyncMethodB() -> String? { result : String? Alamofire.manager.request(.POST, "https://www.yetanotherapiweb.com/apimethod", parameters: parameters, encoding:.JSON) .response { (request, response, rawdata, error) in if (response?.statusCode == 200) {
the method in which I will call these methods A and B, perform some operations
func displayResult { 1) let a = asyncMethodA() 2) let b = asyncMethodB() 3) println(a + b)
so the question is how could I make (2) wait for (1) to complete, and (3) wait (2), etc. (that 1,2 and 3 are started synchronously)?
(I know that one answer is to chain asyncMethodA and displayResult in asyncMethodB, but want to know if there is any other method)
Thank you!
source share