Creating an XCFramework for the Lightstreamer iOS Client
1. Create a work directory structure:
work/
os/
sim/
mkdir -p work/os work/sim
2. Change directory into work.
cd work
3. Download the Lightstreamer iOS Client.
curl -O
https://www.lightstreamer.com/repo/cocoapods/ls-ios-client/4.2.1/ls-ios-client-4.2.1.zip
4. Unzip ls-ios-client-4.2.1.zip
unzip ls-ios-client-4.2.1.zip
5. Copy the Lightstreamer_iOS_Client.framework directory into os/ and sim/
cp -r Lightstreamer_iOS_Client.framework os
cp -r Lightstreamer_iOS_Client.framework sim
6. Change directory into os/Lightstreamer_iOS_Client.framework
cd os/Lightstreamer_iOS_Client.framework
7. List all of the architectures included in the Lightstreamer_iOS_Client file.
lipo -info Lightstreamer_iOS_Client
8. Remove all architectures from the Lightstreamer_iOS_Client file, except arm64
lipo -remove i386 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
lipo -remove x86_64 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
lipo -remove armv7 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
9. Change directory into sim/Lightstreamer_iOS_Client.framework
cd ../../sim/Lightstreamer_iOS_Client.framework
10. List all of the architectures included in the Lightstreamer_iOS_Client file.
lipo -info Lightstreamer_iOS_Client
11. Remove all architectures from the Lightstreamer_iOS_Client file, except x86_64
lipo -remove i386 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
lipo -remove armv7 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
lipo -remove arm64 Lightstreamer_iOS_Client -output Lightstreamer_iOS_Client
12. Change directory into work
cd ../../
13. Create the XCFramework.
xcodebuild -create-xcframework -framework os/Lightstreamer_iOS_Client.framework -framework sim/Lightstreamer_iOS_Client.framework -output Lightstreamer_iOS_Client.xcframework
Creating a Swift Package for Lightstreamer_iOS_Client.xcframework
1. Create a directory in which to make the package.
mkdir Lightstreamer_iOS_Client
2. Change into the package directory.
cd Lightstreamer_iOS_Client
3. Initialize the package.
swift package init --type library
4. Remove unneeded files.
rm -rf Sources Tests
5. Copy the Lightstreamer_iOS_Client.xcframework directory to the package directory.
cp -r ../path/to/Lightstreamer_iOS_Client.xcframework .
6. Modify the Package.swift file to add the xcframework.
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Lightstreamer_iOS_Client",
products: [
.library(name: "Lightstreamer_iOS_Client", targets: ["Lightstreamer_iOS_Client"])
],
dependencies: [],
targets: [
.binaryTarget(name: "Lightstreamer_iOS_Client", path: "Lightstreamer_iOS_Client.xcframework")
]
)
At this stage, the package is ready to be hosted in git.