Open bennyhuo opened 3 years ago
有一处感觉有问题.... import kotlinx.android.synthetic.main.activity_main.*
class MainFragment : Fragment() { ...
override fun onDestroyView() {
super.onDestroyView()
textView.text = "Crash!"
}
} 这样是不会crash的。因为Kotlin synthetic是在ondestroyview的内容执行完之后才会_$_clearFindViewByIdCache()
有一处感觉有问题.... import kotlinx.android.synthetic.main.activity_main.*
class MainFragment : Fragment() { ...
override fun onDestroyView() { super.onDestroyView() textView.text = "Crash!" }
} 这样是不会crash的。因为Kotlin synthetic是在ondestroyview的内容执行完之后才会_$_clearFindViewByIdCache()
如果你之前没有访问过 textView,那么 Cache 里面就不会有,一样会 crash,因为此时 getView 返回的已经是 null 了。当然,如果这个例子放到 onDestroy 当中,那就一定会 crash 了。
compose for desktop目前还是跑在JVM上,上层用swing和awt,底层渲染用的JNI绑定的skia。
对于桌面平台来说是一个可行方案,但是要跑在iOS上肯定不行。
个人感觉更合理的方案是 Kotlin/Native 上实现一套compose的iOS底层(以及其他OS/UI库),这样跑起来比较轻量。 奈何KN一直难产。。。(线程模型是最大的阻力,先设计一套先进的线程模型,结果发现走不通
你说的对,所以我一直比较怀疑是不是步子太大了。不过要做得话应该也很快,就看有多大决心了。
compose for desktop目前还是跑在JVM上,上层用swing和awt,底层渲染用的JNI绑定的skia。
对于桌面平台来说是一个可行方案,但是要跑在iOS上肯定不行。
个人感觉更合理的方案是 Kotlin/Native 上实现一套compose的iOS底层(以及其他OS/UI库),这样跑起来比较轻量。 奈何KN一直难产。。。(线程模型是最大的阻力,先设计一套先进的线程模型,结果发现走不通
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
https://www.bennyhuo.com/2020/11/07/deprecated-kotlin-android-extensions/
伴随了我们这么多年的 KAE,就这么要离开我们了?