7

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.

Rivera
  • 10,792
  • 3
  • 58
  • 102
Samuel Martineau
  • 143
  • 1
  • 1
  • 11

2 Answers2

6

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.

Adam Kopeć
  • 168
  • 1
  • 6
  • 1
    @Rivera Yes, I can confirm, that this extension launches on both M1 and Intel Macs, although some parts of the protocol are still marked as _Beta_. However, the core functionality should now work on all Macs running macOS 11.0 or later. – Adam Kopeć Apr 09 '21 at 11:32
  • The lastest beta of Xcode, 12.5 beta 3 comes with an extension template for file providers (similar to finder sync extensions). This should save you some trial and error. Unfortuantely, I was unable to make it work properly. But this is probably due to my lack of knowledge in Xcode, Swift, etc.... – André Gasser Apr 13 '21 at 15:24
  • That FruitBasket example by Apple is I think the most complicated example app ever released by Apple. – mixtly87 Jan 19 '22 at 23:50
2

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

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

Rivera
  • 10,792
  • 3
  • 58
  • 102