swift-rs
Call Swift from Rust with ease!
1.0.8
14M downloads/mo
#2633 most downloaded on crates.io
Brendonovich/swift-rs
What this package is like to depend on
Last release 3 days ago
20 Aug 2026
Release timing varies
gaps range from 2 weeks to 2.0 years
Most releases are documented
notes for 10 of 15 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
15 releases · first in 2021
1 release in the last 12 months
see the full history below
Release timeline
15 releases · Oct 2021 to Aug 2026Releases
latest 15-
1.0.820 Aug 2026Nothing published for this version
-
1.0.727 Aug 2024 -
1.0.606 Aug 2023Release notes
Open source →A lot of small fixes in this one, thanks to everyone who has been reporting issues and submitting PRs!
What's Changed
- Enable cross-compiling for macOS targets by @HeavenVolkoff in #48
- Fix the broken cross-compile command with Xcode15 SDK by @pewsheen in #51
- Create SRData from slices by @irh in #52
- force using system clang unless overridden by @Brendonovich in #54
New Contributors
- @HeavenVolkoff made their first contribution in #48
- @pewsheen made their first contribution in #51
- @irh made their first contribution in #52
Full Changelog: 1.0.5...1.0.6
-
1.0.510 Apr 2023Release notes
Open source →--build-pathnow used instead of--scratch-path(#47) by @lucasfernogTurns out
--scratch-pathdoesn't do what I thought and is only available for newer Swift versions. -
1.0.405 Apr 2023Release notes
Open source →iOS Simlator Fix (#40) by @Berrysoft
Hopefully more things work and #42 is fixed.
SRData utilities (#44) by @LeviticusNelson
SRDatacan now be created from&Vec<u8>, allowing byte buffers to be passed between Rust and Swift easily. -
1.0.318 Mar 2023Release notes
Open source →Turns out that
clang_rthas to be handled specially for the iOS simulator, who'd have guessed. -
1.0.217 Mar 2023Release notes
Open source →Just a quick fix for iOS support today! Thanks to @lucasfernog we now link against
clang_rt.ios, hopefully alleviating any___isPlatformVersionAtLeasterrors. -
1.0.113 Mar 2023Release notes
Open source →Just a few changes here, nothing crazy.
Swift artefacts now stored in
OUT_DIR(#32)The
.buildfolder is now redirected toOUT_DIR, making it much easier to publish crates that contain Swift code.
It also allows for...Automatic recompilation when Swift files are modified (#28)
With compilation artefacts being away from source code, it's now safe for
swift-rsto instruct Cargo to recompile Swift packages anytime their contents change!
Big thanks to my 5 (!!!) sponsors!
-
1.0.028 Feb 2023Release notes
Open source →After not touching this project for months on account of being stumped by how to make stuff work properly, I'm super excited to be releasing v1.0.0 of
swift-rs!Breaking Changes
- Everything is now exported from the root of the crate, so no more
build::*ortypes::*imports link_swiftfunctions are gone in favour ofSwiftLinker
New Traits + Macro
Manually writing
extern "C"blocks are now a thing of the past thanks to theswift!macro!
This macro enforces that your argument and return types are compatible with Swift thanks to theSwiftArgandSwiftRettraits respectively, and allows for...Improved Memory Safety
SRObjectvalues are now properly dropped, andswift!is capable of 'stealing' objects from Swift's reference counting system, allowing Rust to have full control over the lifetime of Swift data! This wouldn't have been possible without @amodm's help, many thanks to him.SwiftLinkerGone are the old
link_swiftandlink_swift_packagefunctions, nowSwiftLinkercan be used to build up a configuration and then link everything at once!iOS Support
Thanks to @lucasfernog,
swift-rswill be powering Tauri mobile on iOS! If you can figure out how to run Rust on iOS, then callingwith_ioson yourSwiftLinkershould work.I've got a few more ideas for this library but won't execute on them for a while in order to focus on other projects.
Thank you to everyone who has contributed, I couldn't have done this without you! - Everything is now exported from the root of the crate, so no more
-
0.3.027 Mar 2022Release notes
Open source →New Features
- Optional
NSObjectvalues are now supported (#4) - Objects created in Swift are now released when their Rust counterparts are dropped (#2)
- Build script has been updated to support M1 Macs (#6)
Changes
- Build module has been renamed from
build_utilstobuildand is behind corresponding Cargo feature (avoids requiringserdeandserde_jsonto be included by default) - Serde support is now behind Cargo feature
serde getMountsexample no longer leaks huge amounts of memory
- Optional
-
0.2.323 Dec 2021 -
0.2.207 Nov 2021Nothing published for this version
-
0.2.103 Nov 2021Nothing published for this version
-
0.2.001 Nov 2021Nothing published for this version
-
0.1.020 Oct 2021Nothing published for this version