WebApp

public protocol WebApp

A WebApp is an HTTP[S]-accessible location and a string identifier for logging. Optionally, it can also:

  • Store a reference to the WKWebView that hosts it
  • Provide a WKWebViewConfiguration
  • Provide a WKWebViewNavigationDelegate
  • Listen to webkit.messageHandlers[name].postMessage(body) calls

To support these features, have a look at the other protocols starting with WebApp*.

Conceptually, a WebApp represents your web application in native app code. It has sole responsibility for calling JavaScript in the page and receiving messages. A common pattern is to define a delegate and pass on messages as calls to the delegate.

Simplest possible web app:

class SimplestExampleWebApp: WebApp {
    let appIdentifier = "google"
    let initialURL = NSURL(string: "https://google.com")!
}