{"id":18702701,"url":"https://github.com/tmarkovski/bridgecommander","last_synced_at":"2025-04-12T08:51:31.591Z","repository":{"id":92692314,"uuid":"74351929","full_name":"tmarkovski/BridgeCommander","owner":"tmarkovski","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-05T11:39:15.000Z","size":44,"stargazers_count":25,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T11:36:36.441Z","etag":null,"topics":["ios","native-bridge","swift","wkwebview"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmarkovski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-11-21T10:20:03.000Z","updated_at":"2022-11-04T04:47:45.000Z","dependencies_parsed_at":"2023-04-27T07:05:24.856Z","dependency_job_id":null,"html_url":"https://github.com/tmarkovski/BridgeCommander","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarkovski%2FBridgeCommander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarkovski%2FBridgeCommander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarkovski%2FBridgeCommander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmarkovski%2FBridgeCommander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmarkovski","download_url":"https://codeload.github.com/tmarkovski/BridgeCommander/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543882,"owners_count":21121838,"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":["ios","native-bridge","swift","wkwebview"],"created_at":"2024-11-07T11:46:44.680Z","updated_at":"2025-04-12T08:51:31.585Z","avatar_url":"https://github.com/tmarkovski.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BridgeCommander\n[![Build Status](https://travis-ci.org/tmarkovski/BridgeCommander.svg?branch=master)](https://travis-ci.org/tmarkovski/BridgeCommander)\n\nA wrapper library for iOS apps that provides easy to use functions for briding the communication between the native runtime and javascript runtime hosted in a WKWebView. The library wraps the functionality provided by `WKUserContentController` and embeds a javascript library that exposes promise style functions.\n\n## Usage\nIn Swift, create a `BridgeCommander` instance and start adding commands. Use `send` function to provide result back or `error` to pass back an error result.\n```swift\n    let commander = BridgeCommander(webView)\n    commander.add(\"echo\") { command in\n        command.send(args: \"You said: \\(command.args)\")\n    }\n```\nIn JavaScript, invoke this command as\n```javascript\n    BridgeCommander.call(\"echo\", \"Hello!\")\n        .then(function(result) { console.log(result); })\n        .catch(function(error) { console.log(error); });\n```\n\nThat's it!\n\n## Installation\n### Plain old copy/paste\nThe simplest way would be to add `BridgeCommander.swift` and `BridgeCommander.js` to your xcode project. Make sure to update the javascript file reference inside the code if you rename the files or place them in separate folders. Do not reference the js file in your web app, it will be automatically available everywhere.\n### Using Carthage\nThis is a clean and fast way to use this as a library in your project. If you're unfamiliar with Carthage, [read Ray's article](https://www.raywenderlich.com/109330/carthage-tutorial-getting-started) on using it \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmarkovski%2Fbridgecommander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmarkovski%2Fbridgecommander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmarkovski%2Fbridgecommander/lists"}