File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the MQTTNIO project
4
4
//
5
- // Copyright (c) 2020-2021 Adam Fowler
5
+ // Copyright (c) 2020-2022 Adam Fowler
6
6
// Licensed under Apache License v2.0
7
7
//
8
8
// See LICENSE.txt for license information
@@ -121,7 +121,8 @@ public final class MQTTClient {
121
121
case . createNew:
122
122
#if canImport(Network)
123
123
switch configuration. tlsConfiguration {
124
- #if canImport(NIOSSL)
124
+ // This should use canImport(NIOSSL), will change when it works with SwiftUI previews.
125
+ #if os(macOS) || os(Linux)
125
126
case . niossl:
126
127
self . eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
127
128
#endif
Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the MQTTNIO project
4
4
//
5
- // Copyright (c) 2020-2021 Adam Fowler
5
+ // Copyright (c) 2020-2022 Adam Fowler
6
6
// Licensed under Apache License v2.0
7
7
//
8
8
// See LICENSE.txt for license information
@@ -28,7 +28,8 @@ extension MQTTClient {
28
28
/// It is recommended on iOS you use NIO Transport Services.
29
29
public enum TLSConfigurationType {
30
30
/// NIOSSL TLS configuration
31
- #if canImport(NIOSSL)
31
+ // This should use canImport(NIOSSL), will change when it works with SwiftUI previews.
32
+ #if os(macOS) || os(Linux)
32
33
case niossl( TLSConfiguration )
33
34
#endif
34
35
#if canImport(Network)
Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the MQTTNIO project
4
4
//
5
- // Copyright (c) 2020-2021 Adam Fowler
5
+ // Copyright (c) 2020-2022 Adam Fowler
6
6
// Licensed under Apache License v2.0
7
7
//
8
8
// See LICENSE.txt for license information
@@ -96,7 +96,8 @@ final class MQTTConnection {
96
96
switch client. configuration. tlsConfiguration {
97
97
case . ts( let config) :
98
98
options = try config. getNWProtocolTLSOptions ( )
99
- #if canImport(NIOSSL)
99
+ // This should use canImport(NIOSSL), will change when it works with SwiftUI previews.
100
+ #if os(macOS) || os(Linux)
100
101
case . niossl:
101
102
throw MQTTError . wrongTLSConfig
102
103
#endif
@@ -112,7 +113,8 @@ final class MQTTConnection {
112
113
return bootstrap
113
114
}
114
115
#endif
115
- #if canImport(NIOSSL) // canImport(Network)
116
+ // This should use canImport(NIOSSL), will change when it works with SwiftUI previews.
117
+ #if os(macOS) || os(Linux) // canImport(Network)
116
118
if let clientBootstrap = ClientBootstrap ( validatingGroup: client. eventLoopGroup) {
117
119
let tlsConfiguration : TLSConfiguration
118
120
switch client. configuration. tlsConfiguration {
Original file line number Diff line number Diff line change 2
2
//
3
3
// This source file is part of the MQTTNIO project
4
4
//
5
- // Copyright (c) 2020-2021 Adam Fowler
5
+ // Copyright (c) 2020-2022 Adam Fowler
6
6
// Licensed under Apache License v2.0
7
7
//
8
8
// See LICENSE.txt for license information
@@ -98,7 +98,8 @@ public struct TSTLSConfiguration {
98
98
/// Create certificate array from already loaded SecCertificate array
99
99
public static func certificates( _ secCertificates: [ SecCertificate ] ) -> Self { . init( certificates: secCertificates) }
100
100
101
- #if canImport(NIOSSL)
101
+ // This should use canImport(NIOSSL), will change when it works with SwiftUI previews.
102
+ #if os(macOS) || os(Linux)
102
103
/// Create certificate array from PEM file
103
104
public static func pem( _ filename: String ) throws -> Self {
104
105
let certificates = try NIOSSLCertificate . fromPEMFile ( filename)
You can’t perform that action at this time.
0 commit comments