Skip to content

Commit 36fec7e

Browse files
wangzhizhouwangzhizhou
andauthored
Adjust to Swift 6 toolchain compile (#202)
* Migrate to Swift 6 * add the @preconcurrency attribute before func shutdown --------- Co-authored-by: wangzhizhou <[email protected]>
1 parent 3e2af1f commit 36fec7e

11 files changed

+15
-15
lines changed

Sources/APNS/APNSClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public final class APNSClient<Decoder: APNSJSONDecoder, Encoder: APNSJSONEncoder
125125
/// - Parameters:
126126
/// - queue: The queue on which the callback is invoked on.
127127
/// - callback: The callback that is invoked when everything is shutdown.
128-
public func shutdown(queue: DispatchQueue = .global(), callback: @escaping (Error?) -> Void) {
128+
@preconcurrency public func shutdown(queue: DispatchQueue = .global(), callback: @Sendable @escaping (Error?) -> Void) {
129129
self.httpClient.shutdown(callback)
130130
}
131131

Sources/APNS/APNSConfiguration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import APNSCore
16-
import Crypto
16+
@preconcurrency import Crypto
1717
import NIOSSL
1818
import NIOTLS
1919
import AsyncHTTPClient
@@ -22,7 +22,7 @@ import AsyncHTTPClient
2222
public struct APNSClientConfiguration: Sendable {
2323
/// The authentication method used by the ``APNSClient``.
2424
public struct AuthenticationMethod: Sendable {
25-
internal enum Method {
25+
internal enum Method : Sendable{
2626
case jwt(privateKey: P256.Signing.PrivateKey, teamIdentifier: String, keyIdentifier: String)
2727
case tls(privateKey: NIOSSLPrivateKeySource, certificateChain: [NIOSSLCertificateSource])
2828
}

Sources/APNSCore/APNSError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public struct APNSError: Error {
2121
/// The error reason returned by APNs.
2222
///
2323
/// For more information please look here: [Reference]( https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns)
24-
public struct ErrorReason: Hashable {
25-
public enum Reason: RawRepresentable, Hashable {
24+
public struct ErrorReason: Hashable, Sendable {
25+
public enum Reason: RawRepresentable, Hashable, Sendable {
2626
public typealias RawValue = String
2727

2828
case badCollapseIdentifier

Sources/APNSCore/Base64.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ internal enum Base64 {}
8989

9090
extension Base64 {
9191
@usableFromInline
92-
internal struct EncodingOptions: OptionSet {
92+
internal struct EncodingOptions: OptionSet, Sendable {
9393
@usableFromInline
9494
internal let rawValue: UInt
9595

@@ -557,7 +557,7 @@ extension Base64 {
557557

558558
extension Base64 {
559559
@usableFromInline
560-
internal struct DecodingOptions: OptionSet {
560+
internal struct DecodingOptions: OptionSet, Sendable {
561561
@usableFromInline
562562
internal let rawValue: UInt
563563

Sources/APNSCore/LiveActivity/APNSLiveActivityDismissalDate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import struct Foundation.Date
1616

17-
public struct APNSLiveActivityDismissalDate: Hashable {
17+
public struct APNSLiveActivityDismissalDate: Hashable, Sendable {
1818
/// The date at which the live activity will be dismissed
1919
/// This value is a UNIX epoch expressed in seconds (UTC)
2020
@usableFromInline

Sources/APNSCore/LiveActivity/APNSLiveActivityNotification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import struct Foundation.UUID
1717
/// A live activity notification.
1818
///
1919
/// It is **important** that you do not encode anything with the key `aps`.
20-
public struct APNSLiveActivityNotification<ContentState: Encodable>: APNSMessage {
20+
public struct APNSLiveActivityNotification<ContentState: Encodable & Sendable>: APNSMessage {
2121
enum CodingKeys: CodingKey {
2222
case aps
2323
}

Sources/APNSCore/LiveActivity/APNSLiveActivityNotificationAPSStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable>: Encodable {
15+
struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable & Sendable>: Encodable {
1616
enum CodingKeys: String, CodingKey {
1717
case timestamp = "timestamp"
1818
case event = "event"

Sources/APNSCore/LiveActivity/APNSLiveActivityNotificationEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
public struct APNSLiveActivityNotificationEvent: Hashable {
15+
public struct APNSLiveActivityNotificationEvent: Hashable, Sendable {
1616
/// The underlying raw value that is send to APNs.
1717
@usableFromInline
1818
internal let rawValue: String

Sources/APNSCore/LiveActivity/APNSStartLiveActivityNotification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import struct Foundation.UUID
1717
/// A notification that starts a live activity
1818
///
1919
/// It is **important** that you do not encode anything with the key `aps`.
20-
public struct APNSStartLiveActivityNotification<Attributes: Encodable, ContentState: Encodable>:
20+
public struct APNSStartLiveActivityNotification<Attributes: Encodable & Sendable, ContentState: Encodable & Sendable>:
2121
APNSMessage
2222
{
2323
enum CodingKeys: CodingKey {

Sources/APNSCore/LiveActivity/APNSStartLiveActivityNotificationAPSStorage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
struct APNSStartLiveActivityNotificationAPSStorage<Attributes: Encodable, ContentState: Encodable>:
16-
Encodable
15+
struct APNSStartLiveActivityNotificationAPSStorage<Attributes: Encodable & Sendable, ContentState: Encodable & Sendable>:
16+
Encodable & Sendable
1717
{
1818
enum CodingKeys: String, CodingKey {
1919
case timestamp = "timestamp"

Sources/APNSURLSession/APNSURLSessionClientConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import APNSCore
16-
import Crypto
16+
@preconcurrency import Crypto
1717

1818
/// The configuration of an ``APNSURLSessionClient``.
1919
public struct APNSURLSessionClientConfiguration {

0 commit comments

Comments
 (0)