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) { scrollId = "SomeValue" }