I need to dynamically create a Button based on some parameters
func buildButton(parameter : Parameter) -> Button {
switch (parameter){
case Parameter.Value1:
return Button(
action: {
...
},
label: {
...
}
)
case Parameter.Value2:
return Button(
action: {...},
label: {
...
}
)
}
}
But the compiler gives me this error:
Reference to generic type 'Button' requires arguments in <...>. Insert '<<#Label: View#>>'
So if I click Fix
, the function declaration becomes
func buildButton(parameter : Parameter) -> Button<Label:View>
and the compiler gives
Use of undeclared type '<#Label: View#>'
What do I need to insert here to be able to return a Button
?