From f6dd4f0f2c4f87e21caa9639433a0329c9532903 Mon Sep 17 00:00:00 2001 From: saint Date: Thu, 3 Aug 2023 18:22:18 -0400 Subject: [PATCH] made the reorder even smoother --- gloss/ContentView.swift | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gloss/ContentView.swift b/gloss/ContentView.swift index 92ca711..114839f 100644 --- a/gloss/ContentView.swift +++ b/gloss/ContentView.swift @@ -417,6 +417,10 @@ struct ContentView: View { .zIndex(0) .animation(.default, value: ribbons) + .onDrop(of: [.item], + delegate: DropViewDelegate2(isDragging: $isDragging) + ) + // Spacer() // ForEach(ribbons) { ribbon in @@ -914,6 +918,24 @@ private let itemFormatter: DateFormatter = { 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 { let destinationItem: Ribbon