Sonoma 14.2.1 (also beta 14.3) / Xcode 15.1 (also beta 15.2)
With even a trivial example, I can't get SwiftUI's .draggable to work on iOS (simulator, SwiftUI Preview, or on my device). Oddly, it works fine on the Mac target ("My Mac").
To reproduce:
- Open new SwiftUI project
- Replace
ContentView
:
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
.draggable("hello globe")
Text("Hello, world!")
.draggable("hello text")
}
.padding()
}
}
-
Expected: Should be able to drag both the globe icon and the
"hello world"
text around the screen. -
Actual behavior: No ability to drag the icon or text, unless I build for "My Mac". Works in Xcode Preview with "My Mac" selected, but not any of the iOS targets.
I tried on Xcode 15.2 beta and same results. Tried on another computer with same configuration, and same results. Am I doing something wrong? Is it not supposed to work this way? Is anyone getting other results?
This is a simplified example, but it's also broken in a more fully fleshed project with a drop target, etc.
Thanks for your help!