Skip to content

Instantly share code, notes, and snippets.

@dnaismyth
Last active October 21, 2017 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnaismyth/62487cbe3eb9faaf07d31ee7015937a9 to your computer and use it in GitHub Desktop.
Save dnaismyth/62487cbe3eb9faaf07d31ee7015937a9 to your computer and use it in GitHub Desktop.
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