Skip to content

Commit a5c9769

Browse files
author
Šimon Šesták
committed
feat(cross-platform): Improve Linux compatibility
Conditionally import FoundationNetworking and os.log to support non-Apple platforms.
1 parent 708bf57 commit a5c9769

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.1.2
1+
// swift-tools-version: 6.1.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/FTNetworkTracer/FTNetworkTracer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import Foundation
2+
#if canImport(FoundationNetworking)
3+
import FoundationNetworking
4+
#endif
25
#if canImport(os.log)
36
import os.log
47
#endif

Sources/FTNetworkTracer/Logging/LogPrivacy.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public enum LogPrivacy: String, CaseIterable, Sendable {
2525
/// The default value is `.auto`.
2626
public static let `default`: LogPrivacy = .auto
2727

28+
#if canImport(os.log)
2829
var level: OSLogPrivacy {
2930
switch self {
3031
case .none:
@@ -37,4 +38,5 @@ public enum LogPrivacy: String, CaseIterable, Sendable {
3738
OSLogPrivacy.sensitive
3839
}
3940
}
41+
#endif
4042
}

Tests/FTNetworkTracerTests/IntegrationTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// swiftlint:disable force_unwrapping non_optional_string_data_conversion
22
@testable import FTNetworkTracer
33
import XCTest
4+
#if canImport(FoundationNetworking)
5+
import FoundationNetworking
6+
#endif
47

58
class IntegrationTests: XCTestCase {
69
// MARK: - Mock Analytics

0 commit comments

Comments
 (0)