As one can see in the gif, when draging an item, it somehow is clipped in a way that views within the item which extend the width/ height are cut off and some white background is added behind the rounded corners.
Here is my basic implementation.
struct ReorderableForEach<Content: View>: View {
var items: [Picture]
let content: (Int) -> Content
let move: (IndexSet, Int) -> Void
@State private var current: Picture?
init(
items: [Picture],
@ViewBuilder content: @escaping (Int) -> Content,
move: @escaping (IndexSet, Int) -> Void
) {
self.items = items
self.content = content
self.move = move
}
var body: some View {
ForEach(Array(zip(items.indices, items)), id: \.1) { index, item in
content(index)
.onDrop(
of: [.text],
delegate: DragRelocateDelegate(
item: item,
list: items,
current: $current
) { from, to in
withAnimation {
move(from, to)
}
}
)
.if(item.status != .standard, transform: { content in
content
.onDrag {
current = item
let provider = NSItemProvider(object: "\(item.id)" as NSString)
return provider
}
})
}
}
}
Is this a bug or am i doing anything wrong? Any help is appreciated.
