From 0f60e6a56d49aca66b29968f782194bd639b500e Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Tue, 12 Mar 2024 13:59:42 +0100 Subject: [PATCH] Fix build --- Sources/DeviceInformation/DeviceInfo.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Sources/DeviceInformation/DeviceInfo.swift b/Sources/DeviceInformation/DeviceInfo.swift index 9092148..dc527b4 100644 --- a/Sources/DeviceInformation/DeviceInfo.swift +++ b/Sources/DeviceInformation/DeviceInfo.swift @@ -25,12 +25,17 @@ public struct DeviceInfo: Sendable, Equatable, Identifiable { @MainActor func _access() -> String { UIDevice.current.systemName } func _assumeIsolated(_ work: @MainActor () -> T) -> T { +#if swift(>=5.10) if #available(iOS 13, tvOS 13, *) { return MainActor.assumeIsolated(work) - } else { - return withoutActuallyEscaping(work) { - unsafeBitCast($0, to: (() -> T).self)() - } + } +#else + if #available(iOS 17, tvOS 17, *) { + return MainActor.assumeIsolated(work) + } +#endif + return withoutActuallyEscaping(work) { + unsafeBitCast($0, to: (() -> T).self)() } } if Thread.isMainThread {