'Swiftui set boundaries for drag and drop, based on color

I am using the latest swiftui and would like to know if it is possible to create drag & drop boundaries based on color?

I already created a drag & drop with rotation, pinching, etc. But would like to be able to create regions where you can drop into.

Thanks



Solution 1:[1]

Yes it is! It's a great idea, and I think you should pursue it.

As it stands there's a hundred different ways to go about things. Spend some time thinking about how you would want it to work, then just take baby steps. You've already covered a lot of the ground work by implementing rotation and pinching.

Write some code (in a playground so you get instant feedback) that does some simple drag and drop work. Add in a line of code that turns the background a different color or changes its opacity when you let go/lift your finger.

Those types of incremental changes are well documented and you will be able to google them quickly. I think it's a great sign that you haven't found ready made examples. It means you are thinking outside the box.

This is an opportunity for you to think like a developer and a designer. If you post your results somewhere or release a project on GitHub at some point, others will be able to find your work using the same search criteria you used when you didn't find any results.

If you get stuck, post the code the code that has you baffled, and I'm sure you get help on this site. Best of luck ?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mozahler