diff --git a/.gitignore b/.gitignore index 53d52d07..1698fae4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ # Xcode # build/ +# SwiftPM, when Package.swift is opened in Xcode or evaluated with swift package +.build/ +.swiftpm/ *.pbxuser !default.pbxuser *.mode1v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index f3680760..93646596 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ are not listed here. ## [Unreleased] +### Added + +- **iOS:** Swift Package Manager support. An app that React Native 0.88 builds with SwiftPM instead of CocoaPods can now use CallKeep; `npx react-native spm add` stopped with `Package.swift is missing for library "react-native-callkeep"`. Swift code can still `import RNCallKeep`, and CocoaPods apps don't change. See [Swift Package Manager](docs/ios-installation.md#swift-package-manager). From [#919](https://github.com/react-native-webrtc/react-native-callkeep/pull/919) (@chrfalch). + ## [4.6.1] - 2026-10-18 On Android, a call's connection now reports the dialing or ringing state that Telecom shows. On iOS, `setAudioRoute()` no longer leaves its promise pending when no route has the given name. diff --git a/README.md b/README.md index 6df11bf4..779a4e75 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ npm install react-native-callkeep cd ios && pod install ``` +An app that builds its iOS libraries with Swift Package Manager runs `npx react-native spm` instead of `pod install`: see [Swift Package Manager](docs/ios-installation.md#swift-package-manager). + Then follow the platform setup: [iOS](docs/ios-installation.md) and [Android](docs/android-installation.md). ## Quick start diff --git a/docs/ios-installation.md b/docs/ios-installation.md index fa9f4232..27de6e8a 100644 --- a/docs/ios-installation.md +++ b/docs/ios-installation.md @@ -9,6 +9,17 @@ cd ios && pod install Autolinking adds the `RNCallKeep` pod: there is nothing to link by hand in Xcode. The pod ships a privacy manifest, and it builds as a module, so Swift code can `import RNCallKeep`. +### Swift Package Manager + +React Native 0.88 can build an app's iOS libraries with Swift Package Manager (SwiftPM) instead of CocoaPods. CallKeep ships a `Package.swift`, so in an app set up for SwiftPM, run React Native's `spm` command instead of `pod install`: + +```sh +npm install react-native-callkeep +npx react-native spm +``` + +An app still on CocoaPods moves to SwiftPM with `npx react-native spm add --deintegrate`. As with the pod, Swift code can `import RNCallKeep` without a bridging header, and the privacy manifest ships in CallKeep's resource bundle. Tested with React Native 0.88.1. + ## Background modes and microphone In Xcode, under *Signing & Capabilities*, add **Background Modes** and check **Voice over IP** and **Audio, AirPlay, and Picture in Picture**. In `Info.plist`, together with the text iOS shows when it asks for the microphone, this is: diff --git a/scripts/check-package.js b/scripts/check-package.js index 12e2fd59..2ce34072 100644 --- a/scripts/check-package.js +++ b/scripts/check-package.js @@ -13,6 +13,8 @@ const required = [ 'index.d.ts', 'package.json', 'RNCallKeep.podspec', + 'Package.swift', + 'include/RNCallKeep/RNCallKeep.h', 'ios/RNCallKeep/RNCallKeep.h', 'ios/RNCallKeep/RNCallKeep.m', 'ios/PrivacyInfo.xcprivacy',