Skip to content

Commit c1f88bd

Browse files
Fix docs for ViewStore.binding overload. (#321)
* Fix docs for ViewStore.binding overload. * wip * Update Sources/ComposableArchitecture/ViewStore.swift Co-authored-by: Stephen Celis <[email protected]>
1 parent 166acfa commit c1f88bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public final class ViewStore<State, Action>: ObservableObject {
170170
///
171171
/// For example, a text field binding can be created like this:
172172
///
173-
/// struct State { var name = "" }
173+
/// typealias State = String
174174
/// enum Action { case nameChanged(String) }
175175
///
176176
/// TextField(
@@ -199,14 +199,14 @@ public final class ViewStore<State, Action>: ObservableObject {
199199
///
200200
/// For example, an alert binding can be dealt with like this:
201201
///
202-
/// struct State { var alert: String? }
202+
/// typealias State = String
203203
/// enum Action { case alertDismissed }
204204
///
205205
/// .alert(
206-
/// item: self.store.binding(
206+
/// item: viewStore.binding(
207207
/// send: .alertDismissed
208208
/// )
209-
/// ) { alert in Alert(title: Text(alert.message)) }
209+
/// ) { title in Alert(title: Text(title)) }
210210
///
211211
/// - Parameters:
212212
/// - action: The action to send when the binding is written to.

0 commit comments

Comments
 (0)