Swift/TCA
-
[TCA] ScrollToTopSwift/TCA 2023. 12. 24. 21:39
struct ContentView: View { @State var store = Store(initialState: Content.State()) { Content() } var body: some View { WithViewStore(store, observe: { $0 }) { viewStore in VStack(spacing: 0) { ScrollViewReader(content: { proxy in ScrollView { LazyVStack { Color.clear.frame(height: 0) .id("Top") ForEach(viewStore.items, id: \.self) { int in Text(String(int)) .frame(height: 80) } } } .onReceive(st..
-
[TCA] Throttle, DebounceSwift/TCA 2023. 12. 24. 00:29
struct ContentView: View { @State var store = Store(initialState: Content.State()) { Content() } @FocusState var focused: Content.FocusItem? var body: some View { WithViewStore(store, observe: { $0 }) { viewStore in VStack { TextFieldComponent( text: viewStore.$text1, placeholder: "Placeholder" ) .focused($focused, equals: .text1) TextFieldComponent( text: viewStore.$text2, placeholder: "Placeho..