Samuel Martineau
Samuel Martineau

Reputation: 125

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

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.

Upvotes: 7

Views: 1698

Answers (2)

Adam Kopeć
Adam Kopeć

Reputation: 233

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.

Upvotes: 6

E. Rivera
E. Rivera

Reputation: 10938

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

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

Upvotes: 2

Related Questions