I NEED your help : the issue where the `TextField`...
# multiplatform
p
I NEED your help : the issue where the
TextField
color is not updating until you press a button or write some text in another
TextField
I have this viewmodel and I am using https://github.com/rickclephas/KMP-NativeCoroutines ,
Copy code
@MainActor
class PersonalInfoViewModelViewModel: ObservableObject {
  let viewModelKt = DIHelper().providePersonalInfoViewModel

  @Published private(set) var uiState = PersonalInfoViewModelContractMyUiState.companion.defaultInstance()

  init() {
    Task {
      do {
        let uiStateFlow = asyncSequence(for: self.viewModelKt.uiStateNativeFlow)
        for try await state in uiStateFlow {
          self.uiState = state as! PersonalInfoViewModelContractMyUiState
        }
      }
Copy code
struct TextFieldN: View {

  var text: String
  var isValid: Bool
  var onTextChange: (String) -> Void

  var body: some View {
    var bind: Binding<String> = Binding(get: { text }, set: { value in
      onTextChange(value)
    })

    VStack(alignment: .leading) {

        TextField("", text: bind)
          .foregroundColor(isValid ? Neutral50 : Red)
    }
  }
}
@Chrimaeon plz do not answer or not kotlin but kotlin colored
🤡 2
Single Property Update: When you update
uiState
, SwiftUI is triggered to observe changes and re-render the view. However, if you access nested properties (like
uiState.firstName
), SwiftUI may not recognize these nested changes immediately unless the entire
uiState
object is replaced.