SwiftJS桥
SwiftJSBridge是一个方便JavaScript桥,用Swift编写,支持WKWebView和UIWebView
例子
Swift
let JSBridge = SwiftJSBridge ( for : webview)
JSBridge. addSwift ( bridge : { (data, cb) in
cb ? ([ " appVersion " : " 1.0 " ])
}, name : " getAppVersion " )
JSBridge ? . callJS ( name : " sendMessageToJS " , data : [ " message " : " Hi, I am native " ]) { (data) in
}
JS
function setupSwiftJSBridge ( callb
1