I'm working on a macOS project that involves the FileProvider API. I would like to add custom actions to the items provided by the FileProvider and use them in my code. How can I achieve this?
Specifically, I want to know:
How can I add actions to the macOS FileProvider API? How can I define and customize these actions? How can I handle the execution of the selected actions in my code? How can I access and use these actions in my code? I've already created a File Provider extension target in my Xcode project and implemented the necessary protocols. I just need guidance on how to add and utilize actions with the FileProvider API.
I would appreciate any example code or step-by-step instructions to help me understand and implement this functionality. Thank you!
I found my answer here: https://developer.apple.com/documentation/fileproviderui/adding_actions_to_the_context_menu
and you can use it like this using performaction()
func performAction(identifier actionIdentifier: NSFileProviderExtensionActionIdentifier,
onItemsWithIdentifiers itemIdentifiers: [NSFileProviderItemIdentifier],
completionHandler: @escaping (Error?) -> Void) -> Progress {
switch actionIdentifier.rawValue {
}
}