// โญ๏ธ creating `Binding` from `@StateObject`structExampleView:View {// โญ๏ธ `@StateObject` variable@StateObjectprivatevar viewModel =ExampleModel()var text: String { viewModel.isEnabled ?"Enabled":"Disabled" }var body: some View {// โญ๏ธ $viewModel.isEnabled: Binding<Bool>// two-way connection to a source of truth// โญโโโโโโโ โญ๏ธ โโโโโโโโฎToggle(text, isOn: $viewModel.isEnabled) }}classExampleModel:ObservableObject {// โญ๏ธ "published" source of truth:@Publishedvar isEnabled: Bool=false}
$viewModel.isEnabled and viewModel.$isEnabled are not equivalent. The former creates a Binding to isEnabled, whereas the latter unwraps the projected value of the @Published property wrapper wrapping isEnabled.