How to add a File Provider to a MacOS Swift app?

1.4k views Asked by At

On iOS, there is the File Provider API to create "virtual folders" (folders where the content is provided by an app). How could I do something similar on MacOS? If you wonder why I would want to do this, it's just that I'm trying to understand how cloud storage apps work.

PS: Sorry for bad English, I'm French.

2

There are 2 answers

3
Adam Kopeć On BEST ANSWER

In macOS Big Sur there is a NSFileProviderReplicatedExtension protocol which should "Replicate" the iOS NSFileProviderExtension.
The API appears to be working on macOS 11.3+ and Xcode 12.5 has brought back the required FileProvider Extension target. There is also a workaround in Xcode 12.2 to add the target manually.
During WWDC21 we also got some sample code from Apple, which should make the extension a bit easier to implement.

0
E. Rivera On

Grab Xcode 12.5 beta 3 which includes the templates to create a macOS File Provider:

https://developer.apple.com/download/