Skip to content

0x07b-Swiftui-List之罪

List组件问题不是一般的多。

  1. iOS16上,List默认都有背景颜色,需要使用.scrollContentBackground(.hidden) 设置
  2. iOS16.0~iOS16.3,调用proxy.scrollTo,必然崩溃,需要使用 SwiftUIIntrospect 兼容
  3. iOS15上,调用 proxy.scrollTo(:animate)如果带动画,会有奇怪的滚动BUG
  4. iOS18莫名崩溃问题,UICollectionView的问题,可以参考:https://dev.classmethod.jp/articles/app-crash-caused-by-uicollection-view-when-using-xcode-16-beta-3/ 结合SwiftUIIntrospect设置 collectionView.isPrefetchingEnabled = false

SwiftUI快速开发UI很爽,但是总让你非常难受。