Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
class ViewController: UIViewController {
var gameResults = [Game]()
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
override func 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