I’m putting together a post comparing Mac drag and drop APIs and iOS drag and drop APIs.
Since I haven’t internalized the pattern between Objective-C and Swift method conversions, I was often frustrated by how to translate Objective-C method calls to Swift method calls.
While I was working on the project, it seemed that 4 times out of 5, when I tried to go to a class or protocol’s declaration in Apple’s headers and see its Swift-ified methods, Xcode would take me to the Objective-C header instead, even though I was starting off in a Swift file.
Of course, now that I’m trying to reproduce it to file a Radar, it doesn’t happen. I wonder if that’s because the final project has no Objective-C files in it at all.
It doesn’t help that the translations changed between Swift 3 and Swift 4.
NSPasteboardTypeTIFF in Swift 3 is now
NSPasteboard.PasteboardType.tiff in Swift 4, with a similar pattern for all its friends.
register(forDraggedTypes newTypes: [String]) is now
registerForDraggedTypes(_ newTypes: [NSPasteboard.PasteboardType]).
It’ll be nice to be working exclusively in Swift for the rest of this effort.