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:
parent
54e000156a
commit
b36d135f5e
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue