Fix `ButtonState.init` ambiguity (#49)

Right now we have two overloads that specify optional `action`s, which means omitting the `action` parameter (or passing `nil`) is ambiguous.
This commit is contained in:
Stephen Celis 2022-12-12 16:42:07 -05:00 committed by GitHub
parent 54e000156a
commit b36d135f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -66,11 +66,11 @@ public struct ButtonState<Action>: Identifiable {
/// - label: A view that describes the purpose of the button's `action`. /// - label: A view that describes the purpose of the button's `action`.
public init( public init(
role: Role? = nil, role: Role? = nil,
action: Action? = nil, action: Action,
label: () -> TextState label: () -> TextState
) { ) {
self.role = role self.role = role
self.action = action.map(Handler.send) self.action = .send(action)
self.label = label() self.label = label()
} }