icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
994 stars 95 forks source link

ios m.leaks #250

Open aplha98 opened 10 months ago

aplha98 commented 10 months ago

hello, plz help me I am using cflowState , cflow extension, the issue I have a lot of memory leaks on IOS, on IOS In the viewModels

 func releaseDisposableHandle(){
        disposableHandle.dispose()
    }

in the swiftui view

Vstack{}
            .onDisappear {
            vm.releaseDisposableHandle()
            }

let us say I have screens A -> B -> C I did not want to dispose of B until C is disappear, sometimes the user go to C and back to B , how to manage the scope of VM life does DisposableHandle work?

Alex009 commented 10 months ago

hi. what is disposableHandle in your code?

also, are you use weak references in lambda on swift side?