Swift 4: Where is NSURLPboardType?

Hi,


What is the corresponding constant of NSURLPboardType in Swift 4?


My collectionview stop accepting finder file drops because I can't find a correct draggingTypes in swift 4.

Currently, I use the rawValue as a workaround:


self.collectionView.registerForDraggedTypes([NSPasteboard.PasteboardType("Apple URL pasteboard type")])


Anyone knows what's the correct way to make my collection view accept finder file drop in swift 4?

Thanks!

Accepted Reply

Other workaround for global use:

#if swift(>=4.0)

let NSURLPboardType = NSPasteboard.PasteboardType(kUTTypeURL as String)

#endif

Replies

Other workaround for global use:

#if swift(>=4.0)

let NSURLPboardType = NSPasteboard.PasteboardType(kUTTypeURL as String)

#endif

Hi omnibpm,


We're aware of this deficiency in the API. In the immediate term, you can work around the lack of AppKit symbol by bridging in the UTI constants kUTTypeURL and/or kUTTypeFileURL.