Drag and Drop Tutorial for SwiftUI | raywenderlich.com

Learn how to use the drag and drop API in SwiftUI by building your own simple iPadOS and iOS bug reporting app.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/21679742-drag-and-drop-tutorial-for-swiftui

This article implies that there is implicit drag and drop support for grids, but I donโ€™t see that this is provided. If I replace the use of List with LazyVGrid (for example, LazyVGrid(columns: [GridItem(.adaptive(minimum: 120))])), drag and drop no longer works. From everything Iโ€™ve read, I think you have to roll your own drag and drop support for grid views.

This is true. That was Lazy not to check. I assumed that the Grid flavours would be UICollectionView under the hood and get the drag/drop operations too.

Iโ€™ll get that edited to reflect reality.

Thanks

Just started this tutorial, and on the initial build I got the following error (in DescriptionEditor.swift):

image

Iโ€™m gonna guess the second reference should be self.bug and keep going, but thought Iโ€™d mention it.

(Using Xcode 12.4)