https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
p

pers

02/21/2024, 11:50 AM
Copy code
@MainActor
class PersonalInfoViewModelViewModel: ObservableObject {
    
    let viewModelKt = DIHelper().providePersonalInfoViewModel
    
    @Published private(set) var uiState = PersonalInfoViewModelContractMyUiState.companion.defaultInstance()
   
    init () {
        Task {
            for await state in viewModelKt.uiState {
                DispatchQueue.main.async {
                    self.uiState = state
                }
            }}
is there any benefits to cancel the task on view disappear 🫠 ?