Skip to content

Commit 3b46ddc

Browse files
committed
Update to internal onPreferenceChange function so it runs on the main actor in Swift 5 as well.
1 parent a7a7d88 commit 3b46ddc

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

Sources/FrameUp/_Extensions-Internal/View+onPreferenceChange.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import SwiftUI
99

1010
internal extension View {
1111
@preconcurrency @inlinable nonisolated func onPreferenceChangeMainActor<K>(_ key: K.Type = K.self, perform action: @escaping @MainActor (K.Value) -> Void) -> some View where K : PreferenceKey, K.Value : Equatable & Sendable {
12-
#if swift(>=6)
1312
onPreferenceChange(key) { newValue in
1413
Task { @MainActor in
1514
action(newValue)
1615
}
1716
}
18-
#else
19-
onPreferenceChange(key, perform: action)
20-
#endif
2117
}
2218
}

0 commit comments

Comments
 (0)