Skip to content

FileProvider iOS xcode13.0 beta1

Manuel de la Pena edited this page Jul 29, 2021 · 3 revisions

#FileProvider.framework https://github.com/xamarin/xamarin-macios/pull/12300

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/FileProvider.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/FileProvider.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/FileProvider.h	2021-03-16 08:41:13.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/FileProvider.h	2021-05-22 07:29:07.000000000 -0400
@@ -2,7 +2,7 @@
 //  FileProvider.h
 //  FileProvider
 //
-//  Copyright (c) 2014-2017 Apple Inc. All rights reserved.
+//  Copyright (c) 2014-2020 Apple Inc. All rights reserved.
 //
 
 /**
@@ -12,6 +12,7 @@
    and storage services to provide files to file browsers and applications.
  */
 
+#import <FileProvider/NSFileProviderDefines.h>
 #import <FileProvider/NSFileProviderDomain.h>
 #import <FileProvider/NSFileProviderExtension.h>
 #import <FileProvider/NSFileProviderEnumerating.h>
@@ -21,3 +22,7 @@
 #import <FileProvider/NSFileProviderActions.h>
 #import <FileProvider/NSFileProviderService.h>
 #import <FileProvider/NSFileProviderThumbnailing.h>
+#import <FileProvider/NSFileProviderItemDecoration.h>
+#import <FileProvider/NSFileProviderRequest.h>
+#import <FileProvider/NSFileProviderReplicatedExtension.h>
+#import <FileProvider/NSFileProviderTesting.h>
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h	2021-03-16 08:45:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderActions.h	2021-05-22 07:33:59.000000000 -0400
@@ -11,9 +11,13 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
+typedef NSString *NSFileProviderExtensionActionIdentifier NS_EXTENSIBLE_STRING_ENUM;
+
 /**
  This category encapsulates common user-driven actions on FileProvider's items.
  */
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (NSFileProviderActions)
 
 /**
@@ -30,7 +34,7 @@
    - filename (to fileURL's resource value for key NSURLNameKey)
    - creationDate (to NSURLCreationDateKey)
    - contentModificationDate (to NSURLContentModificationDateKey)
-   - typeIdentifier (to NSURLTypeIdentifierKey)
+   - contentType (to NSURLContentTypeKey)
    - documentSize (to NSURLTotalFileSizeKey on a flat file, or to the sum of the
      files sizes for a package)
    - capabilities
@@ -79,7 +83,7 @@
  */
 - (void)importDocumentAtURL:(NSURL *)fileURL
      toParentItemIdentifier:(NSFileProviderItemIdentifier)parentItemIdentifier
-          completionHandler:(void (^)(NSFileProviderItem _Nullable importedDocumentItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("createItem:fields:contents:options:completionHandler:");
+          completionHandler:(void (^)(NSFileProviderItem _Nullable importedDocumentItem, NSError * _Nullable error))completionHandler;
 
 /**
  Create a directory.
@@ -91,7 +95,7 @@
  - parentItemIdentifier (to the value passed in to this method)
  - filename (to directoryName)
  - creationDate (to the current date and time)
- - typeIdentifier (to "public.folder")
+ - contentType (to "public.folder" - UTTypeFolder)
  - childItemCount (to 0)
  - capabilities
 
@@ -101,7 +105,7 @@
  */
 - (void)createDirectoryWithName:(NSString *)directoryName
          inParentItemIdentifier:(NSFileProviderItemIdentifier)parentItemIdentifier
-              completionHandler:(void (^)(NSFileProviderItem _Nullable createdDirectoryItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("createItem:fields:contents:options:completionHandler:");
+              completionHandler:(void (^)(NSFileProviderItem _Nullable createdDirectoryItem, NSError * _Nullable error))completionHandler;
 
 
 /**
@@ -120,7 +124,7 @@
  */
 - (void)renameItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
                           toName:(NSString *)itemName
-               completionHandler:(void (^)(NSFileProviderItem _Nullable renamedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+               completionHandler:(void (^)(NSFileProviderItem _Nullable renamedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Move an item to a new directory.
@@ -137,7 +141,7 @@
 - (void)reparentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
         toParentItemWithIdentifier:(NSFileProviderItemIdentifier)parentItemIdentifier
                            newName:(nullable NSString *)newName
-                 completionHandler:(void (^)(NSFileProviderItem _Nullable reparentedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+                 completionHandler:(void (^)(NSFileProviderItem _Nullable reparentedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Move an item to the trash.
@@ -160,7 +164,7 @@
  NSFileProviderItemCapabilitiesAllowsTrashing.
  */
 - (void)trashItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
-              completionHandler:(void (^)(NSFileProviderItem _Nullable trashedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+              completionHandler:(void (^)(NSFileProviderItem _Nullable trashedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Move an item out of the trash.
@@ -178,7 +182,7 @@
  */
 - (void)untrashItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
            toParentItemIdentifier:(nullable NSFileProviderItemIdentifier)parentItemIdentifier
-                completionHandler:(void (^)(NSFileProviderItem _Nullable untrashedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+                completionHandler:(void (^)(NSFileProviderItem _Nullable untrashedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Delete an item forever.
@@ -191,7 +195,7 @@
  NSFileProviderItemCapabilitiesAllowsDeleting.
  */
 - (void)deleteItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
-               completionHandler:(void (^)(NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("deleteItemWithIdentifier:baseVersion:options:completionHandler:");
+               completionHandler:(void (^)(NSError * _Nullable error))completionHandler;
 
 /**
  Mark an item as recently used, or clear its lastUsedDate if nil.
@@ -209,7 +213,7 @@
  */
 - (void)setLastUsedDate:(nullable NSDate *)lastUsedDate
       forItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
-      completionHandler:(void (^)(NSFileProviderItem _Nullable recentlyUsedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+      completionHandler:(void (^)(NSFileProviderItem _Nullable recentlyUsedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Tag an item, or untag it if tagData is nil.
@@ -229,7 +233,7 @@
  */
 - (void)setTagData:(nullable NSData *)tagData
  forItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
- completionHandler:(void (^)(NSFileProviderItem _Nullable taggedItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+ completionHandler:(void (^)(NSFileProviderItem _Nullable taggedItem, NSError * _Nullable error))completionHandler;
 
 /**
  Mark a directory as favorite (or no longer favorite if favoriteRank is nil.)
@@ -248,7 +252,7 @@
  */
 - (void)setFavoriteRank:(nullable NSNumber *)favoriteRank
       forItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
-      completionHandler:(void (^)(NSFileProviderItem _Nullable favoriteItem, NSError * _Nullable error))completionHandler FILEPROVIDER_API_DEPRECATED_V3("itemChanged:baseVersion:changedFields:contents:completionHandler:");
+      completionHandler:(void (^)(NSFileProviderItem _Nullable favoriteItem, NSError * _Nullable error))completionHandler;
 
 @end
 
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h	2021-03-16 08:47:54.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDefines.h	2021-06-02 12:47:29.000000000 -0400
@@ -2,21 +2,20 @@
 //  NSFileProviderDefines.h
 //  FileProvider
 //
-//  Copyright © 2017 Apple Inc. All rights reserved.
+//  Copyright © 2017-2020 Apple Inc. All rights reserved.
 //
 
-#ifndef PREPROCESS_AVAILABILITY_MACROS
-
-// changing anything here? be sure to also change process-header.sh!
-
-#define FILEPROVIDER_SPI_AVAILABILITY API_UNAVAILABLE(watchos, tvos)
-
-#define FILEPROVIDER_CLASS_AVAILABILITY API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
+// original API
+#define FILEPROVIDER_API_AVAILABILITY_V1 API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
+// original API that made it to macOS
+#define FILEPROVIDER_API_AVAILABILITY_V1_V2_V3 API_AVAILABLE(ios(8.0), macos(11.0)) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(watchos, tvos)
+// iOS API with file enumeration
 #define FILEPROVIDER_API_AVAILABILITY_V2 API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, macCatalyst) API_UNAVAILABLE(watchos, tvos)
-
-#define FILEPROVIDER_API_AVAILABILITY_V3 API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macos, macCatalyst)
-#define FILEPROVIDER_API_DEPRECATED_V3(message) API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(tvos, watchos) API_UNAVAILABLE(macos, macCatalyst)
-
-#else
-// This file intentionally left blank.
-#endif
+// iOS API with file enumeration and macOS API with FPFS
+#define FILEPROVIDER_API_AVAILABILITY_V2_V3 API_AVAILABLE(ios(11.0), macos(11.0)) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(watchos, tvos)
+// macOS API with FPFS
+#define FILEPROVIDER_API_AVAILABILITY_V3 API_AVAILABLE(macos(11.0)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
+// macOS API with first revision of FPFS
+#define FILEPROVIDER_API_AVAILABILITY_V3_1 API_AVAILABLE(macos(11.3)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
+// macOS API with second revision of FPFS
+#define FILEPROVIDER_API_AVAILABILITY_V4_0 API_AVAILABLE(macos(12.0)) API_UNAVAILABLE(watchos, tvos) API_UNAVAILABLE(ios, macCatalyst)
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h	2021-03-16 08:41:13.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h	2021-06-02 12:47:29.000000000 -0400
@@ -2,7 +2,7 @@
 //  NSFileProviderDomain.h
 //  FileProvider
 //
-//  Copyright © 2017 Apple Inc. All rights reserved.
+//  Copyright © 2017-2020 Apple Inc. All rights reserved.
 //
 
 #import <Foundation/Foundation.h>
@@ -11,9 +11,62 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSString *NSFileProviderDomainIdentifier NS_EXTENSIBLE_STRING_ENUM;
 
 /**
+ File provider domain version.
+
+ This object can be used by the `NSFileProviderReplicatedExtension` to describe the
+ current version of the domain. This object is immutable and can safely be used as
+ a key in a dictionary.
+ */
+FILEPROVIDER_API_AVAILABILITY_V3_1
+@interface NSFileProviderDomainVersion : NSObject <NSSecureCoding>
+
+/** Build a version that is strictly greater than the receiver.
+ */
+- (NSFileProviderDomainVersion *)next;
+
+/** Compare two domain versions.
+
+ This returns the NSComparisonResult of the comparison of the receiver and the
+ other version:
+  - NSOrderedAscending if the receiver predates the otherVersion
+  - NSOrderedDescending if the otherVersion predates the receiver
+  - NSOrderedSame if both versions are equal
+
+ In Swift, NSFileProviderDomainVersion is comparable.
+ */
+- (NSComparisonResult)compare:(NSFileProviderDomainVersion *)otherVersion NS_REFINED_FOR_SWIFT;
+
+@end
+
+/** Testing modes.
+ */
+FILEPROVIDER_API_AVAILABILITY_V3_1
+typedef NS_OPTIONS(NSUInteger, NSFileProviderDomainTestingModes) {
+    /** Enable the domain without any user action required.
+     */
+    NSFileProviderDomainTestingModeAlwaysEnabled = 1 << 0,
+
+    /** Enable interactive mode.
+
+     Disable the automatic scheduling from the system and allow external tools to
+     control the execution of operations.
+
+     When manual scheduling is enabled, an external tool should use
+     -[NSFileProviderManager listAvailableTestingOperationsWithError:] and
+     -[NSFileProviderManager runTestingOperations:error:] to control the system.
+
+     If that mode is enabled, some crash recovery guarantees are lost. For instance,
+     the system may lose any event that hasn't been ingested. The system does not
+     support removing this mode from a domain on which it has been enabled.
+     */
+    NSFileProviderDomainTestingModeInteractive = 1 << 1
+} NS_SWIFT_NAME(NSFileProviderDomain.TestingModes);
+
+/**
  File provider domain.
 
  A file provider domain can be used to represent accounts or different locations
@@ -33,14 +86,14 @@
  common directory. That directory path is indicated by the
  @p pathRelativeToDocumentStorage property.
  */
-FILEPROVIDER_API_AVAILABILITY_V2
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @interface NSFileProviderDomain : NSObject
 
 /**
  Initialize a new NSFileProviderDomain
 
  The file provider extension implementation can pick any @c identifier as it sees
- fit to identify the group of items.
+ fit to identify the group of items. The identifier must not contain any characters from this set: [/:]
 
  @param displayName a user visible string representing the group of items the
  file provider extension is using.
@@ -48,7 +101,18 @@
  @param pathRelativeToDocumentStorage a path relative to
  @c NSFileProviderExtension.documentStorageURL.
  */
-- (instancetype)initWithIdentifier:(NSFileProviderDomainIdentifier)identifier displayName:(NSString *)displayName pathRelativeToDocumentStorage:(NSString *)pathRelativeToDocumentStorage;
+- (instancetype)initWithIdentifier:(NSFileProviderDomainIdentifier)identifier displayName:(NSString *)displayName pathRelativeToDocumentStorage:(NSString *)pathRelativeToDocumentStorage FILEPROVIDER_API_AVAILABILITY_V2;
+
+/**
+ Initialize a new NSFileProviderDomain
+
+ The file provider extension implementation can pick any @c identifier as it sees
+ fit to identify the group of items. The identifier must not contain any characters from this set: [/:]
+
+ @param displayName a user visible string representing the group of items the
+ file provider extension is using.
+ */
+- (instancetype)initWithIdentifier:(NSFileProviderDomainIdentifier)identifier displayName:(NSString *)displayName FILEPROVIDER_API_AVAILABILITY_V3;
 
 /**
  The identifier - as provided by the file provider extension.
@@ -64,7 +128,40 @@
  The path relative to the document storage of the file provider extension.
  Files belonging to this domains should be stored under this path.
  */
-@property (readonly, copy) NSString *pathRelativeToDocumentStorage;
+@property (readonly, copy) NSString *pathRelativeToDocumentStorage FILEPROVIDER_API_AVAILABILITY_V2;
+
+
+/** If set, the domain is present, but disconnected from its extension.
+ In this state, the user continues to be able to browse the domain's contents,
+ but the extension doesn't receive updates on modifications to the files, nor is
+ it consulted to update folder's contents.
+
+ The disconnected state can be modified on an existing domain via the disconnectWithReason method
+ on NSFileProviderManager.
+ */
+@property (readonly, getter=isDisconnected) BOOL disconnected FILEPROVIDER_API_AVAILABILITY_V3;
+
+/** If user has disabled this domain from Files.app on iOS or System Preferences on macOS, this will bet set
+ to NO.
+*/
+@property (readonly) BOOL userEnabled FILEPROVIDER_API_AVAILABILITY_V3;
+
+/** If this domain is not user visible.
+
+ Typically, this can be used for dry-run migration. The files are still on disk though.
+*/
+@property (readwrite, assign, getter=isHidden) BOOL hidden FILEPROVIDER_API_AVAILABILITY_V3;
+
+/** Testing modes.
+
+ Testing modes are exposed as a means for the provider to have more control over the system in
+ a testing environment. Enabling a testing mode alters the behavior of the system and enables
+ some APIs for that mode.
+
+ A process must have the com.apple.developer.fileprovider.testing-mode entitlement in order to
+ configure a domain with non-empty testing modes.
+ */
+@property (readwrite, assign) NSFileProviderDomainTestingModes testingModes FILEPROVIDER_API_AVAILABILITY_V3_1;
 
 @end
 
@@ -73,5 +170,16 @@
 @property(nonatomic, readonly, nullable) NSFileProviderDomain *domain;
 @end
 
+/** Posted when any domain changed.
+
+Interested client should then call `+[NSFileProviderManager getDomainsWithCompletionHandler:]` and see
+ what changed.
+
+ Note, this notification starts to be posted only after `+[NSFileProviderManager getDomainsWithCompletionHandler:]` is
+ called.
+ */
+FOUNDATION_EXPORT NSNotificationName const NSFileProviderDomainDidChange
+FILEPROVIDER_API_AVAILABILITY_V3;
+
 NS_ASSUME_NONNULL_END
 
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h	2021-03-16 08:41:13.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderEnumerating.h	2021-05-22 07:29:07.000000000 -0400
@@ -2,7 +2,7 @@
 //  NSFileProviderEnumerating.h
 //  FileProvider
 //
-//  Copyright (c) 2014-2017 Apple Inc. All rights reserved.
+//  Copyright (c) 2014-2020 Apple Inc. All rights reserved.
 //
 
 #import <FileProvider/NSFileProviderExtension.h>
@@ -19,6 +19,7 @@
 
  The size of a sync anchor should not exceed a combined 500 bytes.
  */
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSData *NSFileProviderSyncAnchor NS_TYPED_EXTENSIBLE_ENUM;
 
 /**
@@ -28,13 +29,15 @@
 
  The size of a page should not exceed 500 bytes.
  */
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NSData *NSFileProviderPage NS_TYPED_EXTENSIBLE_ENUM;
 
-FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2
+FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2_V3
 NSFileProviderPage const NSFileProviderInitialPageSortedByDate;
-FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2
+FOUNDATION_EXPORT FILEPROVIDER_API_AVAILABILITY_V2_V3
 NSFileProviderPage const NSFileProviderInitialPageSortedByName;
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderEnumerationObserver <NSObject>
 
 - (void)didEnumerateItems:(NSArray <id<NSFileProviderItem>> *)updatedItems;
@@ -51,8 +54,23 @@
  */
 - (void)finishEnumeratingUpToPage:(nullable NSFileProviderPage)nextPage NS_SWIFT_NAME(finishEnumerating(upTo:));
 - (void)finishEnumeratingWithError:(NSError *)error;
+
+@optional
+/**
+ Size of the page suggested by the system for better performance.
+
+ The system will set that property to the value it considers is best suited for the current enumeration. The
+ system can enumerate a container in various cases (container presenter in the UI, file opened in an application,
+ materialization of the folder by the system, ...). Each case has its own performance profile.
+
+ By taking into account the suggested size, the enumeration will guarantee the best user experience possible. The
+ system does not enforce the size of the page.
+ */
+@property (nonatomic, readonly) NSInteger suggestedPageSize FILEPROVIDER_API_AVAILABILITY_V3;
+
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderChangeObserver <NSObject>
 
 /**
@@ -92,9 +110,27 @@
  nil.
  */
 - (void)finishEnumeratingWithError:(NSError *)error;
-@end
 
+@optional
+/**
+ Size of the batch suggested by the system for better performance.
+
+ The system will set that property to the value it considers is best suited for the current enumeration. The
+ system can enumerate changes on a container in various cases (container presenter in the UI, file opened in an
+ application, ...). Each case has its own performance profile.
+
+ In case the enumerator has already more than suggestedBatchSize pending changes ready to enumerate, it is suggested
+ it split the list of changes into several batches. If the enumerator does not have suggestedBatchSize ready to
+ enumerator, the enumerator should finish immediately and not wait for more incoming changes to enumerate.
+
+ By taking into account the suggested size, the enumeration will guarantee the best user experience possible. The
+ system does not enforce the size of the batch.
+ */
+@property (nonatomic, readonly) NSInteger suggestedBatchSize FILEPROVIDER_API_AVAILABILITY_V3;
+
+@end
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderEnumerator <NSObject>
 
 - (void)invalidate;
@@ -153,15 +189,13 @@
  - continue enumerating pages, each time from the page returned in the previous
    enumeration, until finishEnumeratingUpToPage: is called with nextPage set to
    nil
- - enumerate changes starting from the sync anchor returned in (1)
- - continue enumerating changes, each time from the sync anchor returned in the
-   previous enumeration, until finishEnumeratingChangesUpToSyncAnchor: is called
-   with moreComing:NO
-
- This method will be called again if you signal that there are more changes with
- -[NSFileProviderManager signalEnumeratorForContainerItemIdentifier:
- completionHandler:] and again, the system will enumerate changes until
- finishEnumeratingChangesUpToSyncAnchor: is called with moreComing:NO.
+ - enumerate changes starting from the sync anchor returned in (1), until
+   finishEnumeratingChangesUpToSyncAnchor: is called with the latest sync anchor.
+   If moreComing is YES, continue enumerating changes, using the latest sync anchor returned.
+   If moreComing is NO, stop enumerating.
+ - When the extension calls -[NSFileProviderManager signalEnumeratorForContainerItemIdentifier:
+   completionHandler:] to signal more changes, the system will again enumerate changes,
+   starting at the latest known sync anchor from finishEnumeratingChangesUpToSyncAnchor.
 
  NOTE that the change-based observation methods are marked optional for historical
  reasons, but are really required. System performance will be severely degraded if
@@ -172,6 +206,7 @@
 
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (NSFileProviderEnumeration)
 
 /**
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h	2021-03-16 08:47:53.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderError.h	2021-06-02 12:47:29.000000000 -0400
@@ -2,7 +2,7 @@
 //  NSFileProviderError.h
 //  FileProvider
 //
-//  Copyright (c) 2014-2017 Apple Inc. All rights reserved.
+//  Copyright (c) 2014-2020 Apple Inc. All rights reserved.
 //
 
 #import <FileProvider/NSFileProviderDefines.h>
@@ -11,10 +11,12 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-FOUNDATION_EXPORT NSErrorDomain const NSFileProviderErrorDomain FILEPROVIDER_API_AVAILABILITY_V2;
+FOUNDATION_EXPORT NSErrorDomain const NSFileProviderErrorDomain FILEPROVIDER_API_AVAILABILITY_V2_V3;
+
+FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorCollidingItemKey API_DEPRECATED("NSFileProviderErrorItemKey", ios(8.0, 13.0)) API_UNAVAILABLE(macos, tvos, watchos) API_UNAVAILABLE(macCatalyst);
+FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorItemKey API_AVAILABLE(ios(13.0), macos(10.15)) API_UNAVAILABLE(macCatalyst) API_UNAVAILABLE(watchos, tvos);
+FOUNDATION_EXPORT NSErrorUserInfoKey const NSFileProviderErrorNonExistentItemIdentifierKey FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
-FOUNDATION_EXPORT NSString * const NSFileProviderErrorCollidingItemKey API_DEPRECATED("NSFileProviderErrorItemKey", ios(8.0, 13.0)) API_UNAVAILABLE(macos, tvos, watchos);
-FOUNDATION_EXPORT NSString * const NSFileProviderErrorNonExistentItemIdentifierKey FILEPROVIDER_API_AVAILABILITY_V2;
 
 typedef NS_ERROR_ENUM(NSFileProviderErrorDomain, NSFileProviderErrorCode) {
     /** The user credentials cannot be verified */
@@ -46,12 +48,85 @@
      */
     NSFileProviderErrorNoSuchItem        = -1005,
 
-} FILEPROVIDER_API_AVAILABILITY_V2;
+    /** The provider disallowed the deletion of the item.
 
-@interface NSError (NSFileProviderError)
-+ (instancetype)fileProviderErrorForCollisionWithItem:(NSFileProviderItem)existingItem FILEPROVIDER_API_AVAILABILITY_V2;
-+ (instancetype)fileProviderErrorForNonExistentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier FILEPROVIDER_API_AVAILABILITY_V2;
+     \note Please use -[NSError (NSFileProviderError) fileProviderErrorForRejectedDeletionOfItem:] to build an error with this code.
+     \see -[NSError (NSFileProviderError) fileProviderErrorForRejectedDeletionOfItem:]
+     */
+    NSFileProviderErrorDeletionRejected FILEPROVIDER_API_AVAILABILITY_V3 = -1006,
+
+    /** We're trying to non-recursively delete a non-empty directory
+     */
+    NSFileProviderErrorDirectoryNotEmpty FILEPROVIDER_API_AVAILABILITY_V3 = -1007,
+
+    /**
+     Returned by NSFileProviderManager if no provider could be found in the application
+     */
+    NSFileProviderErrorProviderNotFound FILEPROVIDER_API_AVAILABILITY_V3 = -2001,
+
+    /**
+     Returned by NSFileProviderManager if the application's provider has been disabled due to app translocation
+     */
+    NSFileProviderErrorProviderTranslocated FILEPROVIDER_API_AVAILABILITY_V3 = -2002,
+
+    /**
+     Returned by NSFileProviderManager if the provider registered in the system is an older version than the one corresponding to this app.
+     */
+    NSFileProviderErrorOlderExtensionVersionRunning FILEPROVIDER_API_AVAILABILITY_V3 = -2003,
 
+    /**
+     Returned by NSFileProviderManager if the provider registered in the system is a newer version than the one corresponding to this app.
+     */
+    NSFileProviderErrorNewerExtensionVersionFound FILEPROVIDER_API_AVAILABILITY_V3 = -2004,
+
+    /**
+     Indicates that synchronization cannot happen.
+
+     This error can be returned by the provider or the system.
+
+     This is returned by NSFileProviderManager if a barrier failed for a sync-related error.
+
+     If the failure is caused by a specific item, the NSFileProviderErrorItemKey will be set to the corresponding item identifier
+     and the NSUnderlyingErrorKey will be set to the error encountered by that item.
+
+     When a provider returns that error, it means the syncing an item is definitively broken, and cannot be resolved without an update of
+     either the provider or the system.
+     */
+    NSFileProviderErrorCannotSynchronize FILEPROVIDER_API_AVAILABILITY_V3 = -2005,
+
+    /**
+    Returned by NSFileProviderManager if directory eviction failed because the target contains non-evictable items.
+
+    -[NSError underlyingErrors] is set to an array of the underlying errors. Each one has NSURLErrorKey set
+    to identify the particular file or directory affected by this error. The number of reported failing items is capped to an
+    implementation-defined number.
+
+    + domain: NSFileProviderErrorDomain errorCode: NSFileProviderErrorUnsyncedEdits error: if the item had unsynced content.
+    + domain: NSFileProviderErrorDomain errorCode: NSFileProviderErrorNonEvictable error: if the item has been marked as non-purgeable by the provider.
+    + domain: NSPOSIXErrorDomain errorCode: EBUSY - if the item had open file descriptors on it.
+    + domain: NSPOSIXErrorDomain errorCode: EMLINK : if the item had several hardlinks.
+    */
+    NSFileProviderErrorNonEvictableChildren API_AVAILABLE(macos(11.3)) = -2006,
+
+    /**
+     Returned by NSFileProviderManager if item eviction is failing because the item has edits that have not been synced yet
+
+     The NSURLErrorKey will be set to with the item URL that has unsynced content.
+    */
+    NSFileProviderErrorUnsyncedEdits API_AVAILABLE(macos(11.3)) = -2007,
+
+    /**
+     Returned by NSFileProviderManager if item eviction is failing because the item has not been assigned the evictable capability.
+
+     The NSURLErrorKey will be set to with the corresponding item URL.
+    */
+    NSFileProviderErrorNonEvictable API_AVAILABLE(macos(11.3)) = -2008,
+} FILEPROVIDER_API_AVAILABILITY_V2_V3;
+
+@interface NSError (NSFileProviderError)
++ (instancetype)fileProviderErrorForCollisionWithItem:(NSFileProviderItem)existingItem FILEPROVIDER_API_AVAILABILITY_V2_V3;
++ (instancetype)fileProviderErrorForNonExistentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier FILEPROVIDER_API_AVAILABILITY_V2_V3;
++ (instancetype)fileProviderErrorForRejectedDeletionOfItem:(NSFileProviderItem)updatedVersion NS_SWIFT_NAME(fileProviderErrorForRejectedDeletion(of:)) FILEPROVIDER_API_AVAILABILITY_V3;
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h	2021-03-16 08:47:53.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderExtension.h	2021-06-02 12:44:31.000000000 -0400
@@ -1,7 +1,7 @@
 //
 //  NSFileProviderExtension.h
 //
-//  Copyright (c) 2014-2017 Apple Inc. All rights reserved.
+//  Copyright (c) 2014-2020 Apple Inc. All rights reserved.
 //
 #import <Foundation/Foundation.h>
 #import <FileProvider/NSFileProviderDefines.h>
@@ -11,7 +11,7 @@
 
 @class NSFileProviderDomain;
 
-FILEPROVIDER_CLASS_AVAILABILITY
+FILEPROVIDER_API_AVAILABILITY_V1
 @interface NSFileProviderExtension : NSObject
 
 - (nullable NSFileProviderItem)itemForIdentifier:(NSFileProviderItemIdentifier)identifier error:(NSError * _Nullable *)error NS_SWIFT_NAME(item(for:)) FILEPROVIDER_API_AVAILABILITY_V2;
@@ -59,9 +59,9 @@
  */
 - (void)itemChangedAtURL:(NSURL *)url;
 
-
 @end
 
+FILEPROVIDER_API_AVAILABILITY_V2
 @interface NSFileProviderExtension (Deprecated)
 
 /**
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-03-16 08:45:01.000000000 -0400
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItem.h	2021-06-02 12:44:31.000000000 -0400
@@ -2,7 +2,7 @@
 //  NSFileProviderItem.h
 //  FileProvider
 //
-//  Copyright (c) 2016-2017 Apple Inc. All rights reserved.
+//  Copyright (c) 2016-2020 Apple Inc. All rights reserved.
 //
 
 #import <FileProvider/NSFileProviderDefines.h>
@@ -12,13 +12,14 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+FILEPROVIDER_API_AVAILABILITY_V1_V2_V3
 typedef NSString *NSFileProviderItemIdentifier NS_EXTENSIBLE_STRING_ENUM;
 
 /**
  The root of the hierarchical enumeration, i.e the container enumerated when the
  user starts browsing your file provider.
  */
-FOUNDATION_EXPORT NSFileProviderItemIdentifier const NSFileProviderRootContainerItemIdentifier NS_SWIFT_NAME(NSFileProviderItemIdentifier.rootContainer) FILEPROVIDER_API_AVAILABILITY_V2;
+FOUNDATION_EXPORT NSFileProviderItemIdentifier const NSFileProviderRootContainerItemIdentifier NS_SWIFT_NAME(NSFileProviderItemIdentifier.rootContainer) FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
 /**
  The item identifier of the working set, a synthetic container used by the
@@ -39,16 +40,75 @@
  remote changes.  When an item in the working set is remotely modified, the
  extension calls -signalEnumeratorForContainerItemIdentifier: on the identifier
  of the working set; the system will then enumerate changes and update its caches.
+
+ Starting in iOS 12 and macOS 10.15, the system maintains a cache on the local
+ file system of files and directories previously enumerated.  The working set
+ is the container used to update that set of files.  The extension may know
+ whether an item is in that set by checking whether its parentItemIdentifier
+ is listed in the materialized containers, see the documentation on
+ -materializedItemsDidChangeWithCompletionHandler:.
+ */
+FOUNDATION_EXPORT NSFileProviderItemIdentifier const NSFileProviderWorkingSetContainerItemIdentifier NS_SWIFT_NAME(NSFileProviderItemIdentifier.workingSet) FILEPROVIDER_API_AVAILABILITY_V2_V3;
+
+/**
+ The container containing all the trashed items.
+
+ When an item is trashed, its `parentItemIdentifier` becomes `NSFileProviderTrashContainerItemIdentifier`.
+
+ Extension should be able to return all trashed items by supporting the creation of a NSFileProviderEnumerator
+ for the trashed items.
+ */
+FOUNDATION_EXPORT NSFileProviderItemIdentifier const NSFileProviderTrashContainerItemIdentifier NS_SWIFT_NAME(NSFileProviderItemIdentifier.trashContainer) FILEPROVIDER_API_AVAILABILITY_V3;
+
+FILEPROVIDER_API_AVAILABILITY_V3
+@interface NSFileProviderItemVersion : NSObject
+
+/**
+ Items versions have two distinct components, one for the file contents and one
+ for metadata.
+
+ Components are limited to 128 bytes in size.
  */
-FOUNDATION_EXPORT NSFileProviderItemIdentifier const NSFileProviderWorkingSetContainerItemIdentifier NS_SWIFT_NAME(NSFileProviderItemIdentifier.workingSet) FILEPROVIDER_API_AVAILABILITY_V2;
+- (instancetype)initWithContentVersion:(NSData *)contentVersion
+                       metadataVersion:(NSData *)metadataVersion;
+
+/**
+ Version data for the content of the file.
+ 
+ This property is used by the system for two purposes: if the contentVersion changes,
+ - the system assumes that the contents have changed and will trigger a redownload if
+   necessary. The exception to this is the case where the extension accepts a content
+   sent by the system when replying to a createItemBasedOnTemplate or modifyItem call
+   with shouldFetchContent set to NO.
+ - the thumbnail cache is invalidated
+
+ Note that the resource fork of the file is considered content, so this version
+ data should change when either the data fork or the resource fork changes.
+ */
+@property (nonatomic, readonly) NSData *contentVersion;
+
+/**
+ Version data for the metadata of the item, i.e everything but the data fork and
+ the resource fork.
+ 
+ The system will store this version, but otherwise ignore it:
+ - metadata changes on an item will be applied even if the metadataVersion remains unchanged
+ - if the metadata version changes without any corresponding observable changes in the metadata returned
+   to the system, the system will simply store the updated metadata version (to return it as the base version
+   of a possible future change request).
+ */
+@property (nonatomic, readonly) NSData *metadataVersion;
+
+@end
 
 
 /**
  A special value for favorite ranks, to use when no rank was set when the item
  was favorited.
  */
-FOUNDATION_EXPORT unsigned long long const NSFileProviderFavoriteRankUnranked FILEPROVIDER_API_AVAILABILITY_V2;
+FOUNDATION_EXPORT unsigned long long const NSFileProviderFavoriteRankUnranked FILEPROVIDER_API_AVAILABILITY_V2_V3;
 
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 typedef NS_OPTIONS(NSUInteger, NSFileProviderItemCapabilities) {
     /**
      Indicates that the file can be opened for reading.  If set on a folder
@@ -75,6 +135,32 @@
     NSFileProviderItemCapabilitiesAllowsDeleting    = 1 << 5,
 
     /**
+     Indicates that the item can be evicted.
+
+     If this capability is set on an item, the item will become evictable when the item is fully uploaded
+     (-[NSFileProviderItem isUploaded] not implemented or set to YES), is not actively used and contains no
+     local changes. The eviction can happen either because the user selected the "Remove Download" option
+     in Finder, because the provider decided to evict the item using `-[NSFileProviderManager evictItemWithIdentifier:completionHandler:]`,
+     or because the system ran into a low-disk space scenario.
+
+     If this capability is not present, the item will never be evicted.
+     If the provider wishes to only suppress the user's ability to evict the item in the UI (but retain the ability
+     of the OS or the provider's program to evict items), the provider can set the following key to false in
+     their Info.plist, in the NSExtension section: NSExtensionFileProviderAllowsUserControlledEviction
+     */
+    NSFileProviderItemCapabilitiesAllowsEvicting FILEPROVIDER_API_AVAILABILITY_V3 = 1 << 6,
+
+    /**
+     Indicates that the item can be excluded from sync.
+
+     The user can choose to exclude the item in the UI (Finder), in which case the system will stop
+     monitoring changes for the item and its children and will remove the item from the provider.
+
+     This capability can be used to allow an item to be excluded from sync.
+     */
+    NSFileProviderItemCapabilitiesAllowsExcludingFromSync FILEPROVIDER_API_AVAILABILITY_V3_1 = 1 << 7,
+
+    /**
      Indicates that items can be imported to the folder. If set on a file,
      this is equivalent to @c .allowsWriting.
      */
@@ -86,7 +172,7 @@
      */
     NSFileProviderItemCapabilitiesAllowsContentEnumerating = NSFileProviderItemCapabilitiesAllowsReading,
 
-    NSFileProviderItemCapabilitiesAllowsAll =
+    NSFileProviderItemCapabilitiesAllowsAll API_DEPRECATED("This capability is no longer supported, and does not contain all capabilities. Please migrate to directly specifying each of the individual capabilities that should be allowed for the item.", ios(11.0, 15.0), macos(11.0, 12.0)) =
           NSFileProviderItemCapabilitiesAllowsReading
         | NSFileProviderItemCapabilitiesAllowsWriting
         | NSFileProviderItemCapabilitiesAllowsReparenting
@@ -95,8 +181,49 @@
         | NSFileProviderItemCapabilitiesAllowsDeleting
 };
 
+FILEPROVIDER_API_AVAILABILITY_V3
+typedef NS_OPTIONS(NSUInteger, NSFileProviderFileSystemFlags) {
+    /// Item has the POSIX user-executable (u+x) permission.
+    NSFileProviderFileSystemUserExecutable      = 1 << 0,
+
+    /// Item has the POSIX user-readable (u+r) permission.
+    NSFileProviderFileSystemUserReadable        = 1 << 1,
+
+    /// Item has the POSIX user-writable (u+w) permission.
+    NSFileProviderFileSystemUserWritable        = 1 << 2,
+
+    /// Item should not be presented in the file viewers.
+    ///
+    /// This includes both the UF_HIDDEN BSD flag and the Invisible bit from the
+    /// FinderInfo. When syncing down, the system only sets the UF_HIDDEN
+    /// flag.
+    NSFileProviderFileSystemHidden              = 1 << 3,
+
+    /// The extension of the item should not be presented in the file viewers.
+    NSFileProviderFileSystemPathExtensionHidden = 1 << 4,
+};
+
+FILEPROVIDER_API_AVAILABILITY_V4_0
+typedef struct NSFileProviderTypeAndCreator {
+    /**
+     The first word of the FinderInfo structure. It matches the file type code
+     */
+    OSType type;
+    /**
+     The second word of the FinderInfo structure. It matches the creator code
+     */
+    OSType creator;
+} NSFileProviderTypeAndCreator;
+
+FILEPROVIDER_API_AVAILABILITY_V2_V3
 @protocol NSFileProviderItem <NSObject>
 
+/**
+ The identifier of the item.
+
+ The itemIdentifier should not contain sensitive information, as it may be recorded in system logs and
+ diagnostic files.
+ */
 @property (nonatomic, readonly, copy) NSFileProviderItemIdentifier itemIdentifier;
 
 /**
@@ -117,6 +244,10 @@
 
 /**
  The file or directory name, complete with its file extension.
+
+ The filename property must not be an empty string, including when the item identifier is
+ NSFileProviderRootContainerItemIdentifier. The filename for NSFileProviderRootContainerItemIdentifier
+ may be displayed in the user interface. Therefore it should be a user-friendly string.
  */
 @property (nonatomic, readonly, copy) NSString *filename;
 
@@ -125,32 +256,107 @@
 /**
  ContentType (UTType) for the item.
 
- An item should implement at least one of typeIdentifier and contentType. Note
- that typeIdentifier is required on iOS 13 and earlier.
+ On macOS, items must implement contentType.
+
+ On iOS, items must implement either contentType or typeIdentifier. Note
+ that contentType is not available on iOS 13 and earlier, so typeIdentifier
+ is required in order to target iOS 13 and earlier.
+
+ Changing the contentType for a given item that would result in a transition to/from a folder
+ or to/from a symlink is not supported.
  */
 @property (nonatomic, readonly, copy) UTType *contentType API_AVAILABLE(ios(14.0), macos(11.0));
 
 /**
  Uniform type identifier (UTI) for the item.
 
- An item should implement at least one of typeIdentifier and contentType. Note
- that typeIdentifier is required on iOS 13 and earlier.
+ This property is deprecated in favor of the "contentType" property.
+
+ On macOS, typeIdentifier is not available. Items must implement contentType
+ on macOS.
+
+ On iOS, items must implement either contentType or typeIdentifier. Note
+ that contentType is not available on iOS 13 and earlier, so typeIdentifier
+ is required in order to target iOS 13 and earlier.
  */
 @property (nonatomic, readonly, copy) NSString *typeIdentifier
-    API_DEPRECATED_WITH_REPLACEMENT("contentType", ios(11.0, API_TO_BE_DEPRECATED))
+    API_DEPRECATED_WITH_REPLACEMENT("contentType", ios(11.0, 15.0))
     API_UNAVAILABLE(macos);
 
 /**
+ File type and creator code for the item.
+
+ This property contains two variables, one for the file type code and one for the creator code.
+ Both will be synchronized at the same time, so you have to define both when changing one.
+
+ On change on this structure, the NSFileProviderItemTypeAndCreator field will be set in the
+ NSFileProviderItemFields argument to createItem/modifyItem.
+
+ These will be written down in the FinderInfo structure if relevant.
+ */
+@property (nonatomic, readonly) NSFileProviderTypeAndCreator typeAndCreator FILEPROVIDER_API_AVAILABILITY_V4_0;
+
+/**
  The capabilities of the item.  This controls the list of actions that the UI
  will allow for the item.
+
+ Capabilities on an item only apply to the item itself. They are not inherited by the children of directories.
  */
 @property (nonatomic, readonly) NSFileProviderItemCapabilities capabilities;
 
+/**
+ File System level flags.
+
+ This includes POSIX permissions and presentation options for the item.
+
+ Prior to macOS 11.3, fileSystemFlags are not honored for directories.
+ */
+@property (nonatomic, readonly) NSFileProviderFileSystemFlags fileSystemFlags FILEPROVIDER_API_AVAILABILITY_V3;
+
 @property (nonatomic, readonly, copy, nullable) NSNumber *documentSize;
 @property (nonatomic, readonly, copy, nullable) NSNumber *childItemCount;
 @property (nonatomic, readonly, copy, nullable) NSDate *creationDate;
 @property (nonatomic, readonly, copy, nullable) NSDate *contentModificationDate;
 
+/**
+ Syncable extended attributes on the file.
+
+ The system decides which extended attributes should be synced from the device,
+ based on a set of rules largely inferred from the name of the extended
+ attribute.  Extended attributes named with xattr_name_with_flags(XATTR_FLAG_SYNCABLE)
+ will be listed in this dictionary; some extended attributes introduced before
+ this API are also whitelisted for sync. The provider can declare of list of
+ attributes it wants to sync even if the system heuristic won't consider those
+ as syncable. For this, it can add a list of xattr names in the Info.plist of the
+ extension under the key NSExtensionFileProviderAdditionalSyncableExtendedAttributes.
+
+ Syncable xattrs are capped in size to about 32KiB total for a given item.
+ When the set of extended attributes on a file is larger than that, the system
+ demotes some of the extended attributes to non-syncable.
+
+ The system decides which non-syncable extended attributes should be preserved
+ locally when the item is updated remotely, based on a set of rules again largely
+ inferred from the name of the extended attribute.  Extended attributes named
+ with xattr_name_with_flags(XATTR_FLAG_CONTENT_DEPENDENT) will be preserved only
+ if itemVersion.contentVersion was not modified by the remote update.
+
+ Some NSFileProviderItem properties (lastUsedDate, tagData...) happen to be
+ stored on disk in extended attributes that won't be listed in this dictionary
+ because that would be redundant.  The 32 bits of Finder info in the extended
+ attribute named XATTR_FINDERINFO_NAME ("com.apple.FinderInfo") is not listed
+ here for the same reason: the syncable Finder info bits are deserialized to
+ other properties of NSFileProviderItem.
+
+ The system will set extended attributes on dataless files, and will preserve
+ them when a file is rendered dataless.  I.e extended attributes are considered
+ metadata, not content.  The resource fork however is considered content and
+ will not be included in this dictionary.  Local changes to the resource fork
+ will be communicated under NSFileProviderItemContents.  Remote changes to
+ the resource fork should bump itemVersion.contentVersion.
+ */
+@property (nonatomic, readonly, strong) NSDictionary <NSString *, NSData *> *extendedAttributes FILEPROVIDER_API_AVAILABILITY_V3;
+
+
 /*
  The three properties below (lastUsedDate, tagData and favoriteRank) are
  indications that the item is part of the working set.
@@ -193,7 +399,7 @@
 
  This property must not be shared between users, even if the item is.
  */
-@property (nonatomic, readonly, copy, nullable) NSNumber *favoriteRank;
+@property (nonatomic, readonly, copy, nullable) NSNumber *favoriteRank FILEPROVIDER_API_AVAILABILITY_V2;
 
 /**
  Set on a directory or a document if it should appear in the trash.
@@ -203,12 +409,20 @@
 
  Trashed items should remain in the working set; however, children of trashed
  directories should be removed from the working set.
+
+ Additionally, when an item is trashed, the `parentItemIdentifier` refers to the location the item was before being
+ trashed. As such, when the user decides to restore the item from trash, `parentItemIdentifier` will be used for
+ the default restore location.
  */
-@property (nonatomic, readonly, getter=isTrashed) BOOL trashed;
+@property (nonatomic, readonly, getter=isTrashed) BOOL trashed FILEPROVIDER_API_AVAILABILITY_V2;
 
-/*
- The download and upload properties below determine which of the cloud badges
- (uploading, downloading, pending) will be shown on the item.
+/**
+ Uploaded and uploading are used to inform the cloud badge which will be shown on the item.
+
+ When using NSFileProviderReplicatedExtension, uploaded is used to inform whether the item may be
+ evicted from the local disk. If you choose to finish uploading items after calling the completion handler
+ of creteItem/modifyItem, you must set the uploaded flag to false, in order for the item to be excluded from
+ eviction.
  */
 @property (nonatomic, readonly, getter=isUploaded) BOOL uploaded;
 @property (nonatomic, readonly, getter=isUploading) BOOL uploading;
@@ -225,8 +439,19 @@
  */
 @property (nonatomic, readonly, copy, nullable) NSError *uploadingError;
 
+/**
+ When using NSFileProviderExtension, downloaded and downloading are used to inform the cloud badge
+ which will be shown on the item.
+
+ When using NSFileProviderReplicatedExtension, downloaded and downloading are ignored, as they can be
+ inferred from the result of calls to fetchContentsForItemWithIdentifier.
+ */
 @property (nonatomic, readonly, getter=isDownloaded) BOOL downloaded;
 @property (nonatomic, readonly, getter=isDownloading) BOOL downloading;
+
+/**
+ An error that occurred while downloading from your remote server.
+ */
 @property (nonatomic, readonly, copy, nullable) NSError *downloadingError;
 
 @property (nonatomic, readonly, getter=isMostRecentVersionDownloaded) BOOL mostRecentVersionDownloaded;
@@ -246,12 +471,52 @@
  A content hash would be a reasonable choice.
 
  Version identifiers are limited to 1000 bytes.
+
+ This property is deprecated in favor of the "itemVersion" property.
  */
-@property (nonatomic, strong, readonly, nullable) NSData *versionIdentifier;
+@property (nonatomic, strong, readonly, nullable) NSData *versionIdentifier API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos, watchos) API_UNAVAILABLE(macos);
 
 /**
- Use this dictionary to add state information to the item. It is accessible to
- FileProviderUI action predicates and user interaction predicates [1].
+ The version is used to track which version of an item has been modified when informing a provider about changes. It is also used to invalidate the thumbnail cache.
+ */
+@property (nonatomic, strong, readonly) NSFileProviderItemVersion *itemVersion FILEPROVIDER_API_AVAILABILITY_V3;
+
+/**
+ The target of a symlink.
+
+ If a replicated extension expose an item with the contentType public.symlink (UTTypeSymbolicLink),
+ this field should contain the target of the symlink.
+ */
+@property (nonatomic, readonly, copy, nullable) NSString *symlinkTargetPath
+    FILEPROVIDER_API_AVAILABILITY_V3;
+
+/**
+ Use this dictionary to add state information to the item. Entries are accessible to
+ FileProviderUI and non-UI action predicates and user interaction predicates [1] via the
+ `userInfo` context key.
+
+ Additionally, any entry of this dictionary with a key ending in `.inherited`
+ will be accessible to predicates for descendants of this item via the context key `inheritedUserInfo`.
+
+ Items can redefine inherited values for their descendants by specifying the same key used in an ancestor's `userInfo`.
+ Thus, `inheritedUserInfo` for a given item is a dictionary of `*.inherited` keys from all if its ancestors, with each value
+ taken from the nearest ancestor that has the entry defined.
+
+ In this example directory structure:
+ root
+ |_ parent
+   |_ child
+     |_ grandchild
+
+ with the following userInfo values set:
+ parent.userInfo = { "a.inherited": YES, "b.inherited": YES }
+ child.userInfo = { "a.inherited": NO, "c.inherited": NO }
+ grandchild.userInfo = { }
+
+ the following inheritedUserInfo values will be provided:
+ parent.inheritedUserInfo = { }
+ child.inheritedUserInfo = { "a.inherited": YES, "b.inherited": YES }
+ grandchild.inheritedUserInfo = { "a.inherited": NO, "b.inherited": YES, "c.inherited": NO }
 
  All values for this dictionary must be of type String, Number, Bool or Date.
 
@@ -261,20 +526,30 @@
     - `ActivationRule ` *string*, the predicate.
         @parameters predicates
             - `destinationItem`: the destination item for an action (only present for Move/Import)
-            - `destinationItemHierarchy` : represents destinationItem and all its parent chain to allow for search
-                on first item in hierarchy that has a given value. (only present for Move/ImportHere)
             - `action` : the action that is being performed
-                 'Move'       : moving items within the same provider
-                 'Export'     : moving items out of the provider
-                 'ImportHere' : importing item(s) into a folder/root of the provider
+                 'Move'       : moving item(s) within the same provider
+                 'MoveOut'    : moving item(s) out of the provider
+                 'MoveIn'     : importing item(s) into a folder/root of the provider
+                 'Copy'       : copying item(s) within the same provider
+                 'CopyOut'    : copying item(s) out of the provider
+                 'CopyIn'     : copying item(s) into a folder/root of the provider
                  'Trash'      : trashing item(s)
+                 'Create'      : creating an item (available in macOS 12.0 and later)
+                            The Create action will be evaluated when the user creates a new file
+                            or folder in a system Open/Save panel.
+                            The sourceItem is the file/folder being created. The only field that is
+                            populated for this item is the filename. The type of file/folder, size, etc,
+                            are unknown at Create evaluation time.
+                            The destinationItem is the directory which the file/folder is being created
+                            within.
                  'Delete'     : deleting item(s)
-            - `sourceItem` : current item that the predicate is evaluating (only present for Move/Export)
-            - `sourceItemHierarchy` : represents sourceItem and all its parent chain to allow for search
-                on first item in hierarchy that has a given value. (only present for Move/Export)
+                 'ExcludeFromSync' : deleting items(s) because the user chose to exclude those from sync (available in macOS 11.3 and later)
+                 'Rename'  : renaming item(s) (available in macOS 11.3 and later)
+            - `sourceItem` : current item that the predicate is evaluating
             - `sourceItemsCount` :
                 - In userInteraction, represents the count of sourceItems of an action operation
                 - In subUserInteraction: represents the count of items that matched the previous predicate
+            - `domainUserInfo`: The latest dictionary returned from -[NSFileProviderDomainState userInfo]
     - `Alert` *dictionary*
         - `LocalizedTitle` *string*, title of the alert
         - `LocalizedSubTitle` *string*, sub title of the alert
@@ -290,12 +565,26 @@
         - `RecoveryOptions` (optional)
             - `Continue` *bool*, the boolean for whether to have a continue button - default value is YES if not specified
             - `Destructive` *bool*, the boolean for whether continuing is a destructive action - default value is NO if not specified
+    - `HelpURL` *string*: If present, a help button will be displayed on the Alert that is shown. If the user
+                   clicks the help button, this help URL will be opened. (available in macOS 12.0 and later)
     - `SubInteractions `: *dictionary* (same as `NSFileProviderUserInteractions`)
+    - `SupressionIdentifier` *string*: If present, when this predicate matches, the alert will display an option to
+                           suppress future alerts from UserInteractions with the same
+                           SuppressionIdentifier (including the current UserInteraction). This also
+                           requires implementing the `NSFileProviderUserInteractionSuppressing`
+                           protocol on the principal class of the FileProvider extension (available in
+                           macOS 12.0 and later).
 
  For each interaction, either Alert or SubInteractions must be specified. SubInteractions will be evaluated if the main ActivationRule evaluates to
  YES for at least once. This allows you to match a general pattern via the top-level activation rule and then select a specialized error message from a list
  of subpatterns.
 
+ At most one UserInteraction alert will be shown for each FileProvider domain involved in the user's Action. For
+ instance, if provider A defines a UserInteraction for MoveOut actions, and provider B defines a UserInteraction
+ for MoveIn operations. When the user moves a file from A to B, and the predicate for both UserInteraction
+ matches, then both of the UserInteraction alerts will be shown to the user. However, as soon as the user
+ denies any of the alerts, the remainder will not be shown, and the action will be denied.
+
  Here is a sample extension Info.plist:
 

@@ -386,7 +675,7 @@

@end

+FILEPROVIDER_API_AVAILABILITY_V2_V3 typedef id NSFileProviderItem;

NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h 1969-12-31 19:00:00.000000000 -0500 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderItemDecoration.h 2021-05-22 07:29:07.000000000 -0400 @@ -0,0 +1,72 @@ +// +// NSFileProviderItemDecoration.h +// FileProvider +// +// Copyright © 2019-2020 Apple Inc. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <FileProvider/NSFileProviderDefines.h> +#import <FileProvider/NSFileProviderItem.h> + +FILEPROVIDER_API_AVAILABILITY_V3 +typedef NSString NSFileProviderItemDecorationIdentifier NS_TYPED_EXTENSIBLE_ENUM; + +/*

  • Decorations are defined in the extension's Info.plist by adding a
  • NSFileProviderDecorations key with one or many entries to the NSExtension dictionary.
  • NSFileProviderDecorations
  •   <dict>
    
  •   	<key>Identifier</key>
    
  •   	<string>$(PRODUCT_BUNDLE_IDENTIFIER).hasComments</string>
    
  •   	<key>BadgeImageType</key>
    
  •   	<string>com.someone.item.decoration.unreadCommentIcon</string>
    
  •   	<key>Category</key>
    
  •   	<string>Badge</string>
    
  •   	<key>LocalizedTitle</key>
    
  •   	<dict>
    
  •   		<key>NSStringFormat</key>
    
  •   		<string>%@ unread comments</string>
    
  •   		<key>NSStringFormatValues</key>
    
  •   		<array>
    
  •   			<string>item.userInfo.unreadCommentCount</string>
    
  •   		</array>
    
  •   	</dict>
    
  •   </dict>
    
  • The keys for each entry are defined as follows:
  • Key | Property
  • ---------------|----------
  • Identifier | The identifier used to refer to this decoration in the item definition (as type NSFileProviderItemDecorationIdentifier).
  • BadgeImageType | The overlay UTI (see below)
  • Label | A localizable title, to be used in detail views, on mouse over and for voice over
  • Category | The position of the decoration: one of 'Badge', 'Sharing', or 'FolderBadge'
  • At rendering time, the icon for the UTI specified by 'BadgeImageType' will be looked up.
  • The UTI must conform to 'com.apple.icon-decoration.badge'.
  • Decorations from different categories are presented in different places in the UI.
  • Note that regardless of the dictionary key used for the visual decoration, the Label key will be used for mouse over / voice over.
  • Category | Location
  • -------------|----------
  • Badge | On top of the icon. The decoration is an image, taken from the BadgeImageType key. Only the first badge is displayed.
  • Sharing | Adjacent to the icon. The decoration is a string, taken from the Label key. Only the first label is displayed.
  • FolderBadge | Embossed on top of the folder icon. The image from the BadgeImageType key will be embossed. Only the first badge is displayed. Only valid for folders.

+*/ + +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderItemDecorating +/**

  • Returns an array of decorations for the item.
  • To adopt this protocol, implement the -decorations method on your NSFileProviderItem to return valid decoration identifiers
  • from your Info.plist.
  • */
  • @property (nonatomic, nullable, readonly, strong) NSArray *decorations; +@end diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h 2021-03-16 08:47:53.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderManager.h 2021-06-02 12:44:31.000000000 -0400 @@ -2,23 +2,48 @@ // NSFileProviderManager.h // FileProvider // -// Copyright (c) 2016-2017 Apple Inc. All rights reserved. +// Copyright (c) 2016-2020 Apple Inc. All rights reserved. //

#import <FileProvider/NSFileProviderDefines.h> #import <FileProvider/NSFileProviderItem.h> #import <FileProvider/NSFileProviderDomain.h> +#import <FileProvider/NSFileProviderEnumerating.h>

NS_ASSUME_NONNULL_BEGIN

@class NSURLSessionTask; @class NSFileProviderDomain; +@class NSFileProviderRequest;

+typedef NS_ENUM(NSInteger, NSFileProviderDomainRemovalMode) {

  • /// Don't keep any files that are current in the domain
  • NSFileProviderDomainRemovalModeRemoveAll = 0,
  • /// Delete the domain from the system but keeps the at least all the
  • /// dirty corresponding user data around.
  • NSFileProviderDomainRemovalModePreserveDirtyUserData = 1,
  • /// Delete the domain from the system but keeps all the downloaded
  • /// corresponding user data around.
  • NSFileProviderDomainRemovalModePreserveDownloadedUserData = 2, +} NS_SWIFT_NAME(NSFileProviderManager.DomainRemovalMode) FILEPROVIDER_API_AVAILABILITY_V4_0;

/** The file provider manager allows you to communicate with the file provider

  • framework for purposes that may be relevant from both the extension and
  • the containing application (or sibling extensions).
  • framework from both the extension and related processes.

  • NSFileProviderManager can be used from the following processes:

    • the extension
    • the main app containing the extension
    • sibling extensions to the extension
    • executables contained in the main app bundle (on macOS only)
  • Executables contained in the main app bundle need to have a bundle identifier that is

  • prefixed by the bundle identifier of the main app (note that this is generally required

  • for extensions). They must also have access to the document group defined for the provider

  • (via its NSExtensionFileProviderDocumentGroup key).

    The file provider framework will invoke your file provider extension in response to those calls if appropriate. @@ -26,7 +51,7 @@ The class also provides methods to manage provider domains. Each domain has a corresponding manager. */ -FILEPROVIDER_API_AVAILABILITY_V2 +FILEPROVIDER_API_AVAILABILITY_V2_V3 @interface NSFileProviderManager : NSObject

  • (instancetype)init NS_UNAVAILABLE; @@ -71,6 +96,36 @@
  • (void)signalEnumeratorForContainerItemIdentifier:(NSFileProviderItemIdentifier)containerItemIdentifier completionHandler:(void (^)(NSError * __nullable error))completion NS_SWIFT_NAME(signalEnumerator(for:completionHandler:));

/**

  • Return the user visible URL for an item identifier.
  • The caller must use file coordination (see NSFileCoordinator) if it wishes to read the
  • content or list the children of the URL. The caller should not try to manipulate files
  • in the user visible location. All changes coming from the provider should go through
  • updates in the working set that will be applied to the user visible items by the
  • system.
  • The location may differ from the logical parentURL/filename.
  • If an item on disk cannot be assigned the requested name (e.g. because the local
  • file system has different case collision rules from the provider), one of the items can be assigned
  • a different local name. In that case, the "com.apple.fileprovider.before-bounce#P" extended
  • attribute will contain the filename before collision resolution.
  • This attribute is only set if the item has been assigned a different local name following
  • a collision. Such local names are not synced up to the provider; the purpose of the attribute is
  • to enable consistency checkers to detect this case.
  • */ +- (void)getUserVisibleURLForItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier completionHandler:(void (^)(NSURL * __nullable userVisibleFile, NSError * __nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3 NS_SWIFT_NAME(getUserVisibleURL(for:completionHandler:));

+/**

  • Return the identifier and domain for a user visible URL.
  • This method returns the identifier and domain of a user visible URL if
  • applicable. Calling this method on a file which doesn't reside in your
  • provider/domain, or which hasn't yet been assigned an identifier by
  • the provider will return the Cocoa error NSFileNoSuchFileError.
  • */ ++ (void)getIdentifierForUserVisibleFileAtURL:(NSURL *)url completionHandler:(void (^)(NSFileProviderItemIdentifier __nullable itemIdentifier, NSFileProviderDomainIdentifier __nullable domainIdentifier, NSError * __nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3;

+/** Registers the given NSURLSessionTask to be responsible for the specified item. A given item can only have one task registered at a time. The task must be suspended at the time of calling. @@ -78,13 +133,16 @@ */

  • (void)registerURLSessionTask:(NSURLSessionTask *)task forItemWithIdentifier:(NSFileProviderItemIdentifier)identifier completionHandler:(void (^)(NSError * __nullable error))completion;

/** The purpose identifier of your file provider extension. A coordination using a file coordinator with this purpose identifier set will not trigger your file provider extension. You can use this to e.g. perform speculative work on behalf of the file provider from the main app. */ -@property(nonatomic, readonly) NSString *providerIdentifier; +@property(nonatomic, readonly) NSString *providerIdentifier FILEPROVIDER_API_AVAILABILITY_V2;

/** The root URL for provided documents. This URL is derived by consulting the @@ -95,7 +153,23 @@ If the NSExtensionFileProviderDocumentGroup property is not set, calling this method will result in an error. */ -@property(nonatomic, readonly) NSURL documentStorageURL; +@property(nonatomic, readonly) NSURL documentStorageURL FILEPROVIDER_API_AVAILABILITY_V2; + +/

  • A temporary directory suitable to store files that will be exchanged with the system.
  • The returned URL is guaranteed to be on the same volume as the user visible URL, making sure the system
  • can atomatically clone/move files from that location to the user visible URL. The provider can also use
  • that directory as a target for moves and clones of content URL passed to createItemBasedOnTemplate
  • or modifyItem.
  • If the system cannot find a suitable directory, this calls will fail. This could happen e.g. if the domain
  • does not exist.
  • This call will not fail when called from the extension process with an active instance of the extension
  • for that domain.
  • */ +- (nullable NSURL *)temporaryDirectoryURLWithError:(NSError **)error FILEPROVIDER_API_AVAILABILITY_V3;

/** Writes out a placeholder at the specified URL. The placeholder is used in place @@ -119,13 +193,13 @@ */

  • (BOOL)writePlaceholderAtURL:(NSURL *)placeholderURL withMetadata:(NSFileProviderItem)metadata
  •                    error:(NSError **)error;
    
  •                    error:(NSError **)error FILEPROVIDER_API_AVAILABILITY_V2;
    

/** Returns the designated placeholder URL for a given file URL. Used in conjunction with writePlaceholderAtURL. */ -+ (NSURL *)placeholderURLForURL:(NSURL *)url; ++ (NSURL *)placeholderURLForURL:(NSURL *)url FILEPROVIDER_API_AVAILABILITY_V2;

/** Register a domain in which items can be stored. @@ -138,6 +212,11 @@

  • (void)removeDomain:(NSFileProviderDomain *)domain completionHandler:(void(^)(NSError *_Nullable error))completionHandler;

/**

  • Remove a domain with options
  • */ ++ (void)removeDomain:(NSFileProviderDomain *)domain mode:(NSFileProviderDomainRemovalMode)mode completionHandler:(void(^)(NSURL *_Nullable_result preservedLocation, NSError *_Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V4_0;

+/** Get all registered domains. */

  • (void)getDomainsWithCompletionHandler:(void (^)(NSArray<NSFileProviderDomain *> *domains, NSError * _Nullable error))completionHandler; @@ -147,6 +226,270 @@ */
  • (void)removeAllDomainsWithCompletionHandler:(void(^)(NSError *_Nullable error))completionHandler;

+/**

  • Cancel throttling applied by the system to any item because of that error.
  • This call supports 4 types of errors:
    • NSFileProviderErrorNotAuthenticated
    • NSFileProviderErrorInsufficientQuota
    • NSFileProviderErrorServerUnreachable
    • NSFileProviderErrorCannotSynchronize
  • */ +- (void)signalErrorResolved:(NSError *)error completionHandler:(void(^)(NSError *_Nullable error))completionHandler
  • FILEPROVIDER_API_AVAILABILITY_V3;

+/**

  • Returns the global progress for the specified kind of operations
  • This progress tracks all the ongoing kind of operations (from disk to the provider).
  • Uploading operations are the operations from disk to the provider.
  • Downloading operations are the operations from the provider to the disk.
  • The global progress exposes the two following data:
    • Number of items with an ongoing matching kind operation along with the grand total;
    • Number of bytes already transfered along with the total amount of bytes to transfer.
  • The grand total will only be reset to 0 when there are no operations left. If new operations of the matching kind arrive while
  • the global progress is already ongoing, they will just be summed to the existing global progress.
  • By default, when no matching kind operations are active, the progress has its values set to 1 and its state set to finished.
  • The progress will be updated on the main queue. It is to be retained by the caller and to be observed through KVO.
  • The two only supported values for kind are:
    • NSProgressFileOperationKindUploading
    • NSProgressFileOperationKindDownloading
  • The returned progress will have its fileOperationKind property set.
  • */ +- (NSProgress *)globalProgressForKind:(NSProgressFileOperationKind)kind NS_SWIFT_NAME(globalProgress(for:)) FILEPROVIDER_API_AVAILABILITY_V3_1;

+@end + +/** Posted when the materialized set has changed. +

  • Interested clients can then use the materialized set enumerator returned by -enumeratorForMaterializedItems to enumerate changes on the materialized set.
  • Note, this notification starts to be posted only after +[NSFileProviderManager getDomainsWithCompletionHandler:] is called.
  • */

+FOUNDATION_EXPORT NSNotificationName const NSFileProviderMaterializedSetDidChange +FILEPROVIDER_API_AVAILABILITY_V3_1; + +@interface NSFileProviderManager (MaterializedSet) + +/**

  • Returns an enumerator for the set of materialized items.
  • When calling -[NSFileProviderEnumerator enumerateItemsForObserver:startingAtPage:] on the returned
  • enumerator, pass the result of [NSData new] as the starting page. The sorting page constants
  • (NSFileProviderInitialPageSortedByName and NSFileProviderInitialPageSortedByDate) will not influence
  • the order of the items enumerated from the materialized set.
  • This enumerator is unlike other enumerators because the roles of the system
  • and the app/extension are reversed:
    • The system enumerates the working set after the extension calls
  • 'signalEnumeratorForContainerItemIdentifier';
    • The app/extension enumerates the materialized set after the system calls
  • 'materializedItemsDidChangeWithCompletionHandler'.
  • */ +- (id)enumeratorForMaterializedItems FILEPROVIDER_API_AVAILABILITY_V3;

+@end + +/** Posted when the pending set has changed. +

  • Interested clients can then use the pending set enumerator returned by -enumeratorForPendingItems to enumerate changes on the pending set.
  • Note, this notification starts to be posted only after +[NSFileProviderManager getDomainsWithCompletionHandler:] is called.
  • */ +FOUNDATION_EXPORT NSNotificationName const NSFileProviderPendingSetDidChange +FILEPROVIDER_API_AVAILABILITY_V3_1;

+FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderPendingSetEnumerator + +/**

  • The version of the domain when the pending set was last refreshed by the system.
  • This property is updated when the enumeration methods are called on the pending set enumerator. The value
  • is initially nil.
  • */ +@property (nonatomic, readonly, nullable) NSFileProviderDomainVersion *domainVersion;

+/**

  • The amount of time in seconds at which the pending set is refreshed on modifications.
  • */ +@property (nonatomic, readonly) NSTimeInterval refreshInterval;

+@end + +@interface NSFileProviderManager (PendingSet) + +/**

  • Returns an enumerator for the set of pending items.
  • This enumerator behaves like the materialized set enumerator.
  • On later modifications in the set, the system will call
  • 'pendingItemsDidChangeWithCompletionHandler'.
  • */ +- (id)enumeratorForPendingItems FILEPROVIDER_API_AVAILABILITY_V3_1;

+@end + +@interface NSFileProviderManager (Import) + +/** Request the creation of a new domain that will take ownership of on-disk data that

  • were previously managed without a file provider.
  • You can use this method in order to migrate from a software that managed a file hierarchy
  • on disk to a NSFileProviderExtension without having to redownload the data that was
  • already on disk.
  • The URL is expected to point to a directory. That directory will be moved away, its
  • ownership being taken by the system. From this point, your extension's
  • createItemFromTemplate method will be called for every item found in the directory
  • with the special NSFileProviderCreateItemMayAlreadyExist option.
  • In case a domain with the same name already exists in the file provider manager, the
  • call will fail with the code NSFileWriteFileExistsError. The URL will remain untouched.
  • In case the system does not allow the extension to request a migration, the call will
  • fail with NSFeatureUnsupportedError.
  • In case of success, the URL will become invalid and the domain will be created. The
  • completion handler is called as soon as the domain is created. Your provider will
  • receive calls to createItemBasedOnTemplate afterward.
  • When the import of the file hierarchy is finished, the system calls
  • -[NSFileProviderExtension signalDidFinishImportingItemsFromDiskWithCompletionHandler:].
  • In case -[NSFileProviderManager reimportItemsBelowItemWithIdentifier:completionHandler:]
  • is called before the end of the import, a single call to importDidFinishWithCompletionHandler
  • will be received for both the import and the scan.
  • */ ++ (void)importDomain:(NSFileProviderDomain *)domain fromDirectoryAtURL:(NSURL *)url completionHandler:(void(^)(NSError * _Nullable error))completionHandler
  • FILEPROVIDER_API_AVAILABILITY_V3;

+/** Notify the system that the itemIdentifiers known by the system are not valid anymore. +

  • This can be called by an extension in case it has lost track of its synchronisation state
  • and as a consequence is not able to guarantee the stability of the itemIdentifiers anymore.
  • In that case, the system will trigger a scan of any data that is cached on disk and call
  • createItemBasedOnTemplate with the special NSFileProviderCreateItemMayAlreadyExist
  • option so that the extension can specify the new itemIdentifier for those items. The provided
  • item identifier is inclusive, meaning the specified item will be re-import as well as any
  • children in case it is a container.
  • In case the extension has lost its synchronisation state but is still able to guarantee the
  • stability of the itemIdentifiers, it should make sure that querying the working set
  • enumerator with an anchor that predates the synchronisation loss will cause a
  • NSFileProviderErrorSyncAnchorExpired error.
  • In case the extension has lost its synchronisation state and is not interested in preserving
  • the data cached on disk, it can remove and re-add the affected domain.
  • The completion handler is called immediately and does not reflect the end of the import.
  • When the import of the file hierarchy is finished, the system calls
  • -[NSFileProviderExtension importDidFinishWithCompletionHandler:].
  • If this method succeeds, the system will reimport at least the requested sub-tree, but may
  • import more.
  • If the requested item has no on-disk representation, the completion handler will be called with
  • a NSFileProviderErrorNoSuchItem error.
  • */ +- (void)reimportItemsBelowItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •                       completionHandler:(void (^)(NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(reimportItems(below:completionHandler:))
  • FILEPROVIDER_API_AVAILABILITY_V3;

+@end + +@interface NSFileProviderManager (Eviction) + +/**

  • Request that the system remove an item from its cache.
  • When called on a file, the file will be made dataless.
  • When called on a directory, first each of the directory's children will be evicted (child files are made
  • dataless, child directories are recursively evicted). Then the directory itself will be made dataless.
  • If a non-evictable child is encountered, eviction will stop immediately and the completionHandler will be called with
  • the NSFileProviderErrorNonEvictableChildren error. The error will include information on why and which
  • children could not be evicted in -[NSError underlyingErrors].
  • The materialization state of the remaining items may be either materialized or evicted, depending on the traversal order.
  • The completion handler is called after the items have been evicted from disk or immediately when an error occurs.
  • Eviction might fail with the following errors :
    • NSFileProviderErrorDomain.NSFileProviderErrorUnsyncedEdits if the item had non-uploaded changes.
    • NSFileProviderErrorDomain.NSFileProviderErrorNonEvictable if the item has been marked as non-purgeable by the provider.
    • NSPOSIXErrorDomain.EBUSY : if the item has open file descriptors on it.
    • NSPOSIXErrorDomain.EMLINK : if the item has several hardlinks.
    • other NSPOSIXErrorDomain error codes if the system was unable to access or manipulate the corresponding file.
  • */ +- (void)evictItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •          completionHandler:(void (^)(NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(evictItem(identifier:completionHandler:))
  • FILEPROVIDER_API_AVAILABILITY_V3;

+@end + +@interface NSFileProviderManager (Barrier) + +/**

  • Wait for all changes on disk in the sub-hierarchy of the item to be acknowledged by the extension.
  • This call can be used to guarantee operation ordering in a sub-hierarchy of the provider. The completion
  • handler is called when all the changes for descendents of the item have been acknowledged by the extension.
  • If any error is met during that process, an error will be raised, in which case the caller should not
  • assume all the changes have been received.
  • This call will only wait for changes affecting items that were already descendents of the requested item
  • in the provider, or items that have been newly created on disk. It will not wait for items that are already
  • known from the provider and are being moved in the directory. As a consequence, that call can be used from within a call
  • to -[NSFileProviderReplicatedExtension modifyItem:baseVersion:changedFields:contents:options:completionHandler:].
  • Also note that the call will return immediately on items that are not directories.
  • In case a change cannot be applied to the provider, the call will fail with NSFileProviderErrorCannotSynchronize
  • including the NSFileProviderErrorItemKey with the identifier of the item that could not be synced if that item
  • is known by the provider.
  • */ +- (void)waitForChangesOnItemsBelowItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •                               completionHandler:(void (^)(NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(waitForChanges(below:completionHandler:))
  • FILEPROVIDER_API_AVAILABILITY_V3; +@end

+@interface NSFileProviderManager (Stabilization) + +/**

  • Wait for stabilization of the domain.
  • The system will wait until it is caught up with the file system's changes up to
  • the time of the call, then wait until it is caught up with the provider's changes up to
  • the time of the call.
  • The completion handler is called when both sets of changes are caught up to at least the time
  • of the call. This is useful to enforce a consistent state for testing.
  • */ +- (void)waitForStabilizationWithCompletionHandler:(void(^)(NSError * _Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3; +@end

+typedef NS_OPTIONS(NSUInteger, NSFileProviderManagerDisconnectionOptions) {

  • /*
  • A temporary disconnection would be used during e.g. an update; a non-temporary disconnection would be used in preparation of a log-out.
    
  • */
    
  • NSFileProviderManagerDisconnectionOptionsTemporary = 1 << 0, +} FILEPROVIDER_API_AVAILABILITY_V3 NS_SWIFT_NAME(NSFileProviderManager.DisconnectionOptions);

+@interface NSFileProviderManager (Disconnection) +- (void)disconnectWithReason:(NSString *)localizedReason

  •                 options:(NSFileProviderManagerDisconnectionOptions)options
    
  •       completionHandler:(void(^)(NSError * _Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3
    
  • NS_SWIFT_NAME(disconnect(reason:options:completionHandler:));

+- (void)reconnectWithCompletionHandler:(void(^)(NSError * _Nullable error))completionHandler FILEPROVIDER_API_AVAILABILITY_V3; @end

NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h 1969-12-31 19:00:00.000000000 -0500 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderReplicatedExtension.h 2021-05-22 08:31:34.000000000 -0400 @@ -0,0 +1,1042 @@ +// +// NSFileProviderReplicatedExtension.h +// +// Copyright © 2019-2020 Apple Inc. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <CoreGraphics/CoreGraphics.h> +#import <FileProvider/NSFileProviderDefines.h> +#import <FileProvider/NSFileProviderItem.h> +#import <FileProvider/NSFileProviderExtension.h> +#import <FileProvider/NSFileProviderEnumerating.h> +#import <FileProvider/NSFileProviderService.h> +#import <FileProvider/NSFileProviderActions.h> +#import <FileProvider/NSFileProviderRequest.h> + +NS_ASSUME_NONNULL_BEGIN + +@class NSFileProviderDomain; + +#pragma mark - Options + +/**

  • Options passed on item creation.
  • */ +typedef NS_OPTIONS(NSUInteger, NSFileProviderCreateItemOptions) {
  • /**
  • The imported item may already exists.
    
  • This can happen because:
    
  • 1. The imported item was found on disk after the synchronisation state was
    
  • lost, for example following the restoration of a backup, or the migration
    
  • to a new device.
    
  • 2. Two directories are merged together. Each child resulting of the merge
    
  • may be recreated with the mayAlreadyExist option. This allows the
    
  • extension to recursively merge directories.
    
  • The Extension should assess whether the item could actually be a disk
    
  • representation of an already existing item.
    
  • Since this can happens when the system has to reimport all the existing
    
  • item from disk, it is advised that the assessment method avoids
    
  • computational intensive tasks, such as checksumming the item.
    
  • When all the items pending reimport have been processed, the system
    
  • will call -[NSFileProviderExtension importDidFinishWithCompletionHandler:].
    
  • */
    
  • NSFileProviderCreateItemMayAlreadyExist = 1 << 0,
  • /**
  • The deletion from the disk of an item conflicted.
    
  • If the provider declares that an item has been deleted but the deletion of the
    
  • item by the system on disk conflicts with local edits of the item, the system will
    
  • attempt to create the edited item by calling createItemBasedOnTemplate with this
    
  • option specified.
    
  • */
    
  • NSFileProviderCreateItemDeletionConflicted FILEPROVIDER_API_AVAILABILITY_V3_1 = 1 << 1, +} FILEPROVIDER_API_AVAILABILITY_V3;

+/**

  • Options passed on item deletion.
  • */ +typedef NS_OPTIONS(NSUInteger, NSFileProviderDeleteItemOptions) {
  • /**
  • The deletion of the item is recursive.
    
  • */
    
  • NSFileProviderDeleteItemRecursive = 1 << 0, +} FILEPROVIDER_API_AVAILABILITY_V3;

+typedef NS_OPTIONS(NSUInteger, NSFileProviderModifyItemOptions) {

  • /**
  • We're moving the item to a location where it may refer to an item that already exists. This may happen
    
  • when two directories are being merged together. When this happens some items may be merged to the
    
  • same directory and we end up in a situation where the merged contains may also exist.
    
  • This is similar to NSFileProviderCreateItemMayAlreadyExist
    
  • */
    
  • NSFileProviderModifyItemMayAlreadyExist = 1 << 0, +} FILEPROVIDER_API_AVAILABILITY_V3;

+/**

  • NSFileProviderItemContents corresponds to the item's contents.
  • Each subsequent field corresponds to a property on NSFileProviderItem that can
  • change.
  • */ +typedef NS_OPTIONS(NSUInteger, NSFileProviderItemFields) {
  • NSFileProviderItemContents = 1 << 0,
  • NSFileProviderItemFilename = 1 << 1,
  • NSFileProviderItemParentItemIdentifier = 1 << 2,
  • NSFileProviderItemLastUsedDate = 1 << 3,
  • NSFileProviderItemTagData = 1 << 4,
  • NSFileProviderItemFavoriteRank = 1 << 5,
  • NSFileProviderItemCreationDate = 1 << 6,
  • NSFileProviderItemContentModificationDate = 1 << 7,
  • NSFileProviderItemFileSystemFlags = 1 << 8,
  • NSFileProviderItemExtendedAttributes = 1 << 9,
  • NSFileProviderItemTypeAndCreator FILEPROVIDER_API_AVAILABILITY_V4_0 = 1 << 10, +} FILEPROVIDER_API_AVAILABILITY_V3;

+#pragma mark - Extension with FPFS support + +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderEnumerating + +/**

  • Create an enumerator for an item.
  • This method is called when the user lists the content of folder it never accessed
  • before. This can happen either when using Finder or when listing the content of
  • the directory from a Terminal (for instance using the ls command line tool). The
  • system will use the enumerator to list the children of the directory by calling
  • -[NSFileProviderEnumerator enumerateItemsForObserver:startingAtPage:] until nil
  • is passed to -[NSFileProviderEnumerationObserver finishEnumeratingUpToPage:].
  • Once this has been called, the directory and its children should be included in the
  • working set.
  • This is also used to subscribe to live updates for a single document.
  • The system will keep an enumerator open in the extension on directories that are
  • presented to the user (for instance, in Finder), and on document on which an application
  • has a NSFilePresenter. The provider can use the existence of that enumerator as a hint
  • that the user is actively seeing / using the item in question, and prioritize the delivery
  • of updates on the item or its children in the working set.
  • If returning nil, you must set the error out parameter.
  • Working set enumerator:

  • The working set enumerator is a special enumerator (NSFileProviderWorkingSetContainerItemIdentifier)
  • the system uses to detect changes that should be synced to the disk and/or searchable
  • in Spotlight. Because that enumerator is by definition used for change detection, the
  • working set enumerator must implement
  • -[NSFileProviderEnumerator enumerateChangesForObserver:fromSyncAnchor:] and
  • -[NSFileProviderEnumerator currentSyncAnchorWithCompletionHandler:].
  • The system guarantees that it has a single consumer for the working set. This means there
  • will never be two concurrent enumerations of the working set and will always do forward
  • progress: the system will only ask for changes from the last requested sync anchor or
  • the last returned sync anchor and the extension should be prepared for it.
  • The expiration of the sync anchor of the working set will cause a very expensive scan
  • of all the items known by the system.
  • The system ingests the changes from the working set and applies the changes to the
  • disk replicate and the spotlight index. Before ingesting the update for an item,
  • the system will check if the enumeration of the item races against a call to
  • createItemBasedOnTemplate, modifyItem, ... that may affect the item. If a potential race
  • is detected, the system will call itemForItemIdentifier in order to resolve the race.
  • If the provider exposes the key NSExtensionFileProviderAppliesChangesAtomically with value
  • YES in its Info.plist, it is considered to apply the changes atomically, in which case the
  • system does not need to check for potential races.
  • Error cases:

  • If containerItemIdentifier is NSFileProviderTrashContainerItemIdentifier and
  • the extension does not support trashing items, then it should fail the call
  • with the NSFeatureUnsupportedError error code from the NSCocoaErrorDomain
  • domain.
  • If the item requested containerItemIdentifier does not exist in the provider,
  • the extension should fail with NSFileProviderErrorNoSuchItem. In that case,
  • the system will consider the item has been deleted and attempt to delete the
  • item from disk.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,
  • NSFileProviderErrorServerUnreachable in case the item cannot be fetched
  • because of the current state of the system / domain. In that case, the
  • system will present an appropriate error message and back off until the
  • next time it is signalled.
  • Any other error will be considered to be transient and will cause the
  • enumeration to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • */ +- (nullable id)enumeratorForContainerItemIdentifier:(NSFileProviderItemIdentifier)containerItemIdentifier
  •                                                                  request:(NSFileProviderRequest *)request
    
  •                                                                    error:(NSError **)error
    
  • NS_SWIFT_NAME(enumerator(for:request:));

+@end + +/**

  • FileProvider extension for which the system replicates the content on disk.
  • The extension exposes a hierarchy of NSFileProviderItem instances that the system
  • will replicate on disk as a file hierarchy. The file hierarchy reflects the filename,
  • parent, content, and metadata described by the NSFileProviderItem. In case two items
  • are at the same disk location (same parent and filename), the system may choose to
  • "bounce" an item.
  • The system lazily replicates the item hierarchy: items are created "dataless" on disk
  • and the content (for files) or list of children (for folders) is fetched on first
  • access by calling fetchContentsForItemWithIdentifier, or enumeratorForContainerItemIdentifier.
  • The provider can notify the system of changes on the items by publishing those on the
  • enumerator for the working set. The system notifies the extension of changes made by the
  • user on disk by calling createItemBasedOnTemplate, modifyItem, or deleteItemWithIdentifier.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderReplicatedExtension <NSObject, NSFileProviderEnumerating>

+/**

  • Create a new instance of the replicated provider for the specified domain.
  • */ +- (instancetype)initWithDomain:(NSFileProviderDomain *)domain;

+/**

  • Called before the instance is discarded.
  • Several instances of a replicated provider can be hosted by the same process, either because
  • the user has several active domains, or because an instance got discarded and a new one
  • is created by the system. This method is called before an instance is discarded and should
  • make sure that all references to the instance are released so that the instance can be
  • deallocated.
  • */ +- (void)invalidate;

+/**

  • Fetch the metadata for the item with the provider identifier.
  • Error cases:

  • If the metadata lookup fails because the item is unknown, the call should
  • fail with the NSFileProviderErrorNoSuchItem error. In that case, the system
  • will consider the item has been removed from the domain and will attempt to
  • delete it from disk. In case that deletion fails because there are local
  • changes on this item, the system will re-create the item using createItemBasedOnTemplate.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,
  • NSFileProviderErrorServerUnreachable in case the item cannot be fetched
  • because of the current state of the system / domain. In that case, the
  • system will present an appropriate error message and back off until the
  • next time it is signalled.
  • Any other error will be considered to be transient and will cause the
  • lookup to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (nil, NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)itemForIdentifier:(NSFileProviderItemIdentifier)identifier
  •                      request:(NSFileProviderRequest *)request
    
  •            completionHandler:(void(^)(NSFileProviderItem _Nullable, NSError * _Nullable))completionHandler
    
  • NS_SWIFT_NAME(item(for:request:completionHandler:));

+/**

  • Download the item for the given identifier and return it via the completion handler.
  • The system learns of items through enumerations. Initially, this means that the
  • system is aware that an item (with a specific version) exists on the device.
  • When the user accesses the item, the system makes a request for the contents of
  • the item. The provider can then fulfill the request by providing the item.
  • The system takes ownership of the item and will move it out of the sandbox of
  • the provider.
  • If the provider wishes to force materialization of a given item, the provider should use the NSFileCoordinator
  • API to coordinate a read on the user visible URL of the item, retrieved using
  • -[NSFileProviderManager getUserVisibleURLForItemIdentifier:completionHandler:]
  • The requestedVersion parameter specifies which version should be returned. A nil value
  • means that the latest known version should be returned. Except for the error case, the
  • version of the returned item is assumed to be identical to what was requested.
  • requestedVersion is currently always set to nil.
  • Concurrent Downloads:

  • The system will call fetchContents concurrently if there are multiple outstanding file download requests.
  • The provider can control the concurrency by setting the key NSExtensionFileProviderDownloadPipelineDepth
  • in the Info.plist of the extension to the number of concurrent downloads that the system should create
  • per domain. This number must be between 1 and 128, inclusive.
  • File ownership:

  • The system clones and unlinks the received fileContents. The extension should not mutate the corresponding
  • file after calling the completion handler. If the extension wishes to keep a copy of the content, it must
  • provide a clone of the that content as the URL passed to the completion handler.
  • In case the extension or the system crashes between the moment the completion handler is called and the
  • moment the system unlinks the file, the file may unexpectedly still be on disk the next time an instance
  • of the extension is created. The extension is then responsible for deleting that file.
  • Disallowing processes from fetching items:

  • The system automatically downloads files on POSIX accesses. The extension may wish to disallow this class of
  • downloads for specific applications.
  • The extension can set an array of strings into the UserDefault key
  • "NSFileProviderExtensionNonMaterializingProcessNames". A process whose name is an exact match for an
  • entry in this array will not be allowed to fetch items in the extension's domains.
  • This list will not be checked for downloads requested through file coordination.
  • Error cases:

  • If the download fails because the item is unknown, the call should
  • fail with the NSFileProviderErrorNoSuchItem error. In that case, the system
  • will consider the item has been removed from the domain and will attempt to
  • delete it from disk. In case that deletion fails because there are local
  • changes on this item, the system will re-create the item using createItemBasedOnTemplate.
  • If the user does not have access to the content of the file, the provider
  • can fail the call with NSCocoaErrorDomain and code NSFileReadNoPermissionError.
  • That error will then be presented to the user. The extension can also report
  • the NSFileProviderErrorNotAuthenticated, NSFileProviderErrorServerUnreachable
  • in case the item cannot be fetched because of the current state of the system / domain.
  • In those cases, the system will present an appropriate error message and back off
  • until the next time it is signalled.
  • Any other error will be considered to be transient and will cause the
  • download to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (nil, nil, NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • The returned NSProgress is used to show progress to the user. If the user cancels the
  • fetch, the extension should stop fetching the item, as it is no longer required.
  • */ +- (NSProgress *)fetchContentsForItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •                                       version:(nullable NSFileProviderItemVersion *)requestedVersion
    
  •                                       request:(NSFileProviderRequest *)request
    
  •                             completionHandler:(void(^)(NSURL * _Nullable fileContents, NSFileProviderItem _Nullable item, NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(fetchContents(for:version:request:completionHandler:));

+/**

  • Create a new item.
  • The itemTemplate object describes the expected state of the newly created item,
  • including its location provided by parentItemIdentifier and filename. The list
  • of fields to conside in that object is defined by the fields parameter. Fields
  • not listed should be considered as not being defined.
  • The url is used to transfer the content of the file from the system to the
  • extension. It can be nil if the item has no content. This will be the case if
  • the item is a folder or if the item is being reimported (flag
  • NSFileProviderCreateItemMayAlreadyExist set) and the file is dataless on disk.
  • If the item is a symbolic link, the target path is provided by the symlinkTargetPath
  • of the itemTemplate.
  • The system is setting the itemIdentifier of the itemTemplate to a unique value that
  • is guaranteed to stay the same for a given item in case the creation is replayed
  • after a crash. That itemIdentifier is not intended to be the identifier assigned
  • to the item by the provider.
  • In the completion block, the createdItem is expected to reflect the properties of the
  • newly created item, which usually means matching the properties passed in by the
  • template. An exception is the itemIdentifier which should be the identifier assigned
  • to that item by the provider rather than the identifier passed in through the template.
  • If the provider reuses an existing identifier, the item that used that identifier will
  • be removed from disk, replaced by the createdItem. If the item is a directory, the two
  • directories will be merged and the items from the existing one will be modified with
  • the NSFileProviderModifyItemMayAlreadyExist option set.
  • If the provider is not able to apply all the fields at once, it should return a
  • set of stillPendingFields in its completion handler. In that case, the system will
  • attempt to modify the item later by calling modifyItem with those fields.
  • If a field in the returned createdItem does not match the itemTemplate, and is
  • not in the list of stillPendingFields, the value from the createdItem will be
  • propagated to the disk. If the content of the item as described by createdItem
  • does not match the content from url, the provider should set shouldFetchContent
  • in the completion handler. The content from the provider will then be fetched
  • and propagated to disk.
  • In case the deletion of an item from the working set could not be applied to the
  • disk by the system because it conflicted with a local edit of the file, the system
  • will attempt to create the edited item. In that case the creation call will receive
  • the NSFileProviderCreateItemDeletionConflicted option and the itemIdentifier in the
  • template will be set to the itemIdentifier of the item deleted from the working set.
  • The itemVersion will also be set to the last itemVersion of the item that was made
  • available on disk before the item was edited locally. If such a conflict happens
  • on a dataless item on disk, the item will be immediately deleted from the disk instead
  • of issuing a new creation.
  • In case the NSFileProviderCreateItemMayAlreadyExist option
  • is passed, the content may be nil if the item is found by the system without any
  • associated content. In that case, you should return a nil item if you are not
  • able to match the created item with an existing item from the provider.
  • In case of path collision with an already existing item, the provider
  • can either fail using -[NSError (NSFileProviderError) fileProviderErrorForCollisionWithItem:]
  • or resolve the collision by itself (e.g. by returning an item with a different name).
  • If the error is returned, the system will try to resolve the collision by itself by bouncing
  • away one of the items (renaming the item).
  • If the imported item is refused by the extension, it should return nil for the
  • createdItem without any error. In that case, the source item will be deleted
  • from disk. In case the item represents a directory, the content will be deleted
  • recursively. If the extension does not wish to synchronise the item, while still
  • keeping it on disk, it should still import it locally, but not sync it to its
  • server, and return a valid createItem object.
  • The progress returned by createItemBasedOnTemplate is expected to include the
  • upload progress of the item and will be presented in the user interface until
  • the completion handler is called.
  • Creation is gated by the NSFileProviderItemCapabilitiesAllowsAddingSubItems
  • capability on the parent folder on a UI level, but direct file system changes
  • (e.g. from Terminal) can still result in changes that must be handled.
  • Structural consistency:

  • The system guarantees that the creation is called after the creation of the
  • parent completed.
  • File ownership:

  • The file at url is owned by the system and is unlinked after the completion
  • handler is called. If the extension wishes to keep access to the content of
  • file after calling the completion handler, it should clone the file in its
  • container.
  • Atomicity:

  • By default, the system assumes all the changes are applied non-atomically, which
  • means that the change or an intermediary state from the change can be observed
  • (for instance while enumerating the working set) while the call is in progress
  • (before the completion handler is called). The provider can indicate to the system
  • that it applies changes atomically (that is, the change cannot be observed before
  • the completion handler is called) by setting the key NSExtensionFileProviderAppliesChangesAtomically
  • in the Info.plist of the extension to YES.
  • The atomicity declaration only describes the visibility of the changes, not
  • the ability of the provider to apply all the fields at once: a provider that applies
  • changes atomically might still apply a subset of the changedFields communicated
  • by the system and defer the remaining fields by setting the stillPendingFields
  • parameter in the completion handler.
  • Error cases:

  • If the creation fails because the target directory does not exist, the extension
  • must fail the creation using the NSFileProviderErrorNoSuchItem error code. In
  • that case, the system will attempt the re-create the parent directory.
  • In case the location of the new item is already in use by another item, the extension
  • can chose to either resolve the collision by moving one of the items
  • away, or reject the creation with the NSFileProviderErrorFilenameCollision
  • error code. In that error case, the system will be responsible for resolving the
  • collision, by renaming one of the colliding items. When the collision is resolved,
  • the system will call createItemBasedOnTemplate again.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,
  • NSFileProviderErrorServerUnreachable, NSFileProviderErrorInsufficientQuota
  • or NSFileProviderErrorCannotSynchronize in case the modification cannot be applied
  • because of the current state of the system / domain. In that case, the system will
  • present an appropriate error message and back off until the next time it is signalled.
  • The provider can signal the error resolution by calling signalErrorResolved:completionHandler:.
  • Any other error will be considered to be transient and will cause the
  • creation to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (nil, [], NO, NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)createItemBasedOnTemplate:(NSFileProviderItem)itemTemplate
  •                               fields:(NSFileProviderItemFields)fields
    
  •                             contents:(nullable NSURL *)url
    
  •                              options:(NSFileProviderCreateItemOptions)options
    
  •                              request:(NSFileProviderRequest *)request
    
  •                    completionHandler:(void (^)(NSFileProviderItem _Nullable createdItem,
    
  •                                                NSFileProviderItemFields stillPendingFields,
    
  •                                                BOOL shouldFetchContent,
    
  •                                                NSError * _Nullable error))completionHandler
    

+NS_SWIFT_NAME(createItem(basedOn:fields:contents:options:request:completionHandler:)); + +/**

  • Informs the provider that an item or its metadata have changed. More than one
  • property may have changed, e.g. an item may have been renamed, moved and also
  • changed contents, in which case changedFields might contain [.contents,
  • .filename, .parentItemIdentifier, .contentModificationDate].
  • If the provider is not able to apply all the fields at once, it should return a
  • set of stillPendingFields in its completion handler. In that case, the system will
  • attempt to modify the item later by calling modifyItem with those fields.
  • If a field in the returned item does not match the itemTemplate, and is
  • not in the list of stillPendingFields, the value from the item will be
  • propagated to the disk. In case there is a content change and the content of
  • the returned item as described by item does not match the content from url,
  • the provider should set shouldFetchContent in the completion handler. The
  • content from the provider will then be fetched and propagated to disk.
  • If the item modification results from the parent directory being merged into another
  • directory, the NSFileProviderModifyItemMayAlreadyExist flag will be passed
  • to the call.
  • The provider can chose to merge two existing items when receiving modifyItem. In that
  • case, the item returned should carry the itemIdentifier of the item with which the
  • item will be merged and well as the resulting state of that item. The system will then
  • keep one of the items (the one whose itemIdentifier was returned) and remove
  • the other one from disk. In case of directories, the content of the two directories
  • is merged and sub-items will be modified with the
  • NSFileProviderModifyItemMayAlreadyExist flag set.
  • If the extension wishes the modify item to cause the deletion of the item on disk,
  • it can call the completion handler with nil in place of the resulting item. If the
  • item is directory, the item will be kept on disk until all its children has been deleted
  • from the working set. The system will only apply the deletion on the disk if this
  • does not conflict with local edits. Otherwise, the system will attempt to re-create
  • the item with the NSFileProviderCreateItemDeletionConflicted option set.
  • The progress returned by modifyItem is expected to include the upload progress if any,
  • even if the provider chose to call the completion handler before the upload finishes.
  • For example, the provider might decide to call the completion handler as soon as the
  • metadata have been stored in a local database.
  • Modifications are gated by the corresponding capabilities of the item on a UI level,
  • but direct file system changes (e.g. from Terminal) can still result in changes that
  • must be handled.
  • Structural consistency and Cycle handling:

  • In case the parentItemIdentifier is modified, the system guarantees that the new
  • parent has been created and the creation completed before the call to modifyItem
  • is issued.
  • The system guarantees that modifyItem called after local changes from the user will
  • never create a cycle: that is all items will always be a descendent of either the
  • root item or the trash item.
  • However, cycles that are caused by concurrent local changes by the user and changes
  • on the remote server can also create cycles. This is handled by the system as a
  • conflict. This means the provider must validate that the call of modifyItem is not
  • creating a cycle with a change it observed from the server. If such a cycle is
  • detected, the provider must fix the conflict by breaking the cycle, and return the
  • state of the item after resolving that conflict. If the resolution affects other
  • items as well, updates for those other items must be published on the working set.
  • File ownership:

  • The file at url is owned by the system and is unlinked after the completion
  • handler is called. If the extension wishes to keep access to the content of
  • file after calling the completion handler, it should clone the file in its
  • container.
  • Atomicity:

  • By default, the system assumes all the changes are applied non-atomically, which
  • means that the change or an intermediary state from the change can be observed
  • (for instance while enumerating the working set) while the call is in progress
  • (before the completion handler is called). The provider can indicate to the system
  • that it applies changes atomically (that is, the change cannot be observed before
  • the completion handler is called) by setting the key NSExtensionFileProviderAppliesChangesAtomically
  • in the Info.plist of the extension to YES.
  • The atomicity declaration only describes the visibility of the changes, not
  • the ability of the provider to apply all the fields at once: a provider that applies
  • changes atomically might still apply a subset of the changedFields communicated
  • by the system and defer the remaining fields by setting the stillPendingFields
  • parameter in the completion handler.
  • Error cases:

  • The extension may fail the modification if the modified item does not exist
  • anymore. In that case, the extension should fail the call the
  • NSFileProviderErrorNoSuchItem error code. The system will attempt to delete
  • the item on disk. If the item on disk actually has changes since this call
  • to modifyItem, then it will be re-created by a call to createItemBasedOnTemplate.
  • Likewise, if the item is reparented to a parent that no longer exists, the extension
  • may return a NSFileProviderErrorNoSuchItem error with the parent item.
  • In case the modification updates the location of the item and another item is
  • already known at this location, the extension can chose to either resolve the
  • collision by moving one of the items away, or reject the modification with
  • the NSFileProviderErrorFilenameCollision error code. In that error case,
  • the system will be responsible for resolving the collision, by renaming one of
  • the colliding items. When the collision is resolved, the system will call
  • modifyItem again.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,
  • NSFileProviderErrorServerUnreachable, NSFileProviderErrorInsufficientQuota
  • or NSFileProviderErrorCannotSynchronize in case the modification cannot be applied
  • because of the current state of the system / domain. In that case, the system will
  • present an appropriate error message and back off until the next time it is signalled.
  • The provider can signal the error resolution by calling signalErrorResolved:completionHandler:.
  • Any other error will be considered to be transient and will cause the
  • modification to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (nil, [], NO, NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)modifyItem:(NSFileProviderItem)item
  •           baseVersion:(NSFileProviderItemVersion *)version
    
  •         changedFields:(NSFileProviderItemFields)changedFields
    
  •              contents:(nullable NSURL *)newContents
    
  •               options:(NSFileProviderModifyItemOptions)options
    
  •               request:(NSFileProviderRequest *)request
    
  •     completionHandler:(void(^)(NSFileProviderItem _Nullable item,
    
  •                                NSFileProviderItemFields stillPendingFields,
    
  •                                BOOL shouldFetchContent,
    
  •                                NSError * _Nullable error))completionHandler;
    

+/**

  • Delete an item forever.
  • This is called when the user deletes an item that was already in the Trash and
  • the item should no longer appear there after this call. This call should
  • remove the item from the working set.
  • This call receives an optional baseVersion which represent the version of the
  • item we are trying to delete.
  • Unless the NSFileProviderDeleteItemRecursive options is passed, the
  • deletion of a directory should be non-recursive. If the deletion is recursive
  • the provider should take care of reporting the deletion of all the deleted
  • items through the working set.
  • Delete is gated by the capabilities of the removed item with
  • NSFileProviderItemCapabilitiesAllowsDeleting.
  • Modifications are gated by NSFileProviderItemCapabilitiesAllowsDeleting
  • of the item on a UI level, but direct file system changes (e.g. from Terminal)
  • can still result in changes that must be handled.
  • Atomicity:

  • By default, the system assumes all the changes are applied non-atomically, which
  • means that the change or an intermediary state from the change can be observed
  • (for instance while enumerating the working set) while the call is in progress
  • (before the completion handler is called). The provider can indicate to the system
  • that it applies changes atomically (that is, the change cannot be observed before
  • the completion handler is called) by setting the key NSExtensionFileProviderAppliesChangesAtomically
  • in the Info.plist of the extension to YES.
  • Error cases:

  • The extension may fail the deletion in different scenarios, for instance because
  • the baseVersion is out of date or because the user does not have permissions to
  • delete the item. In that case the extension should fail the call with the
  • NSFileProviderErrorDeletionRejected error code which will cause the system to
  • re-create the deleted item on disk based on the latest metadata available from
  • the extension.
  • If the options don't include NSFileProviderDeleteItemRecursive and the
  • deletion targets a non-empty directory, the extension must reject the deletion
  • with the NSFileProviderErrorDirectoryNotEmpty error code. This error can also
  • be reported in case some children of the directory cannot be deleted when
  • receiving the NSFileProviderDeleteItemRecursive option. In both cases,
  • the system will re-create the deleted item on disk based on the latest metadata
  • available from the extension.
  • If the deletion targets an item that is unknown from the extension because
  • that item may have already been deleted remotely, then the extension should
  • report a success.
  • The extension can also report the NSFileProviderErrorNotAuthenticated,
  • NSFileProviderErrorServerUnreachable, or NSFileProviderErrorCannotSynchronize
  • in case the deletion cannot be applied because of the current state of the
  • system / domain. In that case, the system will present an appropriate error
  • message and back off until the next time it is signalled.
  • Any other error will be considered to be transient and will cause the
  • deletion to be retried.
  • Errors must be in one of the following domains: NSCocoaErrorDomain, NSFileProviderErrorDomain,
  • or NSPOSIXErrorDomain.
  • For errors which can not be represented using an existing error code in one of these domains, the extension
  • should construct an NSError with domain NSCocoaErrorDomain and code NSXPCConnectionReplyInvalid.
  • The extension should set the NSUnderlyingErrorKey in the NSError's userInfo to the error which could not
  • be represented.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)deleteItemWithIdentifier:(NSFileProviderItemIdentifier)identifier
  •                         baseVersion:(NSFileProviderItemVersion *)version
    
  •                             options:(NSFileProviderDeleteItemOptions)options
    
  •                             request:(NSFileProviderRequest *)request
    
  •                   completionHandler:(void (^)(NSError * _Nullable))completionHandler
    
  • NS_SWIFT_NAME(deleteItem(identifier:baseVersion:options:request:completionHandler:));

+#pragma mark - Optional selectors + +@optional + +/** Signal the end of import of on-disk items. +

  • This is called after an import of on-disk items has been triggered by either
  • -[NSFileProviderManager reimportItemsBelowItemWithIdentifier:completionHandler:] or
  • +[NSFileProviderManager importDomain:fromDirectoryAtURL:completionHandler:]. A
  • reimport can also be started by the system independently from any request by the
  • provider.
  • During import, found items will be created via the
  • -[NSFileProviderExtension createItemBasedOnTemplate:fields:contents:options:completionHandler:]
  • call with the NSFileProviderCreateItemMayAlreadyExist flag set.
  • At the end of an import the -[NSFileProviderExtension importDidFinishWithCompletionHandler:]
  • is called.
  • */ +- (void)importDidFinishWithCompletionHandler:(void (^)(void))completionHandler;

+/**

  • Called by the system if the set of materialized items changes.
  • Materialized items are items that have synced to disk and are not
  • dataless. They may contain a mix of dataless and materialized files and
  • directories, but in any case, all their children are represented on disk.
  • Traversals of dataless directories by applications trigger an enumeration
  • against the file provider extension; traversals of materialized directories
  • do not. It is the responsability of the file provider extension to notify
  • the system on remote changes of these files: there is no alternative cache
  • invalidation mechanism.
  • If the extension doesn't keep track of the materialized set, it will have to
  • notify the system of all remote changes. In that case the working set is the
  • entire dataset. The system may drop items whose parent isn't materialized, to
  • avoid unnecessary disk usage. This saves some I/O, but isn't optimal. The
  • filtering by parentItemIdentifier is better done in the extension; ideally,
  • it would even be done server-side. A hybrid model is possible, where some
  • filtering is done server-side, and some finer filtering is done client-side.
  • The file provider extension should therefore keep a list of the identifiers of
  • the materialized directories. This method is called when a new directory is
  • materialized or when a materialized directory is rendered dataless.
  • To enumerate the set of materialized containers,
    • Call -enumeratorForMaterializedItems on the instance of
  • NSFileProviderManager corresponding to your domain;
    • Implement the NSFileProviderEnumerationObserver and
  • NSFileProviderChangeObserver on an object;
    • Pass that object to the enumerator;
    • Use the identifiers of items or changes you receive to note the
  • materialization status in your database.
  • When an item is created, modified or deleted remotely, the file provider
  • extension should check whether its parentItemIdentifier is in the materialized
  • set. If it is, the extension needs to inform the system so the system may
  • create, modify or delete the file or directory (initially dataless) on disk.
  • In the case when an item is reparented, the test should be that either the new
  • or the old parentItemIdentifier is in the materialized set. No need to pretend
  • that the iten was deleted if the new parentItemIdentifier is no longer in the
  • materialized set: the system will know what to do with an unknown parent
  • identifier.
  • To notify the system of this created, modified or deleted item,
    • Call -signalEnumeratorForContainerItemIdentifier: on the working set, i.e the
  • container identified by NSFileProviderWorkingSetContainerItemIdentifier;
    • Include this item in the next enumeration of the working set.
  • Since this method is called on every change of the set of materialized items,
  • it is advisable to use it to set a flag and perform any resulting work as a
  • timed task rather than performing any work directly.
  • */ +- (void)materializedItemsDidChangeWithCompletionHandler:(void (^)(void))completionHandler;

+/**

  • Called by the system when the set of pending items is refreshed.
  • The pending enumerator lists all the items for which a change has been observed either
  • on the disk or in the working set more than one second ago and that change hasn't been
  • applied on the other side yet. An item can appear in the pending set for various reasons:
    • the system is under load and cannot process all the events in a timely fashion
    • a long running operation is scheduled or running for the item to be in sync (for instance,
  • the download or the upload of a new content)
    • an error occurred, in which case the error will be set on the item as downloadError if
  • it occurred when applying a change to the disk, or uploadError in the other way around.
  • The pending set will only include items that comply to the following rules:
    • They have been queued for changes for more time than the refresh interval;
    • The items are already known by the provider.
  • These constraints imply that initial transfer of a file from the disk to the provider will not
  • be listed in the pending set, even though the transfer could take several minutes to complete
  • The pending set is refreshed regurlary but only if there are meaningful changes:
  • new pending items, items that were pending but are not anymore (deletions from the set),
  • or domain version changed and set is not empty
  • To enumerate the set of pending items,
    • Call -enumeratorForPendingItems on the instance of
  • NSFileProviderManager corresponding to your domain;
    • Implement the NSFileProviderEnumerationObserver and
  • NSFileProviderChangeObserver on an object;
    • Pass that object to the enumerator;
    • It will get called upon change to the set.
  • This method is regularly called when changes happen to the pending set.
  • implementeers are advised that this call will not happen as soon as an item is pending.
  • Thus, implementeers should not use the pending set to detect when a change happens.
  • The pending set will only contain items that were pending for a least one second before the
  • last refresh date.
  • */ +- (void)pendingItemsDidChangeWithCompletionHandler:(void (^)(void))completionHandler FILEPROVIDER_API_AVAILABILITY_V3_1;

+@end + +#pragma mark - Additional protocols + +/**

  • Protocol to implement if the provider instance supports fetching incremental content changes.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderIncrementalContentFetching

+/**

  • Update a previously provided item to a new version.
  • If the system already has a version of an item and learns that a new version is
  • available, it may call this method to update the existing version to a new
  • version.
  • The semantics of the requestedVersion parameter are the same as for the non-delta update method above.
  • */ +- (NSProgress *)fetchContentsForItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •                                       version:(nullable NSFileProviderItemVersion *)requestedVersion
    
  •                    usingExistingContentsAtURL:(NSURL *)existingContents
    
  •                               existingVersion:(NSFileProviderItemVersion *)existingVersion
    
  •                                       request:(NSFileProviderRequest *)request
    
  •                             completionHandler:(void(^)(NSURL * _Nullable fileContents, NSFileProviderItem _Nullable item, NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(fetchContents(for:version:usingExistingContentsAt:existingVersion:request:completionHandler:));

+@end + +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderServicing + +/**

  • A file provider can implemement this method to return service sources that provide custom
  • communication channels to client applications.
  • The service sources must be tied to the item identified by @c itemIdentifier.
  • Client applications can retrieve the list of supported services by calling
  • @c -[NSFileManager getFileProviderServicesForItemAtURL:] for a specific item URL.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (nil, NSUserCancelledError) in the NSProgress
  • cancellation handler. +*/ +- (NSProgress *)supportedServiceSourcesForItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
  •                                   completionHandler:(void (^)(NSArray <id <NSFileProviderServiceSource>> * _Nullable, NSError * _Nullable))completionHandler
    
  • NS_SWIFT_NAME(supportedServiceSources(for:completionHandler:));

+@end + +/**

  • Protocol to implement if the provider supports fetching thumbnails for its items.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderThumbnailing

+/**

  • The system calls this method to fetch thumbnails.
  • The @p perThumbnailCompletionHandler should be called for each thumbnail, and
  • @p completionHandler only after all the per thumbnail completion blocks.
  • In the event of a global error, the implementation is allowed to skip calling
  • the @p perThumbnailCompletionHandler for individual thumbnails. In that case,
  • the @p completionHandler's error parameter would apply to all item identifiers
  • for which @p perThumbnailCompletionHandler had not been called.
  • If there is no thumbnail for a given item, the @p perThumbnailCompletionHandler
  • should be called with its @p imageData and @p error parameters both
  • set to nil.
  • If the system decides that an in-flight thumbnail request is not needed anymore,
  • it will call the returned @p NSProgress object's @p -cancel method,
  • at which time the implementation should clean up any held resources.
  • The system will cache the thumbnail for the item, and the cache will be
  • invalidated when itemVersion.contentVersion changes.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)fetchThumbnailsForItemIdentifiers:(NSArray *)itemIdentifiers
  •                                requestedSize:(CGSize)size
    
  •                perThumbnailCompletionHandler:(void (^)(NSFileProviderItemIdentifier identifier, NSData * _Nullable imageData, NSError * _Nullable error))perThumbnailCompletionHandler
    
  •                            completionHandler:(void (^)(NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(fetchThumbnails(for:requestedSize:perThumbnailCompletionHandler:completionHandler:));

+@end + +FILEPROVIDER_API_AVAILABILITY_V3 +@protocol NSFileProviderCustomAction + +/**

  • Perform a custom action identified by actionIdentifier, on items identified by
  • itemIdentifiers.
  • Custom actions are defined in the File Provider Extension's Info.plist, under the
  • NSExtensionFileProviderActions key. The format of this key is identical to actions
  • defined in a FileProviderUI extension.
  • Cancellations:

  • If the NSProgress returned by this method is cancelled, the extension should
  • call the completion handler with (NSUserCancelledError) in the NSProgress
  • cancellation handler.
  • */ +- (NSProgress *)performActionWithIdentifier:(NSFileProviderExtensionActionIdentifier)actionIdentifier
  •                 onItemsWithIdentifiers:(NSArray <NSFileProviderItemIdentifier> *)itemIdentifiers
    
  •                      completionHandler:(void (^)(NSError * _Nullable error))completionHandler
    
  • NS_SWIFT_NAME(performAction(identifier:onItemsWithIdentifiers:completionHandler:));

+@end + +/**

  • Protocol to implement for managing UserInteraction alerts.
  • */ +FILEPROVIDER_API_AVAILABILITY_V4_0 +@protocol NSFileProviderUserInteractionSuppressing

+/**

  • Suppression management:
  • The extension may choose to give the user the option to suppress certain UserInteraction alerts.
  • In order to do so, the extension must both implement NSFileProviderUserInteractionSuppressing, as well as
  • configure the desired UserInteractions in the Info.plist with the SuppressionIdentifier field.
  • When FileProvider needs to evaluate whether to display a UserInteraction alert, it will call
  • -[NSFileProviderUserInteractionSuppressing isInteractionSuppressedForIdentifier:]. When the user indicates that they do not
  • wish to see a given SuppressionIdentifiers's alert again, FileProvider will call
  • -[NSFileProviderUserInteractionSuppressing setInteractionSuppressed:forIdentifier:].
  • The extension can choose whether the suppression should apply only to the domain upon which
  • -[NSFileProviderUserInteractionSuppressing setInteractionSuppressed:forIdentifier:] was called, or if it should apply to all
  • domains for their provider. For instance, the extension could choose to suppress future alerts related
  • to adding an item to a shared folder across all domains, after the user chooses to suppress the alerts
  • in a specific domain's context. Or, the extension could choose to only suppress that alert for the
  • specific domain it was displayed within, and in the future, the user would see the same alert in the same
  • context, if they take the same action in another domain.
  • */

+- (void)setInteractionSuppressed:(BOOL)suppression forIdentifier:(NSString )suppressionIdentifier; +- (BOOL)isInteractionSuppressedForIdentifier:(NSString )suppressionIdentifier; + +@end + +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderDomainState + +/

  • Version of the domain.
  • The domain version is an opaque value assigned by the provider. It is read by the system in the
  • completion handler for createItemBasedOnTemplate, modifyItem, deleteItem and itemForIdentifier, as
  • well as in the finish calls when enumerating the working set. The read is guaranteed to happen
  • on the same dispatch queue the completion handler was called on.
  • When the system discovers a change on disk, it associates that change to the currently known
  • domain version. When that change get communicated to the extension, that version is included in
  • the NSFileProviderRequest object passed by the system to the extension. As a consequence, the
  • provider can use the domain version to identify the state of the system when a change was made on disk.
  • The provider is responsible for defining when the domain version changes. When that value is
  • updated, the provider must notify the system by signaling the working set.
  • The system ignore any domain version that is smaller than the previously known version.
  • */ +@property (nonatomic, readonly) NSFileProviderDomainVersion *domainVersion;

+/**

  • Global state of the domain.
  • Use this dictionary to add state information to the domain. It is accessible to predicates for
  • User Interactions, FileProvider Actions, and FileProviderUI Actions, via the top-level domainUserInfo context
  • key.
  • This dictionary must only contain key and value classes in the following list:
  • NSString, NSNumber, NSDate, and NSPersonNameComponents.
  • The system expects the domainVersion to be updated when the value of the userInfo property
  • changes.
  • */ +@property (nonatomic, strong, readonly, nonnull) NSDictionary *userInfo;

+@end + + +NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderRequest.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderRequest.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderRequest.h 1969-12-31 19:00:00.000000000 -0500 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderRequest.h 2021-05-22 07:29:07.000000000 -0400 @@ -0,0 +1,55 @@ +// +// NSFileProviderRequest.h +// FileProvider +// +// Copyright © 2018-2020 Apple Inc. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <FileProvider/NSFileProviderDefines.h> +#import <FileProvider/NSFileProviderManager.h> + +NS_ASSUME_NONNULL_BEGIN + +FILEPROVIDER_API_AVAILABILITY_V3 +@interface NSFileProviderRequest : NSObject +/**

  • The request was made by the sync system, e.g. to update a file to its latest version after a remote update was pushed.
  • This is only valid for NSFileProviderRequest objects passed to these methods:
    • [NSFileProviderEnumerating enumeratorForContainerItemIdentifier:]
    • [NSFileProviderReplicatedExtension fetchContentsForItemWithIdentifier:]
  • For sync up methods (createItem/modifyItem/deleteItem), the system does not know which actor made the
  • modifications to the file, so it cannot supply this information.
  • */ +@property (nonatomic, readonly) BOOL isSystemRequest;

+/**

  • The request was made by Finder or one of its helpers.
  • This is only valid for NSFileProviderRequest objects passed to these methods:
    • [NSFileProviderEnumerating enumeratorForContainerItemIdentifier:]
    • [NSFileProviderReplicatedExtension fetchContentsForItemWithIdentifier:]
  • For sync up methods (createItem/modifyItem/deleteItem), the system does not know which actor made the
  • modifications to the file, so it cannot supply this information.
  • */ +@property (nonatomic, readonly) BOOL isFileViewerRequest;

+/**

  • The URL of the requesting executable. This will always be nil unless both an MDM profile key is set, and the
  • provider's application is installed by an MDM profile. +*/ +@property (nonatomic, readonly, copy, nullable) NSURL *requestingExecutable API_UNAVAILABLE(ios);

+/**

  • The version of the domain when the event that triggered the request was observed.
  • If the extension doesn't implement the NSFileProviderDomainState protocol, this will be nil.
  • */ +@property (nonatomic, readonly, nullable) NSFileProviderDomainVersion *domainVersion FILEPROVIDER_API_AVAILABILITY_V3_1;

+@end + +NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h 2021-03-16 08:41:13.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderService.h 2021-05-22 07:29:07.000000000 -0400 @@ -2,7 +2,7 @@ // NSFileProviderService.h // FileProvider // -// Copyright © 2017 Apple Inc. All rights reserved. +// Copyright © 2017-2020 Apple Inc. All rights reserved. //

#import <Foundation/Foundation.h> @@ -14,7 +14,7 @@

@class NSXPCListenerEndpoint;

-FILEPROVIDER_API_AVAILABILITY_V2 +FILEPROVIDER_API_AVAILABILITY_V2_V3 @protocol NSFileProviderServiceSource

/** @@ -44,6 +44,7 @@ Client applications can retrieve the list of supported services by calling @c -[NSFileManager getFileProviderServicesForItemAtURL:] for a specific item URL. */ +FILEPROVIDER_API_AVAILABILITY_V2 @interface NSFileProviderExtension (NSFileProviderService)

  • (nullable NSArray <id > *)supportedServiceSourcesForItemIdentifier:(NSFileProviderItemIdentifier)itemIdentifier error:(NSError **)error NS_SWIFT_NAME(supportedServiceSources(for:)) FILEPROVIDER_API_AVAILABILITY_V2; diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderTesting.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderTesting.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderTesting.h 1969-12-31 19:00:00.000000000 -0500 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderTesting.h 2021-05-22 07:29:07.000000000 -0400 @@ -0,0 +1,344 @@ +// +// NSFileProviderTesting.h +// FileProvider +// +// Copyright © 2020 Apple Inc. All rights reserved. +//

+#import <Foundation/Foundation.h> +#import <FileProvider/NSFileProviderManager.h> + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark - Manual Scheduling Calls + +/** Type of the operation

  • */ +typedef NS_ENUM(NSInteger, NSFileProviderTestingOperationType) {
  • // A testing operation of type Ingestion
  • NSFileProviderTestingOperationTypeIngestion = 0,
  • // A testing operation of type Lookup
  • NSFileProviderTestingOperationTypeLookup = 1,
  • // A testing operation of type Creation
  • NSFileProviderTestingOperationTypeCreation = 2,
  • // A testing operation of type Modification
  • NSFileProviderTestingOperationTypeModification = 3,
  • // A testing operation of type Deletion
  • NSFileProviderTestingOperationTypeDeletion = 4,
  • // A testing operation of type ContentFetch
  • NSFileProviderTestingOperationTypeContentFetch = 5,
  • // A testing operation of type ChildrenEnumeration
  • NSFileProviderTestingOperationTypeChildrenEnumeration = 6,
  • // A testing operation of type CollisionResolution
  • NSFileProviderTestingOperationTypeCollisionResolution = 7 +} FILEPROVIDER_API_AVAILABILITY_V3_1;

+@protocol NSFileProviderTestingIngestion; +@protocol NSFileProviderTestingLookup; +@protocol NSFileProviderTestingCreation; +@protocol NSFileProviderTestingModification; +@protocol NSFileProviderTestingDeletion; +@protocol NSFileProviderTestingContentFetch; +@protocol NSFileProviderTestingChildrenEnumeration; +@protocol NSFileProviderTestingCollisionResolution; + +/** An operation that can scheduled.

  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingOperation

+/** The operation type

  • */ +@property (nonatomic, readonly) NSFileProviderTestingOperationType type;

+/** Returns the operation as an Ingestion. +

  • Returns the operation if it conforms to NSFileProviderTestingIngestion, otherwise returns nil.
  • */ +- (nullable id)asIngestion NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an Lookup. +

  • Returns the operation if it conforms to NSFileProviderTestingLookup, otherwise returns nil.
  • */ +- (nullable id)asLookup NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an Creation. +

  • Returns the operation if it conforms to NSFileProviderTestingCreation, otherwise returns nil.
  • */ +- (nullable id)asCreation NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an Modification. +

  • Returns the operation if it conforms to NSFileProviderTestingModification, otherwise returns nil.
  • */ +- (nullable id)asModification NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an Deletion. +

  • Returns the operation if it conforms to NSFileProviderTestingDeletion, otherwise returns nil.
  • */ +- (nullable id)asDeletion NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an ContentFetch. +

  • Returns the operation if it conforms to NSFileProviderTestingContentFetch, otherwise returns nil.
  • */ +- (nullable id)asContentFetch NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an ChildrenEnumeration. +

  • Returns the operation if it conforms to NSFileProviderTestingChildrenEnumeration, otherwise returns nil.
  • */ +- (nullable id)asChildrenEnumeration NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+/** Returns the operation as an Bounce. +

  • Returns the operation if it conforms to NSFileProviderTestingCollisionResolution, otherwise returns nil.
  • */ +- (nullable id)asCollisionResolution NS_SWIFT_UNAVAILABLE("use Swift's as operator");

+@end + +/** Control the scheduling of operation. +

  • These methods are available on domain with the NSFileProviderDomainTestingModeInteractive
  • enabled.
  • In order to manually schedule the operation, the testing harness will first call
  • -listAvailableTestingOperationWithError and get a list of operations that can be scheduled.
  • It can pick one or more operations from that list and call -runTestingOperations:error: to
  • schedule those operations.
  • From that point, it should get the new list of available operations and iterate between listing,
  • picking operation, running those operation and so on.
  • A process must have the com.apple.developer.fileprovider.testing-mode entitlement in order to
  • call the methods from this category.
  • */ +@interface NSFileProviderManager (TestingModeInteractive)

+/** List the available operations. +

  • This lists all of the operations that are ready to be scheduled by the system. The system waits
  • for all the pending disk and working set updates to be known before returning.
  • The operations that are returned may become invalid if the system receives new disk or working
  • set events, or if some operation are scheduled using -runTestingOperations:error:.
  • */ +- (nullable NSArray <id> *)listAvailableTestingOperationsWithError:(NSError **)error
  • FILEPROVIDER_API_AVAILABILITY_V3_1;

+/** Run a set of operations. +

  • Ask the system to schedule the execution of the listed operations. The system will wait until all
  • those operations have completed and report a per-operation error in case an operation fails.
  • */ +- (nullable NSDictionary<id, NSError *> *)runTestingOperations:(NSArray<id> *)operations
  •                                                                                     error:(NSError **)error
    
  • FILEPROVIDER_API_AVAILABILITY_V3_1;

+@end + +#pragma mark - Testing Operations + +/** Side affected by the operation.

  • */ +typedef NS_ENUM(NSUInteger, NSFileProviderTestingOperationSide) {
  • /** The operation reads or writes the disk.
  • */
    
  • NSFileProviderTestingOperationSideDisk = 0,
  • /** The operation reads or writes the file provider extension.
  • */
    
  • NSFileProviderTestingOperationSideFileProvider = 1, +} FILEPROVIDER_API_AVAILABILITY_V3_1;

+/** This operation causes the system to ingest a change. +

  • When running this operation, the system will discover a change from the disk or the provider.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingIngestion

+/** Side of the event.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide side;

+/** Identifier of the affected item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier itemIdentifier;

+/** The metadata of the item. +

  • This will be nil if the item is being deleted.
  • */ +@property (readonly, nullable, nonatomic) NSFileProviderItem item;

+@end + + +/** This operation causes the system to lookup an item.

  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingLookup

+/** Side of the event.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide side;

+/** Identifier of the affected item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier itemIdentifier;

+@end + + +/** This operation causes the system to propagate a creation of an item from a source side to a target side.

  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingCreation

+/** The target side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide targetSide;

+/** The description of the item.

  • */ +@property (readonly, nonatomic) NSFileProviderItem sourceItem;

+/** The domain version at the time the creation was discovered on the source side.

  • */ +@property (readonly, nonatomic, nullable) NSFileProviderDomainVersion *domainVersion;

+@end + + +/** This operation causes the system to propagate a modification of an existing item from a source side to a target side. +

  • The modification happens if a change is identified on an item that is already known by both sides.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingModification

+/** The target side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide targetSide;

+/** The description of the item.

  • */ +@property (readonly, nonatomic) NSFileProviderItem sourceItem;

+/** The identifier of the target item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier targetItemIdentifier;

+/** The version of the target item on top of which the modification is applied

  • */ +@property (readonly, nonatomic) NSFileProviderItemVersion *targetItemBaseVersion;

+/** The list of updated fields.

  • */ +@property (readonly, nonatomic) NSFileProviderItemFields changedFields;

+/** The domain version at the time the change was discovered on the source side.

  • */ +@property (readonly, nonatomic, nullable) NSFileProviderDomainVersion *domainVersion;

+@end + + +/** This operation causes the system to propagate a deletion from a source side to a target side. +

  • The deletion happens if an item that is known by the target side is deleted on the source side.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingDeletion

+/** The target side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide targetSide;

+/** The identifier of the source item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier sourceItemIdentifier;

+/** The identifier of the target item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier targetItemIdentifier;

+/** The version of the target item on top of which the deletion is applied

  • */ +@property (readonly, nonatomic) NSFileProviderItemVersion *targetItemBaseVersion;

+/** The domain version at the time the change was discovered on the source side.

  • */ +@property (readonly, nonatomic, nullable) NSFileProviderDomainVersion *domainVersion;

+@end + + +/** This operation causes the system to fetch the content of an item.

  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingContentFetch

+/** The side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide side;

+/** The identifier of the item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier itemIdentifier;

+@end + + +/** This operation causes the system to list the children of an item

  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingChildrenEnumeration

+/** The side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide side;

+/** The identifier of the item.

  • */ +@property (readonly, nonatomic) NSFileProviderItemIdentifier itemIdentifier;

+@end + + +/** This operation causes the system to resolve a collision by rename a colliding item. +

  • In case two items claim the same disk location because the have the same parent and filename,
  • the system will choose to rename one of those items away from that location. The renamed item will
  • have the same parent, but a slightly modified name (for instance "a.txt" will be renamed to "a 2.txt").
  • This can for instance happen if the case sensitivity of the local filesystem and of the provider differs.
  • */ +FILEPROVIDER_API_AVAILABILITY_V3_1 +@protocol NSFileProviderTestingCollisionResolution

+/** The side of the operation.

  • */ +@property (readonly, nonatomic) NSFileProviderTestingOperationSide side;

+/** The state of the item.

  • */ +@property (readonly, nonatomic) NSFileProviderItem renamedItem;

+@end + + +NS_ASSUME_NONNULL_END diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h --- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h 2021-03-16 08:41:13.000000000 -0400 +++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderThumbnailing.h 2021-05-22 07:29:07.000000000 -0400 @@ -12,6 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

+FILEPROVIDER_API_AVAILABILITY_V2 @interface NSFileProviderExtension (NSFileProviderThumbnailing)

/**

Clone this wiki locally