Posts

Post not yet marked as solved
4 Replies
4.5k Views
I have a List in my SwiftUI view in order to present a presumably long list of cells. My designers want table separators to have custom length and colour. Previously I’ve had a dirty hack to hide default separators completely (modified UITableView.appearance() separator-related values) which does not seem to work on iOS 14. I’ve thought of using .listStyle(...) with custom ListStyle but the protocol stubs for this protocol look really scary. Is there some normal way to modify separators in List? Or is the preferable way on iOS 14 for this kind of layout would be one-column LazyVGrid inside a ScrollView?
Posted
by aweqrwer.
Last updated
.
Post not yet marked as solved
1 Replies
2.0k Views
Hi! I've got a ScrollView with a VStack inside mocking vertical subviews layout that could be written using CollectionView in UIKit.My goal was to know in which direction user is scrolling ScrollView, so I've decided to add DragGesture to a ScrollView, but looks like its internal DragGestures are blocking my custom DragGesture.Here's the minimal code reproducing this issue:struct ExperimentView: View { var body: some View { ScrollView { VStack { ForEach(0..<50) { number in Text("\(number)") .frame(width: 100, height: 100) .background(Color.blue) } } } .simultaneousGesture(DragGesture().onChanged({ value in print(value.translation) }), including: .all) } }I've tried different masks and different parameters of DragGesture itself. What's happening when I'm trying to scroll touching the blue views:1. in case ScrollView is steady during initial touch of DrugGesture - onChange will get called only once2. in case ScrollView is scrolling itself due to inertia during initial touch of DrugGesture - onChange will not get calledInteresting thing is that closure is getting called absolutely correctly (at least as I expect this code to work) when I'm dragging about 5-10pt on a white background near the blue views, but not on them... and in this case the ScrollView is not moving, obviously. Tried TapGesture instead of DragGesture and taps are recognised 100% as expected.Is this a bug or a feature? What am I doing wrong? Checked on Xcode 11 Beta 2 and 3 and macOS Catalina Beta 2 and 3
Posted
by aweqrwer.
Last updated
.