Skip to content

Instantly share code, notes, and snippets.

@josescasanova
Last active October 11, 2015 00:38
Show Gist options
  • Save josescasanova/5cfd4ea9fa9755862196 to your computer and use it in GitHub Desktop.
Save josescasanova/5cfd4ea9fa9755862196 to your computer and use it in GitHub Desktop.
AppDelegrate.swift
//
// 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