Adding custom user script loaded from app bundle

suggest change
let configuration = WKWebViewConfiguration()

if let path = NSBundle.mainBundle().pathForResource("customUserScript", ofType: "js"), 
       source = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String {

        let userScript = WKUserScript(source: source, injectionTime: WKUserScriptInjectionTime.AtDocumentStart, forMainFrameOnly: false)

        let userContentController = WKUserContentController()
        configuration.userContentController = userContentController   

let webView = WKWebView(frame: self.view.bounds, configuration: configuration)

Any value in the WKUserScriptInjectionTime enum is valid: .AtDocumentStart, .AtDocumentEnd

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents