Skip to main content

toggle_labelled

Function toggle_labelled 

Source
pub fn toggle_labelled(label: View, state: &BoundState<bool>) -> View
Expand description

Toggle(isOn:) { label } — a toggle whose label is any view.

toggle_bound takes a string, which becomes a Text. The convenience that takes a symbol name — Toggle(_:systemImage:isOn:) — is inlinable and exports nothing, so it cannot be called; but it only builds a Label, and this takes any view at all, so the same row is reachable and any other label with it.

let wifi = BoundState::new(true);
let row = toggle_labelled(label("Wi-Fi", "wifi"), &wifi);