diff --git a/Sources/Lifecycle/Lifecycle.swift b/Sources/Lifecycle/Lifecycle.swift index 304069f..ce2176a 100644 --- a/Sources/Lifecycle/Lifecycle.swift +++ b/Sources/Lifecycle/Lifecycle.swift @@ -12,10 +12,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=5.5) -import _Concurrency -#endif - #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) import Darwin #else @@ -99,7 +95,7 @@ public struct LifecycleHandler { } } -#if compiler(>=5.5) +#if compiler(>=5.5) && canImport(_Concurrency) @available(macOS 12.0, *) extension LifecycleHandler { public init(_ handler: @escaping () async throws -> Void) { @@ -163,7 +159,7 @@ public struct LifecycleStartHandler { } } -#if compiler(>=5.5) +#if compiler(>=5.5) && canImport(_Concurrency) @available(macOS 12.0, *) extension LifecycleStartHandler { public init(_ handler: @escaping () async throws -> State) { @@ -225,7 +221,7 @@ public struct LifecycleShutdownHandler { } } -#if compiler(>=5.5) +#if compiler(>=5.5) && canImport(_Concurrency) @available(macOS 12.0, *) extension LifecycleShutdownHandler { public init(_ handler: @escaping (State) async throws -> Void) { diff --git a/Tests/LifecycleTests/ComponentLifecycleTests.swift b/Tests/LifecycleTests/ComponentLifecycleTests.swift index b155bdf..2f6df3c 100644 --- a/Tests/LifecycleTests/ComponentLifecycleTests.swift +++ b/Tests/LifecycleTests/ComponentLifecycleTests.swift @@ -1403,6 +1403,8 @@ final class ComponentLifecycleTests: XCTestCase { return #elseif compiler(<5.5) throw XCTSkip() + #elseif !canImport(_Concurrency) + throw XCTSkip() #else guard #available(macOS 12.0, *) else { throw XCTSkip() @@ -1437,6 +1439,8 @@ final class ComponentLifecycleTests: XCTestCase { return #elseif compiler(<5.5) throw XCTSkip() + #elseif !canImport(_Concurrency) + throw XCTSkip() #else guard #available(macOS 12.0, *) else { throw XCTSkip() @@ -1475,6 +1479,8 @@ final class ComponentLifecycleTests: XCTestCase { return #elseif compiler(<5.5) throw XCTSkip() + #elseif !canImport(_Concurrency) + throw XCTSkip() #else guard #available(macOS 12.0, *) else { throw XCTSkip() @@ -1511,6 +1517,8 @@ final class ComponentLifecycleTests: XCTestCase { return #elseif compiler(<5.5) throw XCTSkip() + #elseif !canImport(_Concurrency) + throw XCTSkip() #else guard #available(macOS 12.0, *) else { throw XCTSkip() @@ -1547,6 +1555,8 @@ final class ComponentLifecycleTests: XCTestCase { return #elseif compiler(<5.5) throw XCTSkip() + #elseif !canImport(_Concurrency) + throw XCTSkip() #else guard #available(macOS 12.0, *) else { throw XCTSkip()