init(_:observe:send:content:file:line:)

Initializes a structure that transforms a Store into an observable ViewStore in order to compute bindings and views from state.

Binding.swift:703
@MainActor init<State, Action>(_ store: Store<State, Action>, observe toViewState: @escaping (_ state: BindingViewStore<State>) -> ViewState, send fromViewAction: @escaping (_ viewAction: ViewAction) -> Action, @ViewBuilder content: @escaping (_ viewStore: ViewStore<ViewState, ViewAction>) -> Content, file: StaticString = #fileID, line: UInt = #line) where ViewAction : BindableAction, State == ViewAction.State

Parameters

store

A store.

toViewState

A function that transforms binding store state into observable view state. All changes to the view state will cause the WithViewStore to re-compute its view.

fromViewAction

A function that transforms view actions into store action.

content

A function that can generate content from a view store.

file

The file.

line

The line.

Read Working with SwiftUI bindings for more information.