Skip to content

Commit 16a27ab

Browse files
authored
Add explicit @MainActor to Button initializer (pointfreeco#236)
* Add explicit `@MainActor` to `Button` initializer This works around a regression in behavior introduced by Xcode 16 beta 3. * Scope
1 parent 7c3a9eb commit 16a27ab

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Sources/SwiftNavigation/ButtonState.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ extension ButtonState: Sendable where Action: Sendable {}
321321
/// - button: Button state.
322322
/// - action: An action closure that is invoked when the button is tapped.
323323
@available(iOS 15, macOS 12, tvOS 15, watchOS 8, *)
324+
#if compiler(>=6)
325+
@MainActor
326+
#endif
324327
public init<Action>(_ button: ButtonState<Action>, action: @escaping (Action?) -> Void) {
325328
self.init(
326329
role: button.role.map(ButtonRole.init),

Sources/SwiftUINavigation/Alert.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@
149149
/// dismisses the alert, and the action is fed to the `action` closure.
150150
/// - handler: A closure that is called with an action from a particular alert button when
151151
/// tapped.
152+
#if compiler(>=6)
153+
@MainActor
154+
#endif
152155
public func alert<Value>(
153156
_ state: Binding<AlertState<Value>?>,
154157
action handler: @escaping (Value?) -> Void = { (_: Never?) in }

0 commit comments

Comments
 (0)