Question posted in Xcode
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
2
Answers
This tutorial has everything you need and it is very easy to follow up.
(As a side note, SwiftUI makes it indeed easy as opposed to how one has to do it in UIKit).
https://www.vadimbulavin.com/add-edit-move-and-drag-and-drop-in-swiftui-list/
Update:
I add some explanations on how to resolve the issue.
Steps:
The handler signature is
(Int, [NSItemProvider])
, which provides you theindex
where the dragged object is dropped, anditemProviders
which provide you with info on what has been dropped.So far there is not really a boot in method to drag and drop. The .onDrag modifier really only seems to work on the iPad. My suggestion is that you use a UIViewRepresentable and make a table view (UI kit) and then implement the drag and drop from there.