Skip to content

Instantly share code, notes, and snippets.

@ohryan ohryan/AppDelegate.swift
Last active Jan 16, 2016

What would you like to do?
TVML TvOS AppDelegate for use with TeeVee for WP, WordPress plugin.
import UIKit
import TVMLKit
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate {
var window: UIWindow?
var appController: TVApplicationController?
static let TVDomain = ""
static let TVPluginURL = "\(AppDelegate.TVDomain)wp-content/plugins/teevee/"
static let TVBaseURL = "\(AppDelegate.TVDomain)teeveeclient/"
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
appControllerContext.launchOptions["PLUGINURL"] = AppDelegate.TVPluginURL
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
You can’t perform that action at this time.