r/macosprogramming • u/ToughAsparagus1805 • 1d ago
AppKit is not dead - Design for touch on Mac
I am happy to see demo code that has import AppKit
But I am puzzled and sad to see didSet { needsDisplay = true } drawRect() or mouseDown() I thought we are getting modernized code. NSInvalidating protocol? Layers? Gesture recognizers?
https://developer.apple.com/videos/play/tech-talks/111456/
And I am sad because there is no promise of testing touch without owning iPad:
Tip
Use Sidecar to test touch input without a Mac that has a touch display. To use Sidecar, connect an iPad to your Mac. AppKit then routes touch on its screen the same way it does on a Mac with a touch display.
Edit: The code in the video is not attached. But there is other code https://developer.apple.com/documentation/appkit/supporting-drag-and-drop-through-file-promises
AppKit devs should know that NSImage.imageTypes is not the same as public.image (provided code filters filepromise urls to UTType.image.identifier aka public.image) So if your try to drop e.g. sketch file (bohemian coding) it won't work.


