Skip to content

Commit ac20cd5

Browse files
authored
Import FoundationEssentials instead of Foundation when available (#159)
1 parent 9a63aab commit ac20cd5

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Sources/MQTTNIO/AsyncAwaitSupport/MQTTClient+async.swift

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

14+
#if canImport(FoundationEssentials)
15+
import Dispatch
16+
import FoundationEssentials
17+
#else
1418
import Foundation
19+
#endif
1520
import NIOCore
1621

1722
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)

Sources/MQTTNIO/AsyncAwaitSupport/MQTTClientV5+async.swift

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

14+
#if canImport(FoundationEssentials)
15+
import FoundationEssentials
16+
#else
1417
import Foundation
18+
#endif
1519
import NIOCore
1620

1721
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)

Sources/MQTTNIO/MQTTConnection.swift

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

14+
#if canImport(FoundationEssentials)
15+
import FoundationEssentials
16+
#else
1417
import Foundation
18+
#endif
1519
#if canImport(Network)
1620
import Network
1721
#endif

Sources/MQTTNIO/MQTTPacket.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ struct MQTTAuthPacket: MQTTPacket {
623623

624624
/// MQTT incoming packet parameters.
625625
struct MQTTIncomingPacket: MQTTPacket {
626-
var description: String { "Incoming Packet 0x\(String(format: "%x", self.type.rawValue))" }
626+
var description: String { "Incoming Packet 0x\(String(self.type.rawValue, radix: 16))" }
627627

628628
/// Type of incoming MQTT packet.
629629
let type: MQTTPacketType

0 commit comments

Comments
 (0)