{"id":14992028,"url":"https://github.com/antoniusnaumann/cargo-swift","last_synced_at":"2025-12-26T22:53:38.081Z","repository":{"id":65419128,"uuid":"591007351","full_name":"antoniusnaumann/cargo-swift","owner":"antoniusnaumann","description":"A cargo plugin to easily build Swift packages from Rust code","archived":false,"fork":false,"pushed_at":"2023-12-12T23:37:26.000Z","size":3276,"stargazers_count":76,"open_issues_count":10,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-12-13T00:30:27.220Z","etag":null,"topics":["cargo","cargo-plugin","cargo-subcommand","rust","spm","swift","swift-package-manager","uniffi","uniffi-rs"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/cargo-swift","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoniusnaumann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-01-19T18:08:29.000Z","updated_at":"2024-02-18T22:40:14.295Z","dependencies_parsed_at":"2023-12-20T16:04:35.658Z","dependency_job_id":null,"html_url":"https://github.com/antoniusnaumann/cargo-swift","commit_stats":{"total_commits":126,"total_committers":1,"mean_commits":126.0,"dds":0.0,"last_synced_commit":"fd1c2e07cae698b3dba4b7b68aa3d349aa4b5b27"},"previous_names":[],"tags_count":14,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniusnaumann%2Fcargo-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniusnaumann%2Fcargo-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniusnaumann%2Fcargo-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoniusnaumann%2Fcargo-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoniusnaumann","download_url":"https://codeload.github.com/antoniusnaumann/cargo-swift/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234200156,"owners_count":18795139,"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":["cargo","cargo-plugin","cargo-subcommand","rust","spm","swift","swift-package-manager","uniffi","uniffi-rs"],"created_at":"2024-09-24T15:00:39.651Z","updated_at":"2025-12-26T22:53:38.066Z","avatar_url":"https://github.com/antoniusnaumann.png","language":"Rust","funding_links":[],"categories":["FFI Bindings","rust"],"sub_categories":[],"readme":"# cargo-swift\n[![Language: Rust](https://img.shields.io/badge/Language-Rust-F46623)](https://www.rust-lang.org)\n[![Crates.io Version](https://img.shields.io/crates/v/cargo-swift)](https://crates.io/crates/cargo-swift)\n[![Dependency Status](https://deps.rs/repo/github/antoniusnaumann/cargo-swift/status.svg)](https://deps.rs/repo/github/antoniusnaumann/cargo-swift)\n\n[![Build](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/ci.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/ci.yml)\n[![Publish](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/publish.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/publish.yml)\n[![Examples](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/examples.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/examples.yml)\n[![E2E Tests](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/end-to-end.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/end-to-end.yml)\n[![Clippy](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/clippy.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/clippy.yml)\n[![Dependencies](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/audit.yml/badge.svg)](https://github.com/antoniusnaumann/cargo-swift/actions/workflows/audit.yml)\n\n\n\u003e A cargo plugin to easily build Swift packages from Rust code\n\n*cargo swift* provides interactive commands for initializing and packaging a Rust library as Swift Package for usage in iOS and macOS apps.\nThis plugin uses Mozilla's [UniFFI](https://github.com/mozilla/uniffi-rs) for bridging between Swift and Rust. To learn more about using UniFFI, read its [User Guide](https://mozilla.github.io/uniffi-rs/latest/),\nbut note that you can **skip** the parts about generating bindings (section 2.4) and building a swift module (sections 10. and 11.) as *cargo swift* already takes care of this!\n\n![](https://github.com/antoniusnaumann/cargo-swift/blob/main/readme/cargo-swift-demo.gif)\n\n## Getting Started\n\u003e **Note**\n\u003e This plugin can only be used on macOS, since proprietary toolchains are \n\u003e required for this plugin to work properly.\n\n### Prerequisites\nInstall this plugin, simply run\n```\ncargo install cargo-swift\n```\n\n#### Installing for a different UniFFI version\nCurrently, `cargo swift` does not detect the UniFFI version of your project automatically, so for now, you have to install a matching version of cargo swift: \n| UniFFI | cargo swift |\n|--------|-------------|\n| 0.25   | 0.5         |\n| 0.26   | 0.6         |\n| 0.27   | 0.7         |\n| 0.28   | 0.8         |\n| 0.29   | 0.9         |\n| 0.30   | 0.10        |\n\nTo do so, run \n```\ncargo install cargo-swift@0.X -f  \n```\nand replace `0.X` with the cargo swift version you want to install.\n\n### Using cargo-swift\nYou can create a new library crate by running\n```\ncargo swift init\n```\nThis creates a new Rust library crate with some boilerplate code and some examples to quickly get started with UniFFI. For full reference, check out [this chapter of the UniFFI User Guide](https://mozilla.github.io/uniffi-rs/udl_file_spec.html)\n\nTo bundle the previously created Rust library as Swift Package, run:\n```\ncargo swift package\n```\nThis command interactively prompts you for swift package name and target platforms.\nIf some required toolchains for the selected target platforms are missing, cargo swift will ask you if it should install them automatically.\n\nThat's it! You can now include the created package in an iOS or macOS app via Swift Package Manager.\n\n### Configuration\nAs of now, configuration can only be supplied via command line arguments. Most of the time, the default should be fine - however, sometimes it might be useful to store configuration persistently. You can find a draft of how this might look in [CONFIG-DRAFT.md](/CONFIG-DRAFT.md).\n\n## License\n### Apache-2.0\n```\n Copyright 2023 Antonius Naumann\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n### MIT\n```\nMIT License\n\nCopyright (c) 2023 Antonius Naumann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniusnaumann%2Fcargo-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoniusnaumann%2Fcargo-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniusnaumann%2Fcargo-swift/lists"}