Skip to content

Commit 0e2db46

Browse files
authored
fix: swift build and add github action (#17)
* fix: swift build and add github action * chore: attempt to fix * chore: try again * fix: try different approach * chore: update package name * chore: fix build * chore: fix tests * chore: fix failing test
1 parent 782b4bd commit 0e2db46

File tree

15 files changed

+98
-848
lines changed

15 files changed

+98
-848
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
build-and-test:
11+
name: Build and Test
12+
runs-on: macos-14
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Select Xcode version
19+
run: sudo xcode-select -switch /Applications/Xcode_15.2.app
20+
21+
- name: Show versions
22+
run: |
23+
xcodebuild -version
24+
swift --version
25+
26+
- name: Resolve dependencies
27+
run: swift package resolve
28+
29+
- name: Build for iOS Simulator
30+
run: |
31+
xcodebuild build-for-testing \
32+
-scheme Knock \
33+
-sdk iphonesimulator \
34+
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' \
35+
CODE_SIGN_IDENTITY="" \
36+
CODE_SIGNING_REQUIRED=NO \
37+
ONLY_ACTIVE_ARCH=NO
38+
39+
- name: Run tests
40+
run: |
41+
xcodebuild test-without-building \
42+
-scheme Knock \
43+
-sdk iphonesimulator \
44+
-destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' \
45+
-enableCodeCoverage YES

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ DerivedData/
66
.swiftpm/config/registries.json
77
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
88
.netrc
9-
LocalHelp.md
9+
LocalHelp.md
10+
*.xcodeproj

Knock.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "Knock"
3-
spec.version = "1.2.5"
3+
spec.version = "1.2.6"
44
spec.summary = "An SDK to build in-app notifications experiences in Swift with Knock."
55

66
spec.description = <<-DESC

Knock.xcodeproj/project.pbxproj

Lines changed: 0 additions & 583 deletions
This file was deleted.

Knock.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

Knock.xcodeproj/xcshareddata/xcbaselines/F16684DF2A413E2B0037A2E9.xcbaseline/18EDA537-0560-4A88-955C-F7523FEB569E.plist

Lines changed: 0 additions & 22 deletions
This file was deleted.

Knock.xcodeproj/xcshareddata/xcbaselines/F16684DF2A413E2B0037A2E9.xcbaseline/Info.plist

Lines changed: 0 additions & 40 deletions
This file was deleted.

Knock.xcodeproj/xcshareddata/xcschemes/Knock 1.xcscheme

Lines changed: 0 additions & 66 deletions
This file was deleted.

Knock.xcodeproj/xcshareddata/xcschemes/Knock.xcscheme

Lines changed: 0 additions & 79 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Official Knock iOS SDK
32

43
[![GitHub Release](https://img.shields.io/github/v/release/knocklabs/knock-swift?style=flat)](https://github.com/knocklabs/knock-swift/releases/latest)
@@ -10,8 +9,6 @@
109
![min ios version is 16](https://img.shields.io/badge/min%20iOS%20version-16-blue)
1110
[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/knocklabs/ios-example-app/blob/main/LICENSE)
1211

13-
14-
1512
---
1613

1714
Knock is a flexible, reliable notifications infrastructure that's built to scale with you. Use our iOS SDK to engage users with in-app feeds, setup push notifications, and manage notification preferences.
@@ -34,7 +31,7 @@ See the [iOS Example App](https://github.com/knocklabs/ios-example-app) for more
3431

3532
### Swift Package Manager
3633

37-
There are two ways to add this as a dependency using the Swift Package Manager:
34+
There are two ways to add this as a dependency using the Swift Package Manager:
3835

3936
1. Using Xcode
4037
2. Manually via `Package.swift`
@@ -46,17 +43,17 @@ There are two ways to add this as a dependency using the Swift Package Manager:
4643
<img width="422" alt="Screenshot 2023-06-27 at 19 41 32" src="https://github.com/knocklabs/knock-swift/assets/952873/31bb67de-5272-445a-a5c4-5df3bcfa3c8b">
4744

4845
2. Search for `https://github.com/knocklabs/knock-swift.git` and then click `Add Package`
49-
*Note: We recommend that you set the Dependency Rule to Up to Next Major Version. While we encourage you to keep your app up to date with the latest SDK, major versions can include breaking changes or new features that require your attention.*
46+
_Note: We recommend that you set the Dependency Rule to Up to Next Major Version. While we encourage you to keep your app up to date with the latest SDK, major versions can include breaking changes or new features that require your attention._
5047

5148
<img width="900" alt="Screenshot 2023-06-27 at 19 42 09" src="https://github.com/knocklabs/knock-swift/assets/952873/d947cc7f-8da6-4814-aa75-3e41ffe72ff4">
5249

5350
#### Manually via `Package.swift`
5451

5552
If you are managing dependencies using the `Package.swift` file, just add this to you dependencies array:
5653

57-
``` swift
54+
```swift
5855
dependencies: [
59-
.package(url: "https://github.com/knocklabs/knock-swift.git", .upToNextMajor(from: "1.2.5"))
56+
.package(url: "https://github.com/knocklabs/knock-swift.git", .upToNextMajor(from: "1.2.6"))
6057
]
6158
```
6259

@@ -69,7 +66,7 @@ platform :ios, '16.0'
6966
use_frameworks!
7067
7168
target 'MyApp' do
72-
pod 'Knock', '~> 1.2.5'
69+
pod 'Knock', '~> 1.2.6'
7370
end
7471
```
7572

@@ -89,12 +86,12 @@ As a last option, you could manually copy the files inside the `Sources` folder
8986

9087
You can now start using the SDK:
9188

92-
``` swift
89+
```swift
9390
import Knock
9491

95-
/*
96-
Setup the shared Knock instance as soon as you can.
97-
Note: pushChannelId is required if you want to use our KnockAppDelegate helper.
92+
/*
93+
Setup the shared Knock instance as soon as you can.
94+
Note: pushChannelId is required if you want to use our KnockAppDelegate helper.
9895
Otherwise, this field is optional.
9996
*/
10097
try? Knock.shared.setup(publishableKey: "your-pk", pushChannelId: "apns-push-channel-id")

0 commit comments

Comments
 (0)