Contents

insub4067/draganddropkit

> DragAndDropKit allows you to implement drag and drop functionality easily in your SwiftUI projects without any effort.

What is DragAndDropKit?

DragAndDropKit allows you to implement drag and drop functionality easily in your SwiftUI projects without any effort.

✔️ Result

<img src="https://github.com/insub4067/DragAndDropKit/assets/85481204/fa0b1cec-6294-47f1-bff2-94c1a953fb07" width="300">

✔️ Example Code

import SwiftUI
import DragAndDropKit

struct DragAndDropPractice: View {
    
    @State var items: [Item] = Array(1...20).map { Item(id: $0) }
    @State var currentDragging: Item? = nil
    
    var body: some View {
        ScrollView {
            LazyVStack(content: {
                ForEach(items, id: \.self) { item in
                    Text("Placeholder \(item.id)")
                        .padding()
                        .frame(maxWidth: .infinity)
                        .frame(height: 100)
                        .background(Color.gray.opacity(0.6))
                        .dragAndDrop(
                            item: item,
                            items: $items,
                            currentDragging: $currentDragging)
                }
            })
        }
    }
}

struct Item: Identifiable, Hashable {
    let id: Int
}

Package Metadata

Repository: insub4067/draganddropkit

Default branch: main

README: README.md