Skip to content

Commit

Permalink
Adjust to Swift 6 toolchain compile (#202)
Browse files Browse the repository at this point in the history
* Migrate to Swift 6

* add the @preconcurrency attribute before func shutdown

---------

Co-authored-by: wangzhizhou <[email protected]>
  • Loading branch information
wangzhizhou and wangzhizhou authored Jul 18, 2024
1 parent 3e2af1f commit 36fec7e
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Sources/APNS/APNSClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public final class APNSClient<Decoder: APNSJSONDecoder, Encoder: APNSJSONEncoder
/// - Parameters:
/// - queue: The queue on which the callback is invoked on.
/// - callback: The callback that is invoked when everything is shutdown.
public func shutdown(queue: DispatchQueue = .global(), callback: @escaping (Error?) -> Void) {
@preconcurrency public func shutdown(queue: DispatchQueue = .global(), callback: @Sendable @escaping (Error?) -> Void) {
self.httpClient.shutdown(callback)
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/APNS/APNSConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import APNSCore
import Crypto
@preconcurrency import Crypto
import NIOSSL
import NIOTLS
import AsyncHTTPClient
Expand All @@ -22,7 +22,7 @@ import AsyncHTTPClient
public struct APNSClientConfiguration: Sendable {
/// The authentication method used by the ``APNSClient``.
public struct AuthenticationMethod: Sendable {
internal enum Method {
internal enum Method : Sendable{
case jwt(privateKey: P256.Signing.PrivateKey, teamIdentifier: String, keyIdentifier: String)
case tls(privateKey: NIOSSLPrivateKeySource, certificateChain: [NIOSSLCertificateSource])
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/APNSCore/APNSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public struct APNSError: Error {
/// The error reason returned by APNs.
///
/// For more information please look here: [Reference]( https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns)
public struct ErrorReason: Hashable {
public enum Reason: RawRepresentable, Hashable {
public struct ErrorReason: Hashable, Sendable {
public enum Reason: RawRepresentable, Hashable, Sendable {
public typealias RawValue = String

case badCollapseIdentifier
Expand Down
4 changes: 2 additions & 2 deletions Sources/APNSCore/Base64.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal enum Base64 {}

extension Base64 {
@usableFromInline
internal struct EncodingOptions: OptionSet {
internal struct EncodingOptions: OptionSet, Sendable {
@usableFromInline
internal let rawValue: UInt

Expand Down Expand Up @@ -557,7 +557,7 @@ extension Base64 {

extension Base64 {
@usableFromInline
internal struct DecodingOptions: OptionSet {
internal struct DecodingOptions: OptionSet, Sendable {
@usableFromInline
internal let rawValue: UInt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import struct Foundation.Date

public struct APNSLiveActivityDismissalDate: Hashable {
public struct APNSLiveActivityDismissalDate: Hashable, Sendable {
/// The date at which the live activity will be dismissed
/// This value is a UNIX epoch expressed in seconds (UTC)
@usableFromInline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import struct Foundation.UUID
/// A live activity notification.
///
/// It is **important** that you do not encode anything with the key `aps`.
public struct APNSLiveActivityNotification<ContentState: Encodable>: APNSMessage {
public struct APNSLiveActivityNotification<ContentState: Encodable & Sendable>: APNSMessage {
enum CodingKeys: CodingKey {
case aps
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable>: Encodable {
struct APNSLiveActivityNotificationAPSStorage<ContentState: Encodable & Sendable>: Encodable {
enum CodingKeys: String, CodingKey {
case timestamp = "timestamp"
case event = "event"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

public struct APNSLiveActivityNotificationEvent: Hashable {
public struct APNSLiveActivityNotificationEvent: Hashable, Sendable {
/// The underlying raw value that is send to APNs.
@usableFromInline
internal let rawValue: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import struct Foundation.UUID
/// A notification that starts a live activity
///
/// It is **important** that you do not encode anything with the key `aps`.
public struct APNSStartLiveActivityNotification<Attributes: Encodable, ContentState: Encodable>:
public struct APNSStartLiveActivityNotification<Attributes: Encodable & Sendable, ContentState: Encodable & Sendable>:
APNSMessage
{
enum CodingKeys: CodingKey {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//

struct APNSStartLiveActivityNotificationAPSStorage<Attributes: Encodable, ContentState: Encodable>:
Encodable
struct APNSStartLiveActivityNotificationAPSStorage<Attributes: Encodable & Sendable, ContentState: Encodable & Sendable>:
Encodable & Sendable
{
enum CodingKeys: String, CodingKey {
case timestamp = "timestamp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//

import APNSCore
import Crypto
@preconcurrency import Crypto

/// The configuration of an ``APNSURLSessionClient``.
public struct APNSURLSessionClientConfiguration {
Expand Down

0 comments on commit 36fec7e

Please sign in to comment.