Hello.
I am implementing a SwiftUI Drag and Drop application which runs fine on both macOX and IpadOS.
The only problem I have is that on iPadOS, the Dragged image is rendered just as an empty rectangle, while on macOS I have a correct dragged image.
The body of the view from which the items are dragged is :
var body: some View {
HStack {
ForEach( libraryRowItems, id: \.self) { thelibraryItem in
libraryItemView(item: thelibraryItem)
.onDrag {
return NSItemProvider(object: NuageIdentifier(identifier:thelibraryItem.id))
}
}
}
}
and the body for libraryItemView :
var body: some View {
let topColorGradient = Color(Color.RGBColorSpace.sRGB, red: 0.298, green: 0.301, blue: 0.301);
let bottomColorGradient = Color(Color.RGBColorSpace.sRGB, red: 0.235, green: 0.239, blue: 0.239);
return ZStack {
RoundedRectangle(cornerRadius: 5)
.fill(LinearGradient(gradient: Gradient(colors: [topColorGradient, bottomColorGradient]), startPoint: .top, endPoint: .bottom))
Text("\(text)").foregroundColor(.white).font(.custom("STIX2Math", size: fontSize))
}
.frame(width:50, height: 33)
}
On my late 2013 mac everything is ok
On my Ipad 5th generation the dragged iage is just a rectangle.
My mac is unable to run it on a Simulator (seems to be too slow now) to see if it could depends on the generation of the device.
I am the only one to encounter this problem ?
Regards
Chris Tof