Last active
August 4, 2019 01:57
-
-
Save beriberikix/62aeaa586bb9bde307b76296911a7b5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import WebKit | |
class ViewController: UIViewController, WKUIDelegate { | |
var webView: WKWebView! | |
override func loadView() { | |
let webConfiguration = WKWebViewConfiguration() | |
webView = WKWebView(frame: .zero, configuration: webConfiguration) | |
webView.uiDelegate = self | |
view = webView | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let myURL = URL(string:"https://webassembly.org") | |
let myRequest = URLRequest(url: myURL!) | |
webView.load(myRequest) | |
webView.evaluateJavaScript(""" | |
if(typeof WebAssembly !== 'undefined') { | |
console.log("no Wasm for you!"); | |
} | |
""") { _, error in | |
// | |
} | |
webView.evaluateJavaScript("typeof WebAssembly !== 'undefined' ? 'Yes' : 'No'") { (result, error) in | |
if error != nil { | |
print(result) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment