I have been searching for a simple example literally all day, and can’t find anything
I need a simple Swift (ObjC if I must) example of how to “drag” from one part of the screen to another. All I can find is draggin files/photos etc from outside into an App.
Techinically I’m not really “moving” anything. When I do mousedown, I need to get the ID of the NSView I’m in, “drag” to another NSView and “drop” the ID.
Think of the Xojo Toolbox… you “pick up” a control, and drop it on the design canvas. Same idea.
Anyone know of any examples I can work from…
Its interesting to see how powerful Swift is, but how much Xojo has enscapsulated.
Markus… trust me I have done that… 100’s and 100’s of times…
The results are for dragging files from Finder, Photos from Finder, dragging between apps, and 100% of them require the embedded use of Interface Builder.
FYI… NSVIEW is a Swift macOS construct… the example you pointed to was UIKit (ie. iOS… and macOS has a vastly different paradigm from iOS for a lot of things (unfortunately)
Forgive me if you’ve already seen this one, but this article seems to deal with drag/drop of controls within an app as well as from an outside source, (my guess is there’s not much difference).
Ok… have a partial solution (FINALLY)… the cursor changes, and it picks up the string I want and delivers it to the correct object…
It uses the UIImage of the NSView as the drag item!
In the SOURCE View (in my case an NSVIEW)
add NSDraggingSource as a delegate
next add registerForDraggedTypes([.string]) in the INIT method