Last active
October 11, 2015 00:38
-
-
Save josescasanova/5cfd4ea9fa9755862196 to your computer and use it in GitHub Desktop.
AppDelegrate.swift
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
// | |
// AppDelegate.swift | |
// hello world | |
// | |
// Created by Jose Casanova on 10/10/15. | |
// Copyright © 2015 Jose Casanova. All rights reserved. | |
// | |
import UIKit | |
import TVMLKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate { | |
var window: UIWindow? | |
var appController: TVApplicationController? | |
static let TVBaseURL = "http://localhost:9001/" | |
static let TVBootURL = "\(AppDelegate.TVBaseURL)js/application.js" | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
self.window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
let appControllerContext = TVApplicationControllerContext() | |
let javascriptURL = NSURL(string: AppDelegate.TVBootURL) | |
appControllerContext.javaScriptApplicationURL = javascriptURL! | |
if let options = launchOptions { | |
for (kind, value) in options { | |
if let kindStr = kind as? String { | |
appControllerContext.launchOptions[kindStr] = value | |
} | |
} | |
} | |
self.appController = TVApplicationController(context: appControllerContext, window: self.window, delegate: self) | |
return true | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment