made the reorder even smoother
parent
ecb13c384c
commit
f6dd4f0f2c
|
@ -417,6 +417,10 @@ struct ContentView: View {
|
||||||
.zIndex(0)
|
.zIndex(0)
|
||||||
.animation(.default, value: ribbons)
|
.animation(.default, value: ribbons)
|
||||||
|
|
||||||
|
.onDrop(of: [.item],
|
||||||
|
delegate: DropViewDelegate2(isDragging: $isDragging)
|
||||||
|
)
|
||||||
|
|
||||||
// Spacer()
|
// Spacer()
|
||||||
|
|
||||||
// ForEach(ribbons) { ribbon in
|
// ForEach(ribbons) { ribbon in
|
||||||
|
@ -914,6 +918,24 @@ private let itemFormatter: DateFormatter = {
|
||||||
return formatter
|
return formatter
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
struct DropViewDelegate2: DropDelegate {
|
||||||
|
@Binding var isDragging: Bool
|
||||||
|
|
||||||
|
func dropUpdated(info: DropInfo) -> DropProposal? {
|
||||||
|
return DropProposal(operation: .move)
|
||||||
|
}
|
||||||
|
|
||||||
|
func performDrop(info: DropInfo) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func dropEntered(info: DropInfo) {
|
||||||
|
isDragging = true
|
||||||
|
print("SECOND DROPPPOOO")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
struct DropViewDelegate: DropDelegate {
|
struct DropViewDelegate: DropDelegate {
|
||||||
|
|
||||||
let destinationItem: Ribbon
|
let destinationItem: Ribbon
|
||||||
|
|
Loading…
Reference in New Issue