我正在开发Action Extension。理想情况下,我希望能够:
所选文字应替换为扩展名中生成的文字,但不是。
@IBAction func done() {
var result = extensionContext!.inputItems
if let currentText = outputLabel.text {
if currentText.isEmpty == false {
viewModel.currentText = currentText
viewModel.saveCurrentText()
let extensionItem = NSExtensionItem()
extensionItem.attachments = [NSItemProvider(item: currentText as NSString, typeIdentifier: kUTTypeText as String)]
result = [extensionItem]
}
}
extensionContext!.completeRequest(returningItems: result, completionHandler: nil)
}