moko-mvvm
moko-mvvm copied to clipboard
Support for bindText(flow: <CStateFlow<T>) on IOS
I can't use this function on the IOS side, it gives an error: Instance method 'bindText(flow:)' requires that 'StringDesc' inherit from 'NSString'
Solution: In mmp-library / src I created iosMain and there a file with the extension
import dev.icerock.moko.mvvm.flow.CStateFlow
import dev.icerock.moko.mvvm.flow.binding.bind
import dev.icerock.moko.resources.desc.StringDesc
import platform.UIKit.UILabel
fun UILabel.bindFlow(flow: CStateFlow<StringDesc?>) = bind(flow) {
if (it != null) {
this.text = it.localized()
}
}
@masimfacebook2 please create this issue in moko-mvvm. this one will be closed
binding functions is moko-mvvm-flow: https://github.com/icerockdev/moko-mvvm/tree/master/mvvm-flow/src/iosMain/kotlin/dev/icerock/moko/mvvm/flow/binding