Last active
September 7, 2021 10:48
-
-
Save patskovn/487a71359142d7c9f17bcfbbaa73874e to your computer and use it in GitHub Desktop.
Text is always "Title is empty"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import ComposableArchitecture | |
| struct TestState: Equatable { | |
| @BindableState var value = "" | |
| } | |
| enum TestAction: BindableAction { | |
| case binding(BindingAction<TestState>) | |
| } | |
| let testReducer = Reducer<TestState, TestAction, Void> { state, action, env in .none } | |
| struct WrappingView: View { | |
| let store: Store<TestState, TestAction> | |
| var body: some View { | |
| WithViewStore(store) { viewStore in | |
| TestView(text: viewStore.$value) | |
| } | |
| } | |
| } | |
| struct TestView: View { | |
| @Binding var text: String | |
| var body: some View { | |
| VStack { | |
| // Text is always "Title is empty"! Typing does not triggersing redraws in new approach | |
| Text(text.isEmpty ? "Title is empty" : "Title is not empty") | |
| TextField("Title", text: $text) | |
| .background(Color.yellow) | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried with:
Xcode 12.5.1 (12E507), iOS 14.6
Xcode 13.0 beta iOS 15