I have a list of navigation links that I want to be draggable. However, it seems like onDrag conflicts with mouse clicks on macOS (iOS is fine).
Here's some sample code:
Here's the weird part: if you click on the text, the item doesn't get selected and the link seems disabled. However, if you click on a section of the item that is empty, then it works!
Again, this works just fine on iOS. Is this a SwiftUI bug/limitation or am I doing it wrong?
Thanks!
Here's some sample code:
Code Block swift import SwiftUI struct ContentView: View { var items = ["Peter", "Mark", "Joe", "Frank", "Tim"] @State var selected: String? var body: some View { NavigationView { List { ForEach(items, id: \.self) { item in NavigationLink(destination: Text(item), tag: item, selection: $selected, label: { Text(item) .onDrag { () -> NSItemProvider in return NSItemProvider(object: String(item) as NSString) } }) } } Text("") } } }
Here's the weird part: if you click on the text, the item doesn't get selected and the link seems disabled. However, if you click on a section of the item that is empty, then it works!
Again, this works just fine on iOS. Is this a SwiftUI bug/limitation or am I doing it wrong?
Thanks!