Return object for a method inside completion block
问题 I want to make a method with URL parameter that returns the response of calling that URL. How can I return the data obtained inside a completion block for a method? class func MakeGetRequest(urlString: String) -> (data: NSData, error: NSError) { let url = NSURL(string: urlString) var dataResponse: NSData var err: NSError let task = NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: { (data, response, error) -> Void in //How can I return the data obtained here.... }) task