Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Examples/SyncUps/SyncUps/SyncUpForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ struct SyncUpFormView: View {
@Bindable var store: StoreOf<SyncUpForm>
@FocusState var focus: SyncUpForm.State.Field?

var body: some View {
SyncUpFormContents(store: store, focus: $focus)
.bind($store.focus, to: $focus)
}
}

private struct SyncUpFormPreviewView: View {
@Bindable var store: StoreOf<SyncUpForm>
@FocusState var focus: SyncUpForm.State.Field?

var body: some View {
SyncUpFormContents(store: store, focus: $focus)
}
}

private struct SyncUpFormContents: View {
@Bindable var store: StoreOf<SyncUpForm>
@FocusState.Binding var focus: SyncUpForm.State.Field?

var body: some View {
Form {
Section {
Expand Down Expand Up @@ -96,7 +115,6 @@ struct SyncUpFormView: View {
Text("Attendees")
}
}
.bind($store.focus, to: $focus)
}
}

Expand Down Expand Up @@ -129,7 +147,7 @@ extension Duration {

#Preview {
NavigationStack {
SyncUpFormView(
SyncUpFormPreviewView(
store: Store(initialState: SyncUpForm.State(syncUp: .mock)) {
SyncUpForm()
}
Expand Down