Is there a way to generate an event when .onDrag ends on macOS?
For example, if I drag an object from my app and drop it in another app, how can I know if it went well?
Post
Replies
Boosts
Views
Activity
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?
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?