Last active
October 21, 2017 17:32
-
-
Save dnaismyth/62487cbe3eb9faaf07d31ee7015937a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
var gameResults = [Game]() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
func searchForGamesByTitle(title: String){ | |
Request.get(requestUrl: Constants.URL.searchGamesByTitle + title) { (results) in | |
OperationQueue.main.addOperation { // Get back onto the main thread after our Asynchronous call | |
for jsonGame: [String: AnyObject] in results { | |
self.gameResults.append( Game(data: jsonGame) ) // initialize + add game object into our array | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment