Issue #728
NSItemProvider(object: StringProvider(string: string))
class StringProvider: NSObject, NSItemProviderWriting {
let string: String
init(string: String) {
self.string = string
super.init()
}
static var writableTypeIdentifiersForItemProvider: [String] {
return [(kUTTypeData) as String]
}
func loadData(
withTypeIdentifier typeIdentifier: String,
forItemProviderCompletionHandler completionHandler: @escaping (Data?, Error?) -> Void
) -> Progress? {
let data = string.data(using: .utf8)
completionHandler(data, nil)
return Progress(totalUnitCount: 100)
}
}