diff --git a/DiagnosticsTests/Extensions/MFMailComposeViewControllerTests.swift b/DiagnosticsTests/Extensions/MFMailComposeViewControllerTests.swift index e29a77f..59fcaff 100644 --- a/DiagnosticsTests/Extensions/MFMailComposeViewControllerTests.swift +++ b/DiagnosticsTests/Extensions/MFMailComposeViewControllerTests.swift @@ -8,6 +8,7 @@ import XCTest @testable import Diagnostics +#if canImport(MessageUI) import MessageUI final class MFMailComposeViewControllerTests: XCTestCase { @@ -49,3 +50,4 @@ private final class MockedMFMailComposeViewController: MFMailComposeViewControll self.filename = filename } } +#endif diff --git a/DiagnosticsTests/Reporters/SmartInsights/UpdateAvailableInsightTests.swift b/DiagnosticsTests/Reporters/SmartInsights/UpdateAvailableInsightTests.swift index 0a1939d..b7959fc 100644 --- a/DiagnosticsTests/Reporters/SmartInsights/UpdateAvailableInsightTests.swift +++ b/DiagnosticsTests/Reporters/SmartInsights/UpdateAvailableInsightTests.swift @@ -10,6 +10,7 @@ import XCTest @testable import Diagnostics import Combine +@available(iOS 13, *) final class UpdateAvailableInsightTests: XCTestCase { let exampleError = NSError(domain: UUID().uuidString, code: -1, userInfo: nil) diff --git a/Package.swift b/Package.swift index 9cd93bb..ab6a33b 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ import PackageDescription let package = Package(name: "Diagnostics", platforms: [ .macOS(.v10_15), - .iOS(.v13), + .iOS(.v11), .tvOS(.v12), .watchOS(.v6)], products: [ diff --git a/Sources/Reporters/SmartInsightsReporter.swift b/Sources/Reporters/SmartInsightsReporter.swift index 2f82d89..c8d8c06 100644 --- a/Sources/Reporters/SmartInsightsReporter.swift +++ b/Sources/Reporters/SmartInsightsReporter.swift @@ -43,12 +43,19 @@ public struct SmartInsightsReporter: DiagnosticsReporting { init() { var defaultInsights: [SmartInsightProviding?] = [ DeviceStorageInsight(), - UpdateAvailableInsight() ] #if os(iOS) && !targetEnvironment(macCatalyst) defaultInsights.append(CellularAllowedInsight()) #endif + #if os(iOS) + if #available(iOS 13, *) { + defaultInsights.append(UpdateAvailableInsight()) + } + #else + defaultInsights.append(UpdateAvailableInsight()) + #endif + insights = defaultInsights.compactMap { $0 } } diff --git a/Sources/SmartInsights/UpdateAvailableInsight.swift b/Sources/SmartInsights/UpdateAvailableInsight.swift index 0332d4c..bd86d0e 100644 --- a/Sources/SmartInsights/UpdateAvailableInsight.swift +++ b/Sources/SmartInsights/UpdateAvailableInsight.swift @@ -11,6 +11,7 @@ import Combine /// Uses the bundle identifier to fetch latest version information and provides insights into whether /// an app update is available. +@available(iOS 13, *) struct UpdateAvailableInsight: SmartInsightProviding { let name = "Update available"