Hi all,
When dragging a .clipped() view, the floating rendering of the view being dragged has a ghost version of the view prior to clipping. It appears as if the non-clipped view is used to make a shadow, but otherwise only the clipped view is shown.
What I’d like is for the floating view to look like the original one, maybe with some scaling and shadow. Does anyone know how to achieve this?
Here’s an example of the behavior. It makes a 300x300 ‘plus’ shape from two rectangles and then crops it down to the center square where the rectangles overlap. When dragging, a shadow in shape of a plus appears:
Thanks!
When dragging a .clipped() view, the floating rendering of the view being dragged has a ghost version of the view prior to clipping. It appears as if the non-clipped view is used to make a shadow, but otherwise only the clipped view is shown.
What I’d like is for the floating view to look like the original one, maybe with some scaling and shadow. Does anyone know how to achieve this?
Here’s an example of the behavior. It makes a 300x300 ‘plus’ shape from two rectangles and then crops it down to the center square where the rectangles overlap. When dragging, a shadow in shape of a plus appears:
Code Block swift import SwiftUI import PlaygroundSupport struct DragMe: View { var body: some View { ZStack { Rectangle().frame(width: 300, height: 100) Rectangle().frame(width: 100, height: 300) } .foregroundColor(.green) .frame(width: 100, height: 100) .clipped() .onDrag { NSItemProvider() } } } PlaygroundPage.current.setLiveView(DragMe())
Thanks!