This article may be out of date! Please visit our new help center api.support.vonage.com
Vonage Video SDK (also known as Opentok) is available only via Cocoapods. This page explains how to convert this SDK into an SPM package. This is a workaround until an official SPM package is released by Vonage.
- Video API
- Vonage iOS Client SDK
- Download the Opentok XCFramework package from Cocoapods.
- Extract the Pods/OTXCFramework/OpenTok.xcframework to a new folder Opentok-SPM-x.y.z
- Create a Package.swift file in the Opentok-SPM-x.y.z folder describing the package.
- Create a local git repo, commit and add a tag.
- Use the full path to the Opentok-SPM-x.y.z folder as the package path in Xcode and install it.
The BASH script below performs the above tasks 1-4.
Execute the script as shown below to generate the SPM package for Opentok SDK 2.23.0
echo "platform :ios, '12.0'
install! 'cocoapods', integrate_targets: false
pod 'OTXCFramework', '$1'
" > Podfile
rm -f Package.swift
echo "// swift-tools-version:5.3
let package = Package(
)" > Opentok-SPM-$1/Package.swift
rm -rf Opentok-SPM-$1
mv -f Pods/OTXCFramework/OpenTok.xcframework Opentok-SPM-$1
git init -b master
git add *
git commit -q -m "initial commit"
git tag $1
rm -f Podfile
rm -f Podfile.lock
rm -rf Pods
echo "Generating Podfile for SDK version" $1
echo "Installing pods"
echo "Extracting XCFramework"
echo "Generating SPM package"
With: (or the latest version available)
Optionally, you can push this git repo to a remote location and use the remote repo while adding the SPM package in swift. You will need to make a small change in the Package.swift file, though. However, we found that GitHub has a limit of 100MB per file and XCode SPM installer doesn’t support git-lfs.