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
Copy file name to clipboardExpand all lines: README.md
+34-34Lines changed: 34 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,33 +19,33 @@ dependencies: [
19
19
## Getting Started
20
20
21
21
```swift
22
-
let signer =try!APNSSigner(filePath: "/Users/kylebrowning/Downloads/AuthKey_9UC9ZLQ8YW.p8")
22
+
let signer =try!APNSwiftSigner(filePath: "/Users/kylebrowning/Downloads/AuthKey_9UC9ZLQ8YW.p8")
23
23
24
-
let apnsConfig =APNSConfiguration(keyIdentifier: "9UC9ZLQ8YW",
24
+
let apnsConfig =APNSwiftConfiguration(keyIdentifier: "9UC9ZLQ8YW",
25
25
teamIdentifier: "ABBM6U9RM5",
26
26
signer: signer,
27
27
topic: "com.grasscove.Fern",
28
28
environment: .sandbox)
29
29
30
-
let apns =tryAPNSConnection.connect(configuration: apnsConfig, on: group.next()).wait()
30
+
let apns =tryAPNSwiftConnection.connect(configuration: apnsConfig, on: group.next()).wait()
31
31
let alert =Alert(title: "Hey There", subtitle: "Full moon sighting", body: "There was a full moon last night did you see it")
32
-
let aps =APSPayload(alert: alert, badge: 1, sound: .normal("cow.wav"))
33
-
let notification =APNSNotification(aps: aps)
32
+
let aps =APNSwiftPayload(alert: alert, badge: 1, sound: .normal("cow.wav"))
33
+
let notification =APNSwiftNotification(aps: aps)
34
34
let res =try apns.send(notification, to: "de1d666223de85db0186f654852cc960551125ee841ca044fdf5ef6a4756a77e").wait()
35
35
try apns.close().wait()
36
36
try group.syncShutdownGracefully()
37
37
```
38
38
39
39
40
-
### APNSConfiguration
40
+
### APNSwiftConfiguration
41
41
42
-
[`APNSConfiguration`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/NIOAPNS/APNSConfiguration.swift) is a structure that provides the system with common configuration.
42
+
[`APNSwiftConfiguration`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/APNSwift/APNSwiftConfiguration.swift) is a structure that provides the system with common configuration.
43
43
44
44
```swift
45
-
publicstructAPNSConfiguration {
45
+
publicstructAPNSwiftConfiguration {
46
46
publicvar keyIdentifier: String
47
47
publicvar teamIdentifier: String
48
-
publicvar signer: APNSSigner
48
+
publicvar signer: APNSwiftSigner
49
49
publicvar topic: String
50
50
publicvar environment: Environment
51
51
publicvar tlsConfiguration: TLSConfiguration
@@ -59,10 +59,10 @@ public struct APNSConfiguration {
59
59
}
60
60
}
61
61
```
62
-
#### Example `APNSConfiguration`
62
+
#### Example `APNSwiftConfiguration`
63
63
```swift
64
64
let signer =...
65
-
let apnsConfig =tryAPNSConfiguration(keyIdentifier: "9UC9ZLQ8YW",
65
+
let apnsConfig =tryAPNSwiftConfiguration(keyIdentifier: "9UC9ZLQ8YW",
66
66
teamIdentifier: "ABBM6U9RM5",
67
67
signer: signer),
68
68
topic:"com.grasscove.Fern",
@@ -71,50 +71,50 @@ let apnsConfig = try APNSConfiguration(keyIdentifier: "9UC9ZLQ8YW",
71
71
72
72
### Signer
73
73
74
-
[`APNSSigner`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/NIOAPNS/APNSSigner.swift) provides a structure to sign the payloads with. This should be loaded into memory at the configuration level. It requires the data to be in a ByteBuffer format.
74
+
[`APNSwiftSigner`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/APNSwift/APNSwiftSigner.swift) provides a structure to sign the payloads with. This should be loaded into memory at the configuration level. It requires the data to be in a ByteBuffer format.
75
75
76
76
```swift
77
77
let url =URL(fileURLWithPath: "/Users/kylebrowning/Downloads/AuthKey_9UC9ZLQ8YW.p8")
var byteBuffer =ByteBufferAllocator().buffer(capacity: data.count)
85
85
byteBuffer.writeBytes(data)
86
-
let signer =try!APNSSigner.init(buffer: byteBuffer)
86
+
let signer =try!APNSwiftSigner.init(buffer: byteBuffer)
87
87
```
88
-
### APNSConnection
88
+
### APNSwiftConnection
89
89
90
-
[`APNSConnection`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/NIOAPNS/APNSConnection.swift) is a class with methods thats provides a wrapper to NIO's ClientBootstrap. The `swift-nio-http2` dependency is utilized here. It also provides a function to send a notification to a specific device token string.
90
+
[`APNSwiftConnection`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/APNSwift/APNSwiftConnection.swift) is a class with methods thats provides a wrapper to NIO's ClientBootstrap. The `swift-nio-http2` dependency is utilized here. It also provides a function to send a notification to a specific device token string.
91
91
92
92
93
-
#### Example `APNSConnection`
93
+
#### Example `APNSwiftConnection`
94
94
```swift
95
95
let apnsConfig =...
96
-
let apns =tryAPNSConnection.connect(configuration: apnsConfig, on: group.next()).wait()
96
+
let apns =tryAPNSwiftConnection.connect(configuration: apnsConfig, on: group.next()).wait()
97
97
```
98
98
99
99
### Alert
100
100
101
-
[`Alert`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/NIOAPNS/APNSRequest.swift) is the actual meta data of the push notification alert someone wishes to send. More details on the specifics of each property are provided [here](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html). They follow a 1-1 naming scheme listed in Apple's documentation
101
+
[`Alert`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/APNSwift/APNSRequest.swift) is the actual meta data of the push notification alert someone wishes to send. More details on the specifics of each property are provided [here](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html). They follow a 1-1 naming scheme listed in Apple's documentation
102
102
103
103
104
104
#### Example `Alert`
105
105
```swift
106
106
let alert =Alert(title: "Hey There", subtitle: "Full moon sighting", body: "There was a full moon last night did you see it")
107
107
```
108
108
109
-
### APSPayload
109
+
### APNSwiftPayload
110
110
111
-
[`APSPayload`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/NIOAPNS/APNSRequest.swift) is the meta data of the push notification. Things like the alert, badge count. More details on the specifics of each property are provided [here](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html). They follow a 1-1 naming scheme listed in Apple's documentation
111
+
[`APNSwiftPayload`](https://github.com/kylebrowning/swift-nio-http2-apns/blob/master/Sources/APNSwift/APNSRequest.swift) is the meta data of the push notification. Things like the alert, badge count. More details on the specifics of each property are provided [here](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html). They follow a 1-1 naming scheme listed in Apple's documentation
112
112
113
113
114
-
#### Example `APSPayload`
114
+
#### Example `APNSwiftPayload`
115
115
```swift
116
116
let alert =...
117
-
let aps =APSPayload(alert: alert, badge: 1, sound: .normal("cow.wav"))
117
+
let aps =APNSwiftPayload(alert: alert, badge: 1, sound: .normal("cow.wav"))
Apple provides engineers with the ability to add custom payload data to each notification. In order to facilitate this we have the `APNSNotification`.
152
+
Apple provides engineers with the ability to add custom payload data to each notification. In order to facilitate this we have the `APNSwiftNotification`.
153
153
154
154
#### Example
155
155
```swift
156
-
struct AcmeNotification:APNSNotification {
156
+
struct AcmeNotification:APNSwiftNotification {
157
157
let acme2: [String]
158
-
let aps: APSPayload
158
+
let aps: APNSwiftPayload
159
159
160
-
init(acme2: [String], aps: APSPayload) {
160
+
init(acme2: [String], aps: APNSwiftPayload) {
161
161
self.acme2= acme2
162
162
self.aps= aps
163
163
}
164
164
}
165
165
166
-
let apns:APNSConnection:=...
167
-
let aps:APSPayload=...
166
+
let apns:APNSwiftConnection:=...
167
+
let aps:APNSwiftPayload=...
168
168
let notification =AcmeNotification(acme2: ["bang", "whiz"], aps: aps)
169
169
let res =try apns.send(notification, to: "de1d666223de85db0186f654852cc960551125ee841ca044fdf5ef6a4756a77e").wait()
0 commit comments