Skip to content

Instantly share code, notes, and snippets.

@josescasanova
Created October 3, 2015 20:29
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 josescasanova/89296594f1888df3cb48 to your computer and use it in GitHub Desktop.
Save josescasanova/89296594f1888df3cb48 to your computer and use it in GitHub Desktop.
AppDelegate.swift
//
// AppDelegate.swift
// catVideos
//
// Created by Jose Casanova on 9/27/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 {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
let appControllerContext = TVApplicationControllerContext()
guard let javaScriptURL = NSURL(string: AppDelegate.TVBootURL) else {
fatalError("unable to create NSURL")
}
appControllerContext.javaScriptApplicationURL = javaScriptURL
appControllerContext.launchOptions["BASEURL"] = AppDelegate.TVBaseURL
appController = TVApplicationController(context: appControllerContext, window: window, delegate: self)
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment