Skip to main content
Version: Next

Swift Package Manager (iOS)

Swift Package Manager (SwiftPM) is an experimental alternative to CocoaPods for building React Native iOS apps. To find out what it requires and how to switch an app to it, see the React Native 0.87 announcement.

react-native-audio-api ships a Package.swift, so in a SwiftPM app it is autolinked like any other library. There is no extra setup step. Swift Package Manager downloads the prebuilt Opus / Ogg / Vorbis (and, if enabled, FFmpeg) libraries while it resolves packages.

Worklets​

react-native-audio-worklets ships a Package.swift as well. It builds against react-native-worklets, which supports Swift Package Manager from version 0.13.0.

Build options​

enableFFmpeg and disableStaticExternalLibs are read from the react-native-audio-api section of the app's package.json, as with CocoaPods and Gradle.

caution

Swift Package Manager caches an evaluated Package.swift by its contents, not by the files it reads, so a change to these options is ignored until that cache is reset. After changing them:

rm -rf ~/Library/Caches/org.swift.swiftpm/manifests   # or Xcode ▸ File ▸ Packages ▸ Reset Package Caches
cd ios && npx react-native spm

To confirm an enableFFmpeg change took effect, check isFfmpegEnabled() at runtime. There is no runtime flag for disableStaticExternalLibs.

We are Software Mansion.