Skip to content

Commit 2bd65f9

Browse files
Use FoundationEssentials if available (#237)
Co-authored-by: Kyle Browning <kylebrowning@me.com>
1 parent dc4708b commit 2bd65f9

21 files changed

+88
-0
lines changed

Sources/APNS/APNSBroadcastClient.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414

1515
import APNSCore
1616
import AsyncHTTPClient
17+
#if canImport(FoundationEssentials)
18+
import struct FoundationEssentials.Date
19+
import struct FoundationEssentials.UUID
20+
#else
1721
import struct Foundation.Date
1822
import struct Foundation.UUID
23+
#endif
1924
import NIOConcurrencyHelpers
2025
import NIOCore
2126
import NIOHTTP1

Sources/APNS/APNSClient.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414

1515
import APNSCore
1616
import AsyncHTTPClient
17+
#if canImport(FoundationEssentials)
18+
import struct FoundationEssentials.Date
19+
import struct FoundationEssentials.UUID
20+
#else
1721
import struct Foundation.Date
1822
import struct Foundation.UUID
23+
#endif
1924
import NIOConcurrencyHelpers
2025
import NIOCore
2126
import NIOHTTP1

Sources/APNS/Coding/APNSJSONDecoder.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import NIOCore
1721
import NIOFoundationCompat
1822

Sources/APNS/Coding/APNSJSONEncoder.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import FoundationEssentials
17+
#else
1518
import Foundation
19+
#endif
1620
import NIOCore
1721
import NIOFoundationCompat
1822

Sources/APNSCore/APNSError.swift

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

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.Date
17+
import struct FoundationEssentials.UUID
18+
#else
1519
import struct Foundation.Date
1620
import struct Foundation.UUID
21+
#endif
1722

1823
/// An error returned by APNs.
1924
public struct APNSError: Error {

Sources/APNSCore/APNSRequest.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.UUID
17+
#else
1518
import struct Foundation.UUID
19+
#endif
1620

1721
public struct APNSRequest<Message: APNSMessage> {
1822
fileprivate final class _Storage {

Sources/APNSCore/APNSResponse.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.UUID
17+
#else
1518
import struct Foundation.UUID
19+
#endif
1620

1721
/// The response of a successful APNs request.
1822
public struct APNSResponse: Hashable, Sendable {

Sources/APNSCore/Alert/APNSAlertNotification.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.UUID
17+
#else
1518
import struct Foundation.UUID
19+
#endif
1620

1721
/// An alert notification.
1822
///

Sources/APNSCore/Background/APNSBackgroundNotification.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.UUID
17+
#else
1518
import struct Foundation.UUID
19+
#endif
1620

1721
/// A background notification.
1822
///

Sources/APNSCore/Broadcast/APNSBroadcastClientProtocol.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if canImport(FoundationEssentials)
16+
import struct FoundationEssentials.UUID
17+
#else
1518
import struct Foundation.UUID
19+
#endif
1620

1721
/// Protocol defining the broadcast channel management operations.
1822
public protocol APNSBroadcastClientProtocol: Sendable {

0 commit comments

Comments
 (0)