You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
18
+
19
+
---
20
+
21
+
## Documentation
22
+
23
+
See the [documentation](https://docs.knock.app/notification-feeds/bring-your-own-ui) for usage examples.
24
+
25
+
## Installation
26
+
27
+
### Swift Package Manager
28
+
29
+
There are two ways to add this as a dependency using the Swift Package Manager:
30
+
31
+
1. Using Xcode
32
+
2. Manually via `Package.swift`
33
+
34
+
#### Using Xcode
35
+
36
+
1. Open your Xcode project and select `File` -> `Add Packages...`
37
+
38
+
<imgwidth="422"alt="Screenshot 2023-06-27 at 19 41 32"src="https://github.com/knocklabs/knock-swift/assets/952873/31bb67de-5272-445a-a5c4-5df3bcfa3c8b">
39
+
40
+
2. Search for `https://github.com/knocklabs/knock-swift.git` and then click `Add Package`
41
+
*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.*
42
+
43
+
<imgwidth="900"alt="Screenshot 2023-06-27 at 19 42 09"src="https://github.com/knocklabs/knock-swift/assets/952873/d947cc7f-8da6-4814-aa75-3e41ffe72ff4">
44
+
45
+
#### Manually via `Package.swift`
46
+
47
+
If you are managing dependencies using the `Package.swift` file, just add this to you dependencies array:
Version 1.0.0 of our Swift SDK introduces significant improvements and modernizations, including the adoption of Async/Await patterns for more concise and readable asynchronous code. While maintaining backward compatibility with completion handlers for all our APIs, we've also introduced several enhancements to optimize and streamline the SDK's usability.
6
+
7
+
### Key Enhancements:
8
+
9
+
-**Refined Initialization Process**: We've redesigned the initialization process for the Knock instance, dividing it into two distinct phases. This change offers greater flexibility in integrating our SDK into your projects.
10
+
11
+
#### Previous Initialization Approach:
12
+
```swift
13
+
let client =try!Knock(publishableKey: publishableKey, "your-pk":"user-id", hostname: "hostname")
14
+
```
15
+
16
+
#### New in Version 1.0.0:
17
+
```swift
18
+
// Step 1: Early initialization. Ideal place: AppDelegate.
-**KnockAppDelegate for Simplified Notification Management**: The introduction of `KnockAppDelegate` allows for effortless integration of push notification handling and token management, reducing boilerplate code and simplifying implementation.
26
+
27
+
-**Enhanced User Session Management**: New functionalities to sign users out and unregister device tokens have been added, providing more control over user sessions and device management.
28
+
29
+
-**Centralized Access with Shared Instance**: The SDK now utilizes a shared instance for the Knock client, facilitating easier access and interaction within your app's codebase.
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.
18
+
19
+
---
23
20
24
-
You can include the SDK in a couple of ways:
21
+
## Documentation
25
22
26
-
1. Swift Package Manager
27
-
2. Carthage
28
-
3. Cocoapods
29
-
4. Manually
23
+
See the [documentation](https://docs.knock.app/sdks/ios/overview) for full documentation.
24
+
25
+
## Migrations
26
+
27
+
See the [Migration Guide](https://github.com/knocklabs/knock-swift/blob/main/MIGRATIONS.md) if upgrading from a previous version.
28
+
29
+
## Example App
30
+
31
+
See the [iOS Example App](https://github.com/knocklabs/ios-example-app) for more examples.
32
+
33
+
## Installation
30
34
31
35
### Swift Package Manager
32
36
@@ -42,59 +46,20 @@ There are two ways to add this as a dependency using the Swift Package Manager:
42
46
<imgwidth="422"alt="Screenshot 2023-06-27 at 19 41 32"src="https://github.com/knocklabs/knock-swift/assets/952873/31bb67de-5272-445a-a5c4-5df3bcfa3c8b">
43
47
44
48
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.*
45
50
46
51
<imgwidth="900"alt="Screenshot 2023-06-27 at 19 42 09"src="https://github.com/knocklabs/knock-swift/assets/952873/d947cc7f-8da6-4814-aa75-3e41ffe72ff4">
47
52
48
-
3. Ensure that the Package is selected and click `Add Package`
49
-
50
-
<imgwidth="900"alt="Screenshot 2023-06-27 at 19 42 23"src="https://github.com/knocklabs/knock-swift/assets/952873/c6053b06-73dc-43c8-8a68-40fbc2298f7c">
51
-
52
-
4. Wait for Xcode to fetch the dependencies and you should see the SDK on your Package Dependencies on the sidebar
53
-
54
-
<imgwidth="505"alt="Screenshot 2023-06-27 at 19 42 45"src="https://github.com/knocklabs/knock-swift/assets/952873/9f314c9d-2525-4357-8da0-6ce4508b6db0">
55
-
56
53
#### Manually via `Package.swift`
57
54
58
55
If you are managing dependencies using the `Package.swift` file, just add this to you dependencies array:
2. Run `carthage update`. This will fetch dependencies into a Carthage/Checkouts folder, then build each one or download a pre-compiled framework.
75
-
3. Open your application targets’ General settings tab. For Xcode 11.0 and higher, in the "Frameworks, Libraries, and Embedded Content" section, drag and drop each framework you want to use from the Carthage/Build folder on disk. Then, in the "Embed" section, select "Do Not Embed" from the pulldown menu for each item added. For Xcode 10.x and lower, in the "Linked Frameworks and Libraries" section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
76
-
4. On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
77
-
```
78
-
/usr/local/bin/carthage copy-frameworks
79
-
```
80
-
5. Create a file named `input.xcfilelist` and a file named output.xcfilelist
81
-
6. Add the paths to the frameworks you want to use to your input.xcfilelist. For example:
82
-
```
83
-
$(SRCROOT)/Carthage/Build/iOS/Knock.framework
84
-
```
85
-
7. Add the paths to the copied frameworks to the `output.xcfilelist`. For example:
8. Add the `input.xcfilelist` to the "Input File Lists" section of the Carthage run script phase
90
-
9. Add the `output.xcfilelist` to the "Output File Lists" section of the Carthage run script phase
91
-
92
-
This script works around an [App Store submission bug](http://www.openradar.me/radar?id=6409498411401216) triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.
93
-
94
-
With the debug information copied into the built products directory, Xcode will be able to symbolicate the stack trace whenever you stop at a breakpoint. This will also enable you to step through third-party code in the debugger.
95
-
96
-
When archiving your application for submission to the App Store or TestFlight, Xcode will also copy these files into the dSYMs subdirectory of your application’s .xcarchive bundle.
97
-
98
63
### Cocoapods
99
64
100
65
Add the dependency to your `Podfile`:
@@ -108,6 +73,14 @@ target 'MyApp' do
108
73
end
109
74
```
110
75
76
+
### Carthage
77
+
78
+
1. Add this line to your Cartfile:
79
+
80
+
```
81
+
github "knocklabs/knock-swift" ~> 0.2.0
82
+
```
83
+
111
84
### Manually
112
85
113
86
As a last option, you could manually copy the files inside the `Sources` folder to your project.
@@ -119,47 +92,24 @@ You can now start using the SDK:
The functions of the sdk are encapsulated and managed in a client object. You first have to instantiate a client with your public key and a user id. If you are running on production with enhanced security turned on (recommended) you have to also pass the signed user token to the client constructor.
0 commit comments