Skip to content

Commit b435c73

Browse files
ladvochiroshihorie
andauthored
CocoaPods fix (#589)
**Summary of changes:** - Fix Cocoapods: create [private spec repo](https://github.com/livekit/podspecs) for dependencies which no longer support Cocoapods. - Update documentation: instructions for adding LiveKit source. - Create workflows to lint podspec and automatically push to trunk on new release. Note: `COCOAPODS_TRUNK_TOKEN` must be set in the repository’s secrets before using the push workflow. --------- Co-authored-by: Hiroshi Horie <[email protected]>
1 parent 0dd5a09 commit b435c73

8 files changed

+138
-28
lines changed

.github/workflows/cocoapods-lint.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CocoaPods Lint
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
jobs:
12+
lint:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- os: macos-13
18+
xcode: 14.2
19+
- os: macos-14
20+
xcode: 15.4
21+
- os: macos-15
22+
xcode: 16.2
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 30
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
- name: Setup CocoaPods
29+
uses: maxim-lobanov/setup-cocoapods@v1
30+
with:
31+
version: latest
32+
- name: Setup Xcode
33+
uses: maxim-lobanov/setup-xcode@v1
34+
with:
35+
xcode-version: ${{ matrix.xcode }}
36+
- name: Library Lint
37+
id: lib-lint
38+
run: |
39+
validation_dir=$(mktemp -d)
40+
echo "validation_dir=${validation_dir}" >> $GITHUB_OUTPUT
41+
pod lib lint \
42+
--validation-dir="${validation_dir}" \
43+
--no-clean \
44+
--allow-warnings \
45+
--verbose \
46+
--sources=https://github.com/livekit/podspecs.git/,https://cdn.cocoapods.org/
47+
- name: Upload Validation Directory (Failure Only)
48+
if: failure()
49+
uses: actions/upload-artifact@v4
50+
with:
51+
path: ${{ steps.lib-lint.outputs.validation_dir }}
52+
name: validation-xcode${{ matrix.xcode }}

.github/workflows/cocoapods-push.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CocoaPods Push
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
dry_run:
6+
description: Dry run (only lint spec, don't push)
7+
default: true
8+
type: boolean
9+
release:
10+
types: [published]
11+
env:
12+
PODSPEC_FILE: LiveKitClient.podspec
13+
jobs:
14+
push:
15+
runs-on: macos-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Setup CocoaPods
20+
uses: maxim-lobanov/setup-cocoapods@v1
21+
with:
22+
version: latest
23+
- name: Setup Xcode
24+
uses: maxim-lobanov/setup-xcode@v1
25+
with:
26+
xcode-version: latest-stable
27+
- name: Spec Lint
28+
id: spec-lint
29+
run: |
30+
validation_dir=$(mktemp -d)
31+
echo "validation_dir=${validation_dir}" >> $GITHUB_OUTPUT
32+
pod spec lint \
33+
--validation-dir="${validation_dir}" \
34+
--no-clean \
35+
--allow-warnings \
36+
--verbose \
37+
--sources=https://github.com/livekit/podspecs.git/,https://cdn.cocoapods.org/
38+
- name: Upload Validation Directory (Failure Only)
39+
if: failure()
40+
uses: actions/upload-artifact@v4
41+
with:
42+
path: ${{ steps.spec-lint.outputs.validation_dir }}
43+
name: validation
44+
- name: Push to CocoaPods
45+
if: ${{ inputs.dry_run != true && success() }}
46+
run: pod trunk push ${{ env.PODSPEC_FILE }} --allow-warnings --verbose
47+
env:
48+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

.github/workflows/cocoapods.yaml

-20
This file was deleted.

Docs/cocoapods.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# CocoaPods Installation
2+
3+
To install LiveKit using CocoaPods, add the LiveKit podspec source to your
4+
Podfile in addition to adding the pod:
5+
6+
```ruby
7+
source "https://cdn.cocoapods.org/"
8+
source "https://github.com/livekit/podspecs.git" # <-
9+
10+
platform :ios, "18.0"
11+
12+
target "YourApp" do
13+
pod "LiveKitClient", "~> 2.2.0"
14+
15+
# Other dependencies...
16+
end
17+
```
18+
19+
The LiveKit source is necessary as some of this library's dependencies
20+
no longer officially support Cocoapods; the LiveKit source defines
21+
podspecs for such dependencies.
22+
23+
## Platform support
24+
25+
Currently, only iOS and macOS are supported through Cocoapods. To use
26+
LiveKit in a tvOS or visionOS app, please install using SPM.

LiveKitClient.podspec

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@ Pod::Spec.new do |spec|
88

99
spec.ios.deployment_target = "13.0"
1010
spec.osx.deployment_target = "10.15"
11-
spec.tvos.deployment_target = "17.0"
12-
spec.visionos.deployment_target = "1.0"
1311

1412
spec.swift_versions = ["5.7"]
15-
spec.source = {:git => "https://github.com/livekit/client-sdk-swift.git", :tag => "2.2.1"}
13+
spec.source = {:git => "https://github.com/livekit/client-sdk-swift.git", :tag => spec.version.to_s}
1614

1715
spec.source_files = "Sources/**/*"
1816

1917
spec.dependency("LiveKitWebRTC", "= 125.6422.22")
2018
spec.dependency("SwiftProtobuf")
21-
spec.dependency("Logging")
19+
spec.dependency("Logging", "= 1.5.4")
2220
spec.dependency("DequeModule", "= 1.1.4")
2321

2422
spec.resource_bundles = {"Privacy" => ["Sources/LiveKit/PrivacyInfo.xcprivacy"]}
2523

26-
# Add the following lines to enable the experimental feature
24+
xcode_output = `xcodebuild -version`.strip
25+
major_version = xcode_output =~ /Xcode\s+(\d+)/ ? $1.to_i : 15
26+
2727
spec.pod_target_xcconfig = {
28-
'OTHER_SWIFT_FLAGS' => '-enable-experimental-feature AccessLevelOnImport'
28+
"OTHER_SWIFT_FLAGS" => major_version >=15 ?
29+
"-enable-experimental-feature AccessLevelOnImport" : ""
2930
}
3031
end

[email protected]

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let package = Package(
2222
// LK-Prefixed Dynamic WebRTC XCFramework
2323
.package(url: "https://github.com/livekit/webrtc-xcframework.git", exact: "125.6422.22"),
2424
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.26.0"),
25-
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.4"),
25+
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.2"), // 1.6.x requires Swift >=5.8
2626
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
2727
// Only used for DocC generation
2828
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.3.0"),

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Go to Project Settings -> Swift Packages.
5858

5959
Add a new package and enter: `https://github.com/livekit/client-sdk-swift`
6060

61+
### CocoaPods
62+
63+
For installation using CocoaPods, please refer to this [guide](./Docs/cocoapods.md).
64+
6165
## iOS Usage
6266

6367
LiveKit provides an UIKit based `VideoView` class that renders video tracks. Subscribed audio tracks are automatically played.

scripts/replace_version.sh

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ replace() {
1919
# -----------------------------------------
2020
replace ./LiveKitClient.podspec <<EOF
2121
,s/spec.version = "[^"]*"/spec.version = "${VERSION}"/g
22-
,s/:tag => "[^"]*"/:tag => "${VERSION}"/g
2322
w
2423
q
2524
EOF

0 commit comments

Comments
 (0)