An iOS modern bridge for sending messages between Objective-C and JavaScript in WKWebView. Include FE and iOS.
The project is in the beta phase and is being used in my own projects.
npm run docs
npm run docs:dev
sy-webview-bridge
provide a system plugin that can show a modal alert in App. This code to show a modal alert and will receive a success callback when user click OK or Cancel button.
sy.system.showModal({
title: 'SYWebViewBridge',
content: 'An iOS modern bridge for sending messages between Objective-C and JavaScript in WKWebView.',
showCancel: true,
cancelText: 'Cancel',
confirmText: 'OK',
// success
success: function(res) {
if (res.confirm) {
// user click OK button
}
else {
// user click Cancel button
}
},
// fail
fail: function(err) {
console.log(err);
},
// call when success or fail
complete: function(res) {
console.log(res);
}
});
You need to download the project SYWebViewBridge to use in iOS。
If you have any questions, you can pay attention to my wechat official account 素燕.
Please make sure to read the Contributing Guide before making a pull request.
Copyright (c) 2020-present, Suyan Wang