Post

Replies

Boosts

Views

Activity

Conflict between onDrag and selection SwiftUI
There is a conflict when I use selection and onDrag for a list, onDrag blocks the selection on macOS. I think the problem comes from the fact that selection works on mouseDown and the same for onDrag. So, when the mouseDown event is triggered, swiftUI call the last modifier which is onDrag and it doesn't trigger the selection anymore. When I check on the Finder app, I noticed that the selection is triggered on mouseUp, which confirms my theory. Moreover, on finder, they combine onDrag, selection, and doubleClick without any conflict. Therefore, I'm pretty sure there is a workaround, but I can't figure it out... Did anyone already face this issue and found a workaround?
1
1
366
Nov ’22
Scroll conflict when there is ScrollView inside a ScrollView in SwiftUI
I'm trying to reproduce in a way the finder column view, but I'm facing an issue. A scroll conflict occurs when I put a ScrollView or a List inside another ScrollView. The horizontal scroll is lagging when the cursor is over the nested ScrollView. Here is my simplified code: struct SplitView: View { var body: some View { ScrollView(.horizontal, showsIndicators: false){ HSplitView{ ScrollView(showsIndicators: false) { VStack(alignment: .leading) { ForEach(0..<100) { Text("Row \($0)") } }.frame(minWidth: 200, alignment: .leading) } ScrollView { VStack(alignment: .leading) { ForEach(0..<100) { Text("Row \($0)") } }.frame(minWidth: 200, alignment: .leading) } ScrollView { VStack(alignment: .leading) { ForEach(0..<100) { Text("Row \($0)") } }.frame(minWidth: 200, alignment: .leading) } } } } } I have the same issue with nested List. Do you have any idea how I can prevent that? Or any workaround?
2
0
659
Nov ’22