You can create a draggable UIView
that represents your rectangle and add a pan gesture recognizer to it. Here's an example implementation that returns "yellow" when the view is dragged:
main.swift1155 chars34 lines
You can then use the DraggableView
in your view controller like this:
main.swift313 chars12 lines
Now, when you drag the view around and drop it in the specified area, the function will return "yellow".
gistlibby LogSnag