Premiere Rating: Medium
|Title||The Customisation High Road: Dragging Items with Cocoa|
|Role||Writer, Illustration Artist|
|Context||Published Medium article on native macOS development|
A brief summary and teaser text to accompany the publishing of my first technical article on Medium on the topic of building a collection view with drag and drop capabilities in the native macOS framework Cocoa.
While developing for the yet unannounced app project, I've often unintentionally landed on Medium with various articles on using Cocoa and its myriad of classes and modules (though, quite unfortunately, most articles and available documentation in general is written for Cocoa Touch, the iOS equivalent of Cocoa for the Mac). I'm not familiar with any general consensus on Medium's contents, its content curators or a general topic — just any writing I've ever found was technical and seemed more like guides and tutorials, sometimes opinion pieces. After benefitting from printed books on Mac software development (most rather out of date) and finding the most useful information scattered around in Apple's official documentation, community forums, finding archived tweets, I wanted to publish my own article on a particularly intransparent part of user interface programming. The cover image is a 35mm photograph I shot at an Irish crossing, somewhere around Dún Laoghaire. The still was shot twice with a year apart, actually, though that is a different story.
Drag and drop using
NSCollectionView with multiple items and one image per item seems to be a crude oversight in the Cocoa framework. There is the exact procedure in Cocoa Touch for iOS which might confirm that the intended behaviour is currently missing. A dragging session needs to be created with individual items, and each item receives a custom-rendered bitmap representation of the dragged item. The article explains the technicalities of implementing drag an drop with a decent level of customisation not part of Cocoa while still following Cocoa principles.