cristicretu / swiftui-splitview-example

Inspired by Amie
37 stars 0 forks source link

Help #2

Open CoderGFWu opened 2 months ago

CoderGFWu commented 2 months ago

This project looks so cool! Thanks for sharing! I've used the Amie app and found it very interesting. How does the Amie App achieve the functionality of dragging items from a list below to a list above, with the ability to dynamically modify the drag preview during the drag-and-drop process?

https://github.com/cristicretu/swiftui-splitview-example/assets/17979026/3aef70a6-08ea-4b5d-9027-51f72072ed81

I searched through Apple's official documentation and found that the preview created in the onDrag(_:preview) method is only initialized once and cannot be updated dynamically during the drag-and-drop process.

cristicretu commented 1 month ago

Hey, no sure exactly how Amie does it, but I assume it's some kind of view collision detection which triggers the different preview. Might be a good view here: https://www.youtube.com/watch?v=WUrcAHC4cWk