Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CoreData] Add support for Xcode 13 beta 3. #12183

Merged
merged 2 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 86 additions & 1 deletion src/coredata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ interface NSAttributeDescription {
[Watch (6, 0), TV (13, 0), Mac (10, 15), iOS (13, 0)]
[Export ("preservesValueInHistoryOnDeletion")]
bool PreservesValueInHistoryOnDeletion { get; set; }

[Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Export ("allowsCloudEncryption")]
bool AllowsCloudEncryption { get; set; }
}

[BaseType (typeof (NSObject))]
Expand Down Expand Up @@ -1667,14 +1671,26 @@ interface NSPersistentHistoryTransaction : NSCopying
[DisableDefaultCtor] // NSInternalInconsistencyException Reason: NSCoreDataCoreSpotlightDelegate requires the use of the initializer initForStoreWithDescription:model:
interface NSCoreDataCoreSpotlightDelegate
{

[Notification]
[Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("NSCoreDataCoreSpotlightDelegateIndexDidUpdateNotification")]
NSString IndexDidUpdateNotification { get; }

[Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("initForStoreWithDescription:coordinator:")]
[DesignatedInitializer]
IntPtr Constructor (NSPersistentStoreDescription description, NSPersistentStoreCoordinator psc);

[Export ("domainIdentifier")]
string DomainIdentifier { get; }

[NullAllowed, Export ("indexName")]
string IndexName { get; }

[Deprecated (PlatformName.iOS, 15,0, message: "Use the constructor that takes a NSPersistentStoreCoordinator instead.")]
[Deprecated (PlatformName.MacOSX, 12,0, message: "Use the constructor that takes a NSPersistentStoreCoordinator instead.")]
[Export ("initForStoreWithDescription:model:")]
[DesignatedInitializer]
IntPtr Constructor (NSPersistentStoreDescription description, NSManagedObjectModel model);

[Export ("attributeSetForObject:")]
Expand All @@ -1686,6 +1702,23 @@ interface NSCoreDataCoreSpotlightDelegate

[Export ("searchableIndex:reindexSearchableItemsWithIdentifiers:acknowledgementHandler:")]
void ReindexSearchableItems (CSSearchableIndex searchableIndex, string[] identifiers, Action acknowledgementHandler);

[Async]
[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("deleteSpotlightIndexWithCompletionHandler:")]
void DeleteSpotlightIndex (Action<NSError> completionHandler);

[NoWatch, NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Export ("indexingEnabled")]
bool IndexingEnabled { [Bind ("isIndexingEnabled")] get; }

[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("startSpotlightIndexing")]
void StartSpotlightIndexing ();

[NoWatch, NoTV, Mac (12,0), iOS (15,0),MacCatalyst (15,0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[NoWatch, NoTV, Mac (12,0), iOS (15,0),MacCatalyst (15,0)]
[NoWatch, NoTV, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]

[Export ("stopSpotlightIndexing")]
void StopSpotlightIndexing ();
}
#endif

Expand Down Expand Up @@ -2640,6 +2673,21 @@ interface NSDerivedAttributeDescription : NSSecureCoding {
NSExpression DerivationExpression { get; set; }
}

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
delegate void NSPersistentCloudKitContainerShareManagedObjectsHandler (NSSet<NSManagedObjectID> sharedObjectIds, CKShare share, CKContainer container, NSError error);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
delegate void NSPersistentCloudKitContainerFetchParticipantsMatchingLookupInfosHandler (NSArray<CKShareParticipant> fetchedParticipants, NSError error);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
delegate void NSPersistentCloudKitContainerPersistUpdatedShareHandler (CKShare persistedShare, NSError error);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
delegate void NSPersistentCloudKitContainerPurgeObjectsAndRecordsInZoneHandler (CKRecordZoneID purgedZoneId, NSError error);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
delegate void NSPersistentCloudKitContainerAcceptShareInvitationsHandler (NSArray<CKShareMetadata> acceptedShareMetadatas, NSError error);

[Watch (6,0), TV (13,0), Mac (10,15), iOS (13,0)]
[BaseType (typeof(NSPersistentContainer))]
[DisableDefaultCtor]
Expand Down Expand Up @@ -2677,6 +2725,43 @@ interface NSPersistentCloudKitContainer {
[Watch (7,0), TV (14,0), Mac (11,0), iOS (14,0)]
[Export ("canModifyManagedObjectsInStore:")]
bool CanModifyManagedObjects (NSPersistentStore store);

// NSPersistentCloudKitContainer_Sharing
[Async (ResultTypeName = "NSPersistentCloudKitContainerAcceptShareInvitationsResult")]
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("acceptShareInvitationsFromMetadata:intoPersistentStore:completion:")]
void AcceptShareInvitations (CKShareMetadata[] metadata, NSPersistentStore persistentStore, [NullAllowed] NSPersistentCloudKitContainerAcceptShareInvitationsHandler handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the NSPersistentCloudKitContainerAcceptShareInvitationsHandler has [NoWatch] and [NoTV] attributes


[Async (ResultTypeName = "NSPersistentCloudKitContainerPurgeObjectsAndRecordsInZone")]
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("purgeObjectsAndRecordsInZoneWithID:inPersistentStore:completion:")]
void PurgeObjectsAndRecordsInZone (CKRecordZoneID zoneId, [NullAllowed] NSPersistentStore persistentStore, [NullAllowed] NSPersistentCloudKitContainerPurgeObjectsAndRecordsInZoneHandler handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Async (ResultTypeName = "NSPersistentCloudKitContainerPersistUpdatedShareResult")]
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("persistUpdatedShare:inPersistentStore:completion:")]
void PersistUpdatedShare (CKShare share, NSPersistentStore persistentStore, [NullAllowed] NSPersistentCloudKitContainerPersistUpdatedShareHandler handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Async (ResultTypeName = "NSPersistentCloudKitContainerFetchParticipantsMatchingLookupInfosResult")]
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("fetchParticipantsMatchingLookupInfos:intoPersistentStore:completion:")]
void FetchParticipantsMatchingLookupInfos (CKUserIdentityLookupInfo[] lookupInfos, NSPersistentStore persistentStore, NSPersistentCloudKitContainerFetchParticipantsMatchingLookupInfosHandler handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("fetchSharesMatchingObjectIDs:error:")]
[return: NullAllowed]
NSDictionary<NSManagedObjectID, CKShare> FetchSharesMatchingObjectIds (NSManagedObjectID[] objectIDs, [NullAllowed] out NSError error);

[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("fetchSharesInPersistentStore:error:")]
[return: NullAllowed]
CKShare[] FetchSharesInPersistentStore ([NullAllowed] NSPersistentStore persistentStore, [NullAllowed] out NSError error);

[Async (ResultTypeName = "NSPersistentCloudKitContainerShareManagedObjectsResult")]
[Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("shareManagedObjects:toShare:completion:")]
void ShareManagedObjects (NSManagedObject[] managedObjects, [NullAllowed] CKShare share, NSPersistentCloudKitContainerShareManagedObjectsHandler handler);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member Author

@mandel-macaque mandel-macaque Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these methods, I got the first interface wrong and forgot to update the delegates, updated in a9c9067


}

[Watch (6,0), TV (13,0), Mac (10,15), iOS (13,0)]
Expand Down
14 changes: 14 additions & 0 deletions tests/xtro-sharpie/MacCatalyst-CoreData.ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# NSInternalInconsistencyException Reason: -init results in undefined behavior for NSBatchInsertRequest
!missing-selector! NSBatchInsertRequest::init not bound

# ignored as well in macOS
!missing-field! NSBinaryExternalRecordType not bound
!missing-field! NSEntityNameInPathKey not bound
!missing-field! NSExternalRecordExtensionOption not bound
!missing-field! NSExternalRecordsDirectoryOption not bound
!missing-field! NSExternalRecordsFileFormatOption not bound
!missing-field! NSModelPathKey not bound
!missing-field! NSObjectURIKey not bound
!missing-field! NSStorePathKey not bound
!missing-field! NSStoreUUIDInPathKey not bound
!missing-field! NSValidateXMLStoreOption not bound
!missing-field! NSXMLExternalRecordType not bound
!missing-field! NSXMLStoreType not bound
34 changes: 0 additions & 34 deletions tests/xtro-sharpie/MacCatalyst-CoreData.todo

This file was deleted.

8 changes: 8 additions & 0 deletions tests/xtro-sharpie/common-CoreData.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@

# by-ref argument, cannot be null
!extra-null-allowed! 'System.Boolean CoreData.NSManagedObject::ValidateValue(Foundation.NSObject&,System.String,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #0

# waiting for changes in foundation which are not trivial
!missing-protocol-member! NSFetchedResultsControllerDelegate::controller:didChangeContentWithDifference: not found
!missing-protocol-member! NSFetchedResultsControllerDelegate::controller:didChangeContentWithSnapshot: not found

!missing-selector! +NSPersistentStoreCoordinator::elementsDerivedFromExternalRecordURL: not bound
!missing-selector! +NSPersistentStoreCoordinator::metadataForPersistentStoreWithURL:error: not bound
!missing-selector! NSPersistentStoreCoordinator::importStoreWithIdentifier:fromExternalRecordsDirectory:toURL:options:withType:error: not bound
3 changes: 0 additions & 3 deletions tests/xtro-sharpie/iOS-CoreData.ignore

This file was deleted.

17 changes: 0 additions & 17 deletions tests/xtro-sharpie/iOS-CoreData.todo

This file was deleted.

2 changes: 0 additions & 2 deletions tests/xtro-sharpie/macOS-CoreData.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
!missing-protocol! NSFetchedResultsControllerDelegate not bound
!missing-protocol! NSFetchedResultsSectionInfo not bound
!missing-selector! +NSFetchedResultsController::deleteCacheWithName: not bound
!missing-selector! +NSPersistentStoreCoordinator::elementsDerivedFromExternalRecordURL: not bound
!missing-selector! NSFetchedResultsController::cacheName not bound
!missing-selector! NSFetchedResultsController::delegate not bound
!missing-selector! NSFetchedResultsController::fetchedObjects not bound
Expand All @@ -27,5 +26,4 @@
!missing-selector! NSFetchedResultsController::sectionNameKeyPath not bound
!missing-selector! NSFetchedResultsController::sections not bound
!missing-selector! NSFetchedResultsController::setDelegate: not bound
!missing-selector! NSPersistentStoreCoordinator::importStoreWithIdentifier:fromExternalRecordsDirectory:toURL:options:withType:error: not bound
!missing-type! NSFetchedResultsController not bound
16 changes: 0 additions & 16 deletions tests/xtro-sharpie/macOS-CoreData.todo

This file was deleted.

3 changes: 0 additions & 3 deletions tests/xtro-sharpie/tvOS-CoreData.ignore

This file was deleted.

9 changes: 0 additions & 9 deletions tests/xtro-sharpie/tvOS-CoreData.todo

This file was deleted.

3 changes: 0 additions & 3 deletions tests/xtro-sharpie/watchOS-CoreData.ignore

This file was deleted.

9 changes: 0 additions & 9 deletions tests/xtro-sharpie/watchOS-CoreData.todo

This file was deleted.