WebRTC binary package store for Apple platforms
Official documentation: https://webrtc.googlesource.com/src/+/main/docs/native-code/ios/
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.gitOnce cloned, add depot_tools to the front of your PATH environment variable:
export PATH=<path/to/depot_tools>:$PATHdepot_tools provides commands such as gn, fetch etc. which are needed to clone, configure and build WebRTC.
- Create a directory for the WebRTC source and enter it
- Run:
fetch --nohooks webrtc_ios && gclient sync
- Enter the
srcdirectory - Create a build output directory, e.g.
out - Generate the build tree:
# Note: Assuming 'out/' exists here...
gn gen out/ --args='target_os="ios" target_cpu="arm64" target_environment="device" is_debug=false ios_enable_code_signing=false rtc_include_tests=false rtc_enable_objc_symbol_export=true' --ide=xcodeNow build the WebRTC framework: ninja -C out/ framework_objc
Note: We're only building for ios/arm64 here. If you need other variants, repeat this step for each (using a different build output directory for each one) and adapt the XC framework generation command below to include the other frameworks.
- Navigate to the build output directory and run:
xcodebuild -create-xcframework -framework WebRTC.framework -output WebRTC.xcframework - Zip it:
zip -r WebRTC.xcframework.zip WebRTC.xcframework - Generate checksum:
shasum -a 256 WebRTC.xcframework.zipand make a note of it. This checksum should be included in the release info, and is later referenced by your Package.swift file when defining the WebRTC target.
// Package.swift
.binaryTarget(
name: "WebRTC",
url: "https://github.com/vidhance/webrtc-objc/releases/download/114.0.2/WebRTC.xcframework.zip",
checksum: "c284debac479f1307ab53cd828b19276d525a07d6635e717f29056e5f4bd0ddf"
),