DragAndDropKit

1.0.1

insub4067/DragAndDropKit

What's New

1.0.1

2024-03-12T05:18:19Z

DragAndDropKit

License: MIT Static Badge Static Badge

What is DragAndDropKit?

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

✔️ Result

✔️ 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
}

Description

  • Swift Tools 5.4.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 20 2024 03:32:24 GMT-0900 (Hawaii-Aleutian Daylight Time)