Skip to content

Commit d4f3d78

Browse files
fix(ios): Simplify SPM usage for native library (#13)
1 parent 1ab8823 commit d4f3d78

File tree

3 files changed

+56
-25
lines changed

3 files changed

+56
-25
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Prepare Example app'
2+
description: 'Does necessary pre-work for the example app to compile natively'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: 'Build plugin'
8+
working-directory: ./packages/capacitor-plugin
9+
shell: bash
10+
run: npm run build
11+
- name: 'Install example app dependencies'
12+
working-directory: ./packages/example-app-capacitor
13+
shell: bash
14+
run: npm i
15+
- name: 'Build Web example app'
16+
working-directory: ./packages/example-app-capacitor
17+
shell: bash
18+
run: npm run build
19+
- name: 'Sync example app native platforms'
20+
working-directory: ./packages/example-app-capacitor
21+
shell: bash
22+
run: npx cap sync

.github/workflows/continuous_integration.yml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,54 @@ jobs:
1616
needs: 'setup'
1717
uses: ./.github/workflows/reusable_build.yml
1818

19-
verify-plugin:
19+
verify-plugin-android:
2020
needs: ['setup', 'lint', 'build']
21-
runs-on: 'macos-14'
21+
runs-on: 'macos-15'
2222
timeout-minutes: 30
2323
steps:
2424
- uses: actions/checkout@v4
2525
- name: 'Setup Tools'
2626
uses: ./.github/actions/setup-tools
27-
- name: 'Verify iOS + Android + Web'
27+
- name: 'Verify Android'
2828
working-directory: ./packages/capacitor-plugin
29-
run: npm run verify
29+
run: npm run verify:android
3030

31-
build-example-app:
32-
needs: ['verify-plugin']
33-
runs-on: 'macos-14'
31+
verify-plugin-ios:
32+
needs: ['setup', 'lint', 'build']
33+
runs-on: 'macos-15'
3434
timeout-minutes: 30
3535
steps:
3636
- uses: actions/checkout@v4
3737
- name: 'Setup Tools'
3838
uses: ./.github/actions/setup-tools
39-
- name: 'Build plugin'
39+
- name: 'Verify iOS'
4040
working-directory: ./packages/capacitor-plugin
41-
run: npm run build
42-
- name: 'Install example app dependencies'
43-
working-directory: ./packages/example-app-capacitor
44-
run: npm i
45-
- name: 'Build Web example app'
46-
working-directory: ./packages/example-app-capacitor
47-
run: npm run build
48-
- name: 'Sync example app native platforms'
49-
working-directory: ./packages/example-app-capacitor
50-
run: npx cap sync
41+
run: npm run verify:ios
42+
43+
build-example-app-android:
44+
needs: ['verify-plugin-ios', 'verify-plugin-android']
45+
runs-on: 'macos-15'
46+
timeout-minutes: 30
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: 'Setup Tools'
50+
uses: ./.github/actions/setup-tools
51+
- name: 'Prepare example app'
52+
uses: ./.github/actions/prepare-example-app
5153
- name: 'Build Android example app'
5254
working-directory: ./packages/example-app-capacitor/android
5355
run: ./gradlew clean assembleDebug
56+
57+
build-example-app-ios:
58+
needs: ['verify-plugin-ios', 'verify-plugin-android']
59+
runs-on: 'macos-15'
60+
timeout-minutes: 30
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: 'Setup Tools'
64+
uses: ./.github/actions/setup-tools
65+
- name: 'Prepare example app'
66+
uses: ./.github/actions/prepare-example-app
5467
- name: 'Build iOS example app'
5568
working-directory: ./packages/example-app-capacitor/ios/App
5669
run: xcodebuild clean build -workspace App.xcworkspace -scheme App CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

packages/capacitor-plugin/Package.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ let package = Package(
1010
targets: ["FileViewerPlugin"])
1111
],
1212
dependencies: [
13-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
13+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
14+
.package(url: "https://github.com/ionic-team/ion-ios-fileviewer.git", from: "1.0.1")
1415
],
1516
targets: [
16-
.binaryTarget(
17-
name: "IONFileViewerLib",
18-
url: "https://github.com/ionic-team/ion-ios-fileviewer/releases/download/1.0.1/IONFileViewerLib.zip",
19-
checksum: "2dcd0291e664ffbb5636119f147eda266e0d2284aa53a9c99925d0e442a0e92d" // sha-256
20-
),
2117
.target(
2218
name: "FileViewerPlugin",
2319
dependencies: [
2420
.product(name: "Capacitor", package: "capacitor-swift-pm"),
2521
.product(name: "Cordova", package: "capacitor-swift-pm"),
26-
"IONFileViewerLib"
22+
.product(name: "IONFileViewerLib", package: "ion-ios-fileviewer")
2723
],
2824
path: "ios/Sources/FileViewerPlugin"),
2925
.testTarget(

0 commit comments

Comments
 (0)