Cell are reused.
See Does the List in SwiftUI reuse cells similar to UITableView?
For static Lists the limit are 10 Items.
This has to do with the ViewBuilder
implementation.
extension ViewBuilder {
public static func buildBlock<C0, C1>(_ c0: C0, _ c1: C1) -> TupleView<(C0, C1)> where C0 : View, C1 : View
}
…
extension ViewBuilder {
public static func buildBlock<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>(_ c0: C0, _ c1: C1, _ c2: C2, _ c3: C3, _ c4: C4, _ c5: C5, _ c6: C6, _ c7: C7, _ c8: C8, _ c9: C9) -> TupleView<(C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where C0 : View, C1 : View, C2 : View, C3 : View, C4 : View, C5 : View, C6 : View, C7 : View, C8 : View, C9 : View
}
To use an array you can use this API:
let array = [1,2,3,4]
let listView = List(array) { value in
Text(value.description)
}
extension List {
extension List {
/// Creates a List that computes its rows on demand from an underlying
/// collection of identified data.
@available(watchOS, unavailable)
public init<Data, RowContent>(_ data: Data, selection: Binding<Selection>?, rowContent: @escaping (Data.Element.IdentifiedValue) -> RowContent) where Content == ForEach<Data, HStack<RowContent>>, Data : RandomAccessCollection, RowContent : View, Data.Element : Identifiable
…
Combine
sessions? Or Session 226: Data Flor Through SwiftUI? developer.apple.com/videos/play/wwdc2019/226 That's where you should start. Pay attention to "Source of Truth",@State
, @Binding` and everything else. – Enwind