Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Mar 12, 2024
1 parent 5a37c3f commit 0f60e6a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Sources/DeviceInformation/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ public struct DeviceInfo: Sendable, Equatable, Identifiable {
@MainActor
func _access() -> String { UIDevice.current.systemName }
func _assumeIsolated<T>(_ 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 {
Expand Down

0 comments on commit 0f60e6a

Please sign in to comment.