{"id":21666429,"url":"https://github.com/doo/scanbot-sdk-example-ios-webkit-native-bridge","last_synced_at":"2026-05-21T14:05:01.662Z","repository":{"id":143616357,"uuid":"213880899","full_name":"doo/scanbot-sdk-example-ios-webkit-native-bridge","owner":"doo","description":null,"archived":false,"fork":false,"pushed_at":"2019-10-09T10:56:52.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-01-25T08:11:56.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-09T09:49:57.000Z","updated_at":"2019-10-09T10:56:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d82f25f-5226-4dbd-8120-e8321ab7d873","html_url":"https://github.com/doo/scanbot-sdk-example-ios-webkit-native-bridge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doo%2Fscanbot-sdk-example-ios-webkit-native-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doo%2Fscanbot-sdk-example-ios-webkit-native-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doo%2Fscanbot-sdk-example-ios-webkit-native-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doo%2Fscanbot-sdk-example-ios-webkit-native-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doo","download_url":"https://codeload.github.com/doo/scanbot-sdk-example-ios-webkit-native-bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566933,"owners_count":20473451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T11:26:40.614Z","updated_at":"2026-05-21T14:04:56.634Z","avatar_url":"https://github.com/doo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scanbot SDK WKWebView Example\n\nThis example app shows a simple bridge implementation between the iOS `WKWebView` and the native [Scanbot SDK](https://scanbot.io/en/sdk).\n\n\n## How to run this app\n\n```\npod install\nopen ScanbotSdkWebKitNativeBridgeExample.xcworkspace\n```\n\n\n## Basics\n### JavaScript message handlers\n\nRegister JavaScript message handlers when creating an instance of `WKWebView`:\n\n```\nlet contentController = WKUserContentController();\ncontentController.add(self, name: \"startDocumentScanner\")\nlet webConfiguration = WKWebViewConfiguration()\nwebConfiguration.userContentController = contentController\n\nwebView = WKWebView(frame: .zero, configuration: webConfiguration)\n```\n\nReceive JavaScript messages:\n\n```\nextension ViewController: WKScriptMessageHandler {\n    func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {\n        if message.name == \"startDocumentScanner\", let options = message.body as? NSDictionary {\n            // Start the native Document Scanner ...\n            startDocumentScanner(options: options)\n        }\n    }\n}\n```\n\n\n### Post messages from JavaScript - web to native\n\n```\n\u003cscript\u003e\n    function startDocumentScanner() {\n        const options = { ... };\n        webkit.messageHandlers.startDocumentScanner.postMessage(options);\n    }\n\u003c/script\u003e\n```\n\n\n### Call JavaScript - native to web\n\n```\nlet jsonPayload = \"{ \\\"pages\\\": [{...}, {...}] }\"\nwebView.evaluateJavaScript(\"documentScannerCallback(\"+jsonPayload+\")\", completionHandler: nil)\n```\n\n```\n\u003cscript\u003e\n    function documentScannerCallback(result) {\n        // result.pages[0] ...\n    }\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoo%2Fscanbot-sdk-example-ios-webkit-native-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoo%2Fscanbot-sdk-example-ios-webkit-native-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoo%2Fscanbot-sdk-example-ios-webkit-native-bridge/lists"}