迁移到Swift4后,以下代码引发编译错误:
原文链接:https://www.f2er.com/swift/320184.htmlpublic final class MediaItemView: NSView { public override init(frame frameRect: NSRect) { super.init(frame: frameRect) // error: 'NSFilenamesPboardType' is unavailable in Swift: // use 'NSPasteboard.writeObjects(_:)' with file URLs let draggedTypes: [NSPasteboard.PasteboardType] = [NSFilenamesPboardType] registerForDraggedTypes(draggedTypes) } }
什么是Swift4中NSFilenamesPboardType的替代品?如何在Swift4中注册拖动类型的文件名(在我的情况下是mp3,wav,aiff,…文件)?
谢谢!