import SwiftUI
import ASCollectionView_SwiftUI
struct SampleViewModel : Identifiable {
let id : Int
}
struct ContentView: View {
@State var viewModels : [SampleViewModel] = []
var body: some View {
ASCollectionView(data: viewModels) {
(viewModel : SampleViewModel, context: ASCellContext) in
Text("\(viewModel.id)")
}.onAppear {
self.load()
}
}
func load() {
DispatchQueue.main.async {
self.viewModels = (0 ..< 10).map { (i : Int) in
SampleViewModel(id: i)
}
}
}
}
The first four cells are rendered correctly sized, but the subsequent three cells are rendered "too tall." Inspecting the layout reveals that the Text views are sized correctly, but the parent ASCollectionViewCell are mysteriously large.
The instant that you scroll the ASCollectionView, all cells are rendered correctly for the duration of the ASCollectionView's existence:
Using a minimal code sample:
The first four cells are rendered correctly sized, but the subsequent three cells are rendered "too tall." Inspecting the layout reveals that the Text views are sized correctly, but the parent ASCollectionViewCell are mysteriously large.
The instant that you scroll the ASCollectionView, all cells are rendered correctly for the duration of the ASCollectionView's existence:
Xcode Version:
Simulator, Device, Both?