Posts

Post not yet marked as solved
7 Replies
6.0k Views
My goal is to create a chat view in SwiftUI. This requires creating a ScrollView with content of varying heights . After extensive debugging, I've determined that if you have views within a LazyVStack inside of a ScrollView that do not have a fixed height, it will stutter when you scroll to the top of the view. –––– PROJECT: Download this project and try for yourself struct ContentView: View { @State var items: [String] = MockData.randomMessages(count: 100) var body: some View { VStack { Button("Shuffle items") { items = MockData.randomMessages(count: 100) } ScrollView { LazyVStack(spacing: 10) { ForEach(Array(items.enumerated()), id: \.offset) { index, item in Text(item) .background(colors.randomElement()!) } } } } } } My conclusion right now is that LazyVStack only works with child views that have fixed height. This issue alone prevents SwiftUI from being production ready. Has anyone else tackled this?
Posted
by ikaria.
Last updated
.
Post not yet marked as solved
1 Replies
534 Views
My app was working perfectly fine yesterday (on the previous iOS 15 beta). I updated the operating system and now it just crashes immediately with: EXC_BAD_ACCESS (code=1, address=0x0) No further information. Anyone else experiencing this?
Posted
by ikaria.
Last updated
.
Post not yet marked as solved
0 Replies
597 Views
I've seen this in multiple places now, but when I have a keyboard up, and then I present a modal (i.e. UIImagePickerController or PHPickerViewController) and hit "Cancel", it shifts the view down by ~30 pixels, and it becomes partially covered by the keyboard. The weird thing is, if I swipe down the UIImagePicker camera, it restores the frame just fine. So it seems to only happen when dismissing a sheet without a gesture. Could it be a bad interaction with UIViewControllerRepresentable? This is a bad bug if you're trying to have a textfield stay affixed to the top of the keyboard. For now, I've just resignedFirstResponder before pulling up the keyboard.
Posted
by ikaria.
Last updated
.
Post not yet marked as solved
0 Replies
880 Views
I've been wrestling with the challenge of performant ScrollViews for quite some time now and I can't seem to figure it out. With either a a LazyVStack or a LazyHStack within a ScrollView, when I drag beyond the top (or leading) bounds, it will jitter or flicker. I removed all of the code from the subviews of the stacks and put it back line by line until I narrowed it down to using any sort of if let statements within the child. Here's a simplified example: HStack { if let duration = item.duration { Text(duration) } } If I take out the if let and just put Text("blah"), it no longer stutters. This is a mystery to me, and I'm curious if anyone has any knowledge on the inner working of SwiftUI and why this might be happening.
Posted
by ikaria.
Last updated
.