23 lines
432 B
Plaintext
23 lines
432 B
Plaintext
struct ContentView: View {
|
|
@State var scrollId : String?
|
|
var body: some View {
|
|
SwitchButton(scrollId:$scrollId)
|
|
}
|
|
}
|
|
|
|
struct SwitchButton : View {
|
|
@Binding var scrollId : String?
|
|
|
|
var body: some View {
|
|
Button("This button",
|
|
action: {
|
|
goToRibbon($scrollId)
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
func goToRibbon(scrollId: Binding<String?>) {
|
|
scrollId = "SomeValue"
|
|
}
|