Swift开发

SwiftUI系统bug

2023-09-10  本文已影响0人  DCherry

IOS15

1、Index out of range (TabView)

TabView {
}
.tabViewStyle(.page(indexDisplayMode: .always)) // 漰
// .tabViewStyle(.page(indexDisplayMode: .never)) // 不漰

IOS14

1、each layout item may only occur once(ForEach)

ForEach 的对象id相同时
class CCModel: NSObject, Identifiable {
    let id = UUID()
}
@State var list: [[CCModel]] = [[CCModel](repeating: DiyPageModel(), count: 3)]
// ForEach(list.indices, id: \.self) { inddex in 这种可以解决
ForEach(list) { iitem in // 漰了
}
上一篇 下一篇

猜你喜欢

热点阅读