Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TVML TvOS AppDelegate for use with TeeVee for WP, WordPress plugin.
import UIKit
import TVMLKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, TVApplicationControllerDelegate {
var window: UIWindow?
var appController: TVApplicationController?
static let TVDomain = "http://teevee.dev/"
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