修复快捷指令运行时崩溃
This commit is contained in:
@@ -25,13 +25,13 @@ struct SaveClipIntent: AppIntent {
|
|||||||
self.source = source
|
self.source = source
|
||||||
}
|
}
|
||||||
|
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult & ReturnsValue<String> {
|
||||||
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
guard !trimmed.isEmpty else {
|
guard !trimmed.isEmpty else {
|
||||||
return .result(dialog: "文案为空,未保存。")
|
return .result(value: "文案为空,未保存。")
|
||||||
}
|
}
|
||||||
|
|
||||||
try await ClipStore.shared.save(text: trimmed, source: source)
|
try await ClipStore.shared.save(text: trimmed, source: source)
|
||||||
return .result(dialog: "已保存到收集箱。")
|
return .result(value: "已保存到收集箱。")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user