Like JockeyJS, written in Swift, and with support for WKWebView:

A bridge for WebView(UIWebView, WKWebView), using JavaScriptCore, handles communications between native(Swift) and js.

Example usage (call native function from JS):

// XCode
override func viewDidLoad() {

    // …

    let webView = WKWebView()
    let bridge = ZHWebViewBridge.bridge(webview)

    bridge.registerHandler("Video.Play") { (args:[AnyObject]) -> (Bool, [AnyObject]?) in
        return (true, nil)

    // …
// JavaScript
<-- orig source: /Pods/WebViewBridge.Swift/Sources/bridge.js -->
<script src="bridge.js"></script>
    ZHBridge.Core.ready(function() {

WebViewBridge.Swift →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.