mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-12 20:30:30 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42c28b064a | ||
|
|
0b097b8c85 | ||
|
|
fce5d2f301 | ||
|
|
716e069984 | ||
|
|
881ee4af0a | ||
|
|
acc0ce1c32 | ||
|
|
f055c54a66 | ||
|
|
92890d1e1d | ||
|
|
0c483e0e19 | ||
|
|
341ec5e771 | ||
|
|
3224fcf71d | ||
|
|
9ff1c9d545 | ||
|
|
c40d17a6ad | ||
|
|
9d5e04854a | ||
|
|
d2fd03c1f0 | ||
|
|
7baaee493d | ||
|
|
03973790a8 | ||
|
|
19fea6953a | ||
|
|
698326f89a | ||
|
|
bdf6308d8f | ||
|
|
69d96c53d6 | ||
|
|
7b961fa249 |
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "CoreStore"
|
||||
s.version = "3.0.1"
|
||||
s.version = "3.1.1"
|
||||
s.license = "MIT"
|
||||
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"
|
||||
s.homepage = "https://github.com/JohnEstropia/CoreStore"
|
||||
@@ -16,7 +16,5 @@ Pod::Spec.new do |s|
|
||||
s.public_header_files = "Sources/**/*.h"
|
||||
s.frameworks = "Foundation", "CoreData"
|
||||
s.requires_arc = true
|
||||
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS[config=Debug]' => '-D USE_FRAMEWORKS -D DEBUG',
|
||||
'OTHER_SWIFT_FLAGS[config=Release]' => '-D USE_FRAMEWORKS',
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' }
|
||||
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS[config=Debug]' => '-D DEBUG' }
|
||||
end
|
||||
|
||||
@@ -80,10 +80,10 @@
|
||||
B50392FA1C47963F009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
|
||||
B50392FB1C479640009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
|
||||
B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; };
|
||||
B50956B81E30B810003DF913 /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50956B71E30B810003DF913 /* CoreDataNativeType.swift */; };
|
||||
B50956B91E30B810003DF913 /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50956B71E30B810003DF913 /* CoreDataNativeType.swift */; };
|
||||
B50956BA1E30B810003DF913 /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50956B71E30B810003DF913 /* CoreDataNativeType.swift */; };
|
||||
B50956BB1E30B810003DF913 /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50956B71E30B810003DF913 /* CoreDataNativeType.swift */; };
|
||||
B509C7F41E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */; };
|
||||
B509C7F51E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */; };
|
||||
B509C7F61E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */; };
|
||||
B509C7F71E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */; };
|
||||
B51BE06A1B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
|
||||
B51FE5AB1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
|
||||
B51FE5AD1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
|
||||
@@ -197,6 +197,10 @@
|
||||
B52DD1C91BE1F94600949AFE /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
|
||||
B52DD1CA1BE1F94600949AFE /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
|
||||
B52DD1CB1BE1F94600949AFE /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
|
||||
B52FD3AA1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */; };
|
||||
B52FD3AB1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */; };
|
||||
B52FD3AC1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */; };
|
||||
B52FD3AD1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */; };
|
||||
B533C4DB1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B533C4DA1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift */; };
|
||||
B533C4DC1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B533C4DA1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift */; };
|
||||
B533C4DD1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B533C4DA1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift */; };
|
||||
@@ -259,6 +263,14 @@
|
||||
B5489F501CF603D5008B4978 /* FromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5489F4F1CF603D5008B4978 /* FromTests.swift */; };
|
||||
B5489F511CF603D5008B4978 /* FromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5489F4F1CF603D5008B4978 /* FromTests.swift */; };
|
||||
B5489F521CF603D5008B4978 /* FromTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5489F4F1CF603D5008B4978 /* FromTests.swift */; };
|
||||
B549F65E1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */; };
|
||||
B549F65F1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */; };
|
||||
B549F6601E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */; };
|
||||
B549F6611E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */; };
|
||||
B549F6731E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */; };
|
||||
B549F6741E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */; };
|
||||
B549F6751E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */; };
|
||||
B549F6761E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */; };
|
||||
B54A6A551BA15F2A007870FD /* FetchedResultsControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */; };
|
||||
B5519A401CA1B17B002BEF78 /* ErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A3F1CA1B17B002BEF78 /* ErrorTests.swift */; };
|
||||
B5519A411CA1B17B002BEF78 /* ErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A3F1CA1B17B002BEF78 /* ErrorTests.swift */; };
|
||||
@@ -600,7 +612,7 @@
|
||||
B501FDE61CA8D20500BE22EF /* CSListObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSListObserver.swift; sourceTree = "<group>"; };
|
||||
B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Transaction.swift"; sourceTree = "<group>"; };
|
||||
B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+Setup.swift"; sourceTree = "<group>"; };
|
||||
B50956B71E30B810003DF913 /* CoreDataNativeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataNativeType.swift; sourceTree = "<group>"; };
|
||||
B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreStoreImportableAttributeType.swift; sourceTree = "<group>"; };
|
||||
B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectModel+Setup.swift"; sourceTree = "<group>"; };
|
||||
B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+CustomDebugStringConvertible.swift"; sourceTree = "<group>"; };
|
||||
B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchedResultsController+Convenience.swift"; sourceTree = "<group>"; };
|
||||
@@ -619,6 +631,7 @@
|
||||
B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSSaveResult.swift; sourceTree = "<group>"; };
|
||||
B52DD1741BE1F8CC00949AFE /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B52DD17D1BE1F8CC00949AFE /* CoreStoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreStoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Logging.swift"; sourceTree = "<group>"; };
|
||||
B533C4DA1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+CoreStore.swift"; sourceTree = "<group>"; };
|
||||
B538BA701D15B3E30003A766 /* CoreStoreBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoreStoreBridge.m; sourceTree = "<group>"; };
|
||||
B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSMigrationResult.swift; sourceTree = "<group>"; };
|
||||
@@ -636,6 +649,8 @@
|
||||
B5489F451CF5F017008B4978 /* TransactionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionTests.swift; sourceTree = "<group>"; };
|
||||
B5489F4B1CF5F743008B4978 /* BaseTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseTestCase.swift; sourceTree = "<group>"; };
|
||||
B5489F4F1CF603D5008B4978 /* FromTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FromTests.swift; sourceTree = "<group>"; };
|
||||
B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreStoreQueryableAttributeType.swift; sourceTree = "<group>"; };
|
||||
B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataNativeType.swift; sourceTree = "<group>"; };
|
||||
B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedResultsControllerDelegate.swift; sourceTree = "<group>"; };
|
||||
B5519A3F1CA1B17B002BEF78 /* ErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorTests.swift; sourceTree = "<group>"; };
|
||||
B5519A491CA1F4FB002BEF78 /* CSError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSError.swift; sourceTree = "<group>"; };
|
||||
@@ -1020,7 +1035,7 @@
|
||||
B5A261201B64BFDB006EB6D3 /* MigrationType.swift */,
|
||||
B56965231B356B820075EE4A /* MigrationResult.swift */,
|
||||
);
|
||||
path = Migrating;
|
||||
name = Migrating;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5A5F26B1CAFF8D0004AB9AF /* Swift */ = {
|
||||
@@ -1028,6 +1043,7 @@
|
||||
children = (
|
||||
2F291E2619C6D3CF007AF63F /* CoreStore.swift */,
|
||||
B5D1E22B19FA9FBC003B2874 /* CoreStoreError.swift */,
|
||||
B549F6721E56A92800FBAB2D /* CoreDataNativeType.swift */,
|
||||
B5E84EDA1AFF84500064E85B /* Setup */,
|
||||
B5E84EE21AFF84610064E85B /* Logging */,
|
||||
B5E84EE91AFF846E0064E85B /* Transactions */,
|
||||
@@ -1057,7 +1073,7 @@
|
||||
B53FBA101CAB607000F0D40A /* Convenience */,
|
||||
B5E222211CA4DE5700BA2E95 /* Internal */,
|
||||
);
|
||||
path = ObjectiveC;
|
||||
name = ObjectiveC;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E1B5A61CAA49CE007FD580 /* Migrating */ = {
|
||||
@@ -1098,9 +1114,9 @@
|
||||
B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */,
|
||||
B5F1DA8F1B9AA991007C5CBB /* ImportableUniqueObject.swift */,
|
||||
B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */,
|
||||
B50956B71E30B810003DF913 /* CoreDataNativeType.swift */,
|
||||
B509C7F31E54511B0061C547 /* CoreStoreImportableAttributeType.swift */,
|
||||
);
|
||||
path = Importing;
|
||||
name = Importing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84EDA1AFF84500064E85B /* Setup */ = {
|
||||
@@ -1110,7 +1126,7 @@
|
||||
B5E84EDB1AFF84500064E85B /* DataStack.swift */,
|
||||
B5FE4DA01C84818B00FA6A91 /* StorageInterfaces */,
|
||||
);
|
||||
path = Setup;
|
||||
name = Setup;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84EE21AFF84610064E85B /* Logging */ = {
|
||||
@@ -1121,7 +1137,7 @@
|
||||
B5E84EE51AFF84610064E85B /* CoreStoreLogger.swift */,
|
||||
B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */,
|
||||
);
|
||||
path = Logging;
|
||||
name = Logging;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84EE91AFF846E0064E85B /* Transactions */ = {
|
||||
@@ -1137,7 +1153,7 @@
|
||||
B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */,
|
||||
B5E84EF21AFF846E0064E85B /* SaveResult.swift */,
|
||||
);
|
||||
path = Transactions;
|
||||
name = Transactions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84EFD1AFF847B0064E85B /* Fetching and Querying */ = {
|
||||
@@ -1148,10 +1164,11 @@
|
||||
B5E84F071AFF847B0064E85B /* CoreStore+Querying.swift */,
|
||||
B596BBB51DD5BC67001DCDD9 /* FetchableSource.swift */,
|
||||
B596BBBA1DD5C39F001DCDD9 /* QueryableSource.swift */,
|
||||
B549F65D1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift */,
|
||||
B5E84F0A1AFF847B0064E85B /* Protocol Clauses */,
|
||||
B5E84EFF1AFF847B0064E85B /* Concrete Clauses */,
|
||||
);
|
||||
path = "Fetching and Querying";
|
||||
name = "Fetching and Querying";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84EFF1AFF847B0064E85B /* Concrete Clauses */ = {
|
||||
@@ -1164,7 +1181,7 @@
|
||||
B5E84F021AFF847B0064E85B /* GroupBy.swift */,
|
||||
B5E84F001AFF847B0064E85B /* Tweak.swift */,
|
||||
);
|
||||
path = "Concrete Clauses";
|
||||
name = "Concrete Clauses";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84F0A1AFF847B0064E85B /* Protocol Clauses */ = {
|
||||
@@ -1172,7 +1189,7 @@
|
||||
children = (
|
||||
B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */,
|
||||
);
|
||||
path = "Protocol Clauses";
|
||||
name = "Protocol Clauses";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84F191AFF84860064E85B /* Observing */ = {
|
||||
@@ -1187,7 +1204,7 @@
|
||||
B5E84F1D1AFF84860064E85B /* ListMonitor.swift */,
|
||||
B5E84F1E1AFF84860064E85B /* ListObserver.swift */,
|
||||
);
|
||||
path = Observing;
|
||||
name = Observing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84F261AFF84920064E85B /* Convenience */ = {
|
||||
@@ -1197,7 +1214,7 @@
|
||||
B5FAD6A81B50A4B300714891 /* Progress+Convenience.swift */,
|
||||
B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */,
|
||||
);
|
||||
path = Convenience;
|
||||
name = Convenience;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E84F291AFF849C0064E85B /* Internal */ = {
|
||||
@@ -1210,6 +1227,7 @@
|
||||
B5FAD6AB1B51285300714891 /* MigrationManager.swift */,
|
||||
B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */,
|
||||
B533C4DA1D7D4BFA001383CB /* DispatchQueue+CoreStore.swift */,
|
||||
B52FD3A91E3B3EF10001D919 /* NSManagedObject+Logging.swift */,
|
||||
B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */,
|
||||
B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */,
|
||||
B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */,
|
||||
@@ -1219,7 +1237,7 @@
|
||||
B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */,
|
||||
B5E84F2D1AFF849C0064E85B /* WeakObject.swift */,
|
||||
);
|
||||
path = Internal;
|
||||
name = Internal;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5ECDBEA1CA6BEAC00C7F112 /* Protocol Clauses */ = {
|
||||
@@ -1253,7 +1271,7 @@
|
||||
B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */,
|
||||
B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */,
|
||||
);
|
||||
path = StorageInterfaces;
|
||||
name = StorageInterfaces;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -1558,6 +1576,7 @@
|
||||
B5ECDC051CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5E1B5981CAA0C23007FD580 /* CSObjectObserver.swift in Sources */,
|
||||
B5519A5F1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B52FD3AA1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */,
|
||||
B51FE5AB1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */,
|
||||
B54A6A551BA15F2A007870FD /* FetchedResultsControllerDelegate.swift in Sources */,
|
||||
B5A261211B64BFDB006EB6D3 /* MigrationType.swift in Sources */,
|
||||
@@ -1573,6 +1592,8 @@
|
||||
B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */,
|
||||
B5E1B59D1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */,
|
||||
B5ECDC231CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B549F6731E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */,
|
||||
B509C7F41E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */,
|
||||
B5E84F0E1AFF847B0064E85B /* Tweak.swift in Sources */,
|
||||
B5E1B5931CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */,
|
||||
B5ECDC291CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
@@ -1599,7 +1620,6 @@
|
||||
B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */,
|
||||
B56965241B356B820075EE4A /* MigrationResult.swift in Sources */,
|
||||
B5FE4DAC1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
B50956B81E30B810003DF913 /* CoreDataNativeType.swift in Sources */,
|
||||
B501FDE71CA8D20500BE22EF /* CSListObserver.swift in Sources */,
|
||||
B501FDE21CA8D1F500BE22EF /* CSListMonitor.swift in Sources */,
|
||||
2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */,
|
||||
@@ -1645,6 +1665,7 @@
|
||||
B5E84F301AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift in Sources */,
|
||||
B546F9691C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
B53FBA1E1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
|
||||
B549F65E1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */,
|
||||
B5E84F211AFF84860064E85B /* CoreStore+Observing.swift in Sources */,
|
||||
B559CD431CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
|
||||
B5FE4DA71C84FB4400FA6A91 /* InMemoryStore.swift in Sources */,
|
||||
@@ -1711,6 +1732,7 @@
|
||||
B5ECDC071CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5E1B59A1CAA0C23007FD580 /* CSObjectObserver.swift in Sources */,
|
||||
B5519A601CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B52FD3AB1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */,
|
||||
B51FE5AD1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */,
|
||||
B5FE4DAD1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
82BA18C51C4BBD5300A0916E /* ListObserver.swift in Sources */,
|
||||
@@ -1726,6 +1748,8 @@
|
||||
B5D3F6461C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
|
||||
B5E1B59F1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */,
|
||||
B5ECDC251CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B549F6741E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */,
|
||||
B509C7F51E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */,
|
||||
82BA18B31C4BBD3900A0916E /* ImportableUniqueObject.swift in Sources */,
|
||||
B5E1B5951CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */,
|
||||
B5ECDC2B1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
@@ -1752,7 +1776,6 @@
|
||||
82BA18B01C4BBD3100A0916E /* NSManagedObject+Transaction.swift in Sources */,
|
||||
82BA18D41C4BBD7100A0916E /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
82BA18D51C4BBD7100A0916E /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
B50956B91E30B810003DF913 /* CoreDataNativeType.swift in Sources */,
|
||||
B501FDE91CA8D20500BE22EF /* CSListObserver.swift in Sources */,
|
||||
B501FDE41CA8D1F500BE22EF /* CSListMonitor.swift in Sources */,
|
||||
B5FE4DA31C8481E100FA6A91 /* StorageInterface.swift in Sources */,
|
||||
@@ -1798,6 +1821,7 @@
|
||||
B546F96A1C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
B53FBA201CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
|
||||
82BA18A81C4BBD2900A0916E /* CoreStoreLogger.swift in Sources */,
|
||||
B549F65F1E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */,
|
||||
B559CD451CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
|
||||
82BA18B81C4BBD4200A0916E /* ClauseTypes.swift in Sources */,
|
||||
B5ECDBEE1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
@@ -1864,6 +1888,7 @@
|
||||
B5ECDC0F1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
B5ECDC211CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B52DD1C21BE1F94600949AFE /* MigrationManager.swift in Sources */,
|
||||
B52FD3AD1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */,
|
||||
B5ECDC2D1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B5D7A5BA1CA3BF8F005C752B /* CSInto.swift in Sources */,
|
||||
B5A5F26A1CAEC50F004AB9AF /* CSSelect.swift in Sources */,
|
||||
@@ -1879,6 +1904,8 @@
|
||||
B5220E241D13085E009BC71E /* NSFetchedResultsController+Convenience.swift in Sources */,
|
||||
B559CD471CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
|
||||
B5ECDBF01CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
B549F6761E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */,
|
||||
B509C7F71E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */,
|
||||
B5220E1F1D130810009BC71E /* CSListObserver.swift in Sources */,
|
||||
B52DD1941BE1F92500949AFE /* CoreStore.swift in Sources */,
|
||||
B52DD1A61BE1F92F00949AFE /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
@@ -1905,7 +1932,6 @@
|
||||
B5220E231D130826009BC71E /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
|
||||
B52DD19D1BE1F92C00949AFE /* BaseDataTransaction.swift in Sources */,
|
||||
B5220E131D1305ED009BC71E /* SectionBy.swift in Sources */,
|
||||
B50956BB1E30B810003DF913 /* CoreDataNativeType.swift in Sources */,
|
||||
B559CD4D1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */,
|
||||
B5ECDBE91CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B52DD1B81BE1F94000949AFE /* DataStack+Migration.swift in Sources */,
|
||||
@@ -1951,6 +1977,7 @@
|
||||
B52DD1BB1BE1F94000949AFE /* MigrationType.swift in Sources */,
|
||||
B52DD1C91BE1F94600949AFE /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
B5220E151D130663009BC71E /* CoreStore+Observing.swift in Sources */,
|
||||
B549F6611E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */,
|
||||
B52DD19B1BE1F92800949AFE /* CoreStoreLogger.swift in Sources */,
|
||||
B52DD1991BE1F92800949AFE /* DefaultLogger.swift in Sources */,
|
||||
B5220E201D130813009BC71E /* CSObjectMonitor.swift in Sources */,
|
||||
@@ -2017,6 +2044,7 @@
|
||||
B5E1B59B1CAA0C23007FD580 /* CSObjectObserver.swift in Sources */,
|
||||
B5519A611CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B5FE4DAE1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
B52FD3AC1E3B3EF10001D919 /* NSManagedObject+Logging.swift in Sources */,
|
||||
B51FE5AE1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */,
|
||||
B563218C1BD65216006C9394 /* DataStack+Transaction.swift in Sources */,
|
||||
B53FBA0E1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */,
|
||||
@@ -2032,6 +2060,8 @@
|
||||
B5E1B5A01CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */,
|
||||
B5ECDC261CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B563217F1BD65216006C9394 /* CoreStore.swift in Sources */,
|
||||
B549F6751E56A92800FBAB2D /* CoreDataNativeType.swift in Sources */,
|
||||
B509C7F61E54511B0061C547 /* CoreStoreImportableAttributeType.swift in Sources */,
|
||||
B5E1B5961CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */,
|
||||
B5ECDC2C1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B56321911BD65216006C9394 /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
@@ -2058,7 +2088,6 @@
|
||||
B5FE4DA41C8481E100FA6A91 /* StorageInterface.swift in Sources */,
|
||||
B56321B31BD6521C006C9394 /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
B501FDEA1CA8D20500BE22EF /* CSListObserver.swift in Sources */,
|
||||
B50956BA1E30B810003DF913 /* CoreDataNativeType.swift in Sources */,
|
||||
B501FDE51CA8D1F500BE22EF /* CSListMonitor.swift in Sources */,
|
||||
B5ECDC141CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
B56321AE1BD6521C006C9394 /* NotificationObserver.swift in Sources */,
|
||||
@@ -2104,6 +2133,7 @@
|
||||
B546F96B1C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
B53FBA211CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
|
||||
B563218B1BD65216006C9394 /* UnsafeDataTransaction.swift in Sources */,
|
||||
B549F6601E569C7400FBAB2D /* CoreStoreQueryableAttributeType.swift in Sources */,
|
||||
B559CD461CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
|
||||
B56321A61BD65216006C9394 /* MigrationType.swift in Sources */,
|
||||
B5ECDBEF1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
@@ -2171,9 +2201,8 @@
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
"USE_FRAMEWORKS=1",
|
||||
"DEBUG=1",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
@@ -2187,7 +2216,7 @@
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS -D DEBUG";
|
||||
OTHER_SWIFT_FLAGS = "-D DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
|
||||
PRODUCT_NAME = CoreStore;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -2228,7 +2257,7 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "USE_FRAMEWORKS=1";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
@@ -2239,7 +2268,6 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_SWIFT_FLAGS = "-D USE_FRAMEWORKS";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
|
||||
PRODUCT_NAME = CoreStore;
|
||||
SDKROOT = iphoneos;
|
||||
|
||||
@@ -378,8 +378,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -423,8 +425,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
||||
@@ -153,6 +153,8 @@ class TestLogger: CoreStoreLogger {
|
||||
|
||||
// MARK: CoreStoreLogger
|
||||
|
||||
var enableObjectConcurrencyDebugging: Bool = true
|
||||
|
||||
func log(level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
|
||||
|
||||
switch level {
|
||||
|
||||
@@ -868,6 +868,24 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(objects)
|
||||
|
||||
let objectIDs = self.expectLogger([.logWarning]) {
|
||||
|
||||
stack.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
XCTAssertNil(objectIDs)
|
||||
}
|
||||
do {
|
||||
|
||||
let fetchClauses: [FetchClause] = [
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
]
|
||||
let objects = self.expectLogger([.logWarning]) {
|
||||
|
||||
stack.fetchAll(from, fetchClauses)
|
||||
}
|
||||
XCTAssertNil(objects)
|
||||
|
||||
let objectIDs = self.expectLogger([.logWarning]) {
|
||||
|
||||
stack.fetchObjectIDs(from, fetchClauses)
|
||||
@@ -1445,6 +1463,18 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
do {
|
||||
|
||||
let count = self.expectLogger([.logWarning]) {
|
||||
|
||||
stack.fetchCount(
|
||||
from,
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
)
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1592,6 +1622,18 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
do {
|
||||
|
||||
let count = self.expectLogger([.logWarning]) {
|
||||
|
||||
stack.fetchCount(
|
||||
from,
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
)
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2361,6 +2403,24 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(objects)
|
||||
|
||||
let objectIDs = self.expectLogger([.logWarning]) {
|
||||
|
||||
transaction.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
XCTAssertNil(objectIDs)
|
||||
}
|
||||
do {
|
||||
|
||||
let fetchClauses: [FetchClause] = [
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
]
|
||||
let objects = self.expectLogger([.logWarning]) {
|
||||
|
||||
transaction.fetchAll(from, fetchClauses)
|
||||
}
|
||||
XCTAssertNil(objects)
|
||||
|
||||
let objectIDs = self.expectLogger([.logWarning]) {
|
||||
|
||||
transaction.fetchObjectIDs(from, fetchClauses)
|
||||
@@ -2938,6 +2998,18 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
do {
|
||||
|
||||
let count = self.expectLogger([.logWarning]) {
|
||||
|
||||
transaction.fetchCount(
|
||||
from,
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
)
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3085,6 +3157,18 @@ final class FetchTests: BaseTestDataTestCase {
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
do {
|
||||
|
||||
let count = self.expectLogger([.logWarning]) {
|
||||
|
||||
transaction.fetchCount(
|
||||
from,
|
||||
Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil),
|
||||
OrderBy(.descending(#keyPath(TestEntity1.testEntityID)))
|
||||
)
|
||||
}
|
||||
XCTAssertNil(count)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,40 +36,40 @@ class ImportTests: BaseTestDataTestCase {
|
||||
@objc
|
||||
dynamic func test_ThatAttributeProtocols_BehaveCorrectly() {
|
||||
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: true))?.boolValue, true)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: Int16.max))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: Int32.max))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: Int64.max))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: MAXFLOAT))?.floatValue, MAXFLOAT)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSNumber(value: Double(MAXFLOAT)))?.doubleValue, Double(MAXFLOAT))
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: true))?.boolValue, true)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: Int16.max))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: Int32.max))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: Int64.max))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: MAXFLOAT))?.floatValue, MAXFLOAT)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSNumber(value: Double(MAXFLOAT)))?.doubleValue, Double(MAXFLOAT))
|
||||
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: "1"))?.boolValue, true)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: Int16.max.description))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: Int32.max.description))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: Int64.max.description))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.doubleValue, NSDecimalNumber(string: MAXFLOAT.description).doubleValue)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.floatValue, NSDecimalNumber(string: MAXFLOAT.description).floatValue)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: "1"))?.boolValue, true)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int16.max.description))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int32.max.description))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int64.max.description))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.doubleValue, NSDecimalNumber(string: MAXFLOAT.description).doubleValue)
|
||||
XCTAssertEqual(NSDecimalNumber.cs_fromImportableNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.floatValue, NSDecimalNumber(string: MAXFLOAT.description).floatValue)
|
||||
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: "1"))?.boolValue, true)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: Int16.max.description))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: Int32.max.description))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: Int64.max.description))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.doubleValue, NSDecimalNumber(string: MAXFLOAT.description).doubleValue)
|
||||
XCTAssertEqual(NSNumber.cs_fromNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.floatValue, NSDecimalNumber(string: MAXFLOAT.description).floatValue)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: "1"))?.boolValue, true)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int16.max.description))?.int16Value, Int16.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int32.max.description))?.int32Value, Int32.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: Int64.max.description))?.int64Value, Int64.max)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.doubleValue, NSDecimalNumber(string: MAXFLOAT.description).doubleValue)
|
||||
XCTAssertEqual(NSNumber.cs_fromImportableNativeType(NSDecimalNumber(string: MAXFLOAT.description))?.floatValue, NSDecimalNumber(string: MAXFLOAT.description).floatValue)
|
||||
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: true)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: Int16.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: Int32.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: Int64.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: MAXFLOAT)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromNativeType(NSNumber(value: Double(MAXFLOAT))))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: true)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: Int16.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: Int32.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: Int64.max)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: MAXFLOAT)))
|
||||
XCTAssertNil(NSDecimalNumber.cs_fromImportableNativeType(NSNumber(value: Double(MAXFLOAT))))
|
||||
|
||||
XCTAssertEqual(true.cs_toNativeType(), NSNumber(value: true))
|
||||
XCTAssertEqual(Int16.max.cs_toNativeType(), NSNumber(value: Int16.max))
|
||||
XCTAssertEqual(Int32.max.cs_toNativeType(), NSNumber(value: Int32.max))
|
||||
XCTAssertEqual(Int64.max.cs_toNativeType(), NSNumber(value: Int64.max))
|
||||
XCTAssertEqual(MAXFLOAT.cs_toNativeType(), NSNumber(value: MAXFLOAT))
|
||||
XCTAssertEqual(Double(MAXFLOAT).cs_toNativeType(), NSNumber(value: Double(MAXFLOAT)))
|
||||
XCTAssertEqual(true.cs_toQueryableNativeType(), NSNumber(value: true))
|
||||
XCTAssertEqual(Int16.max.cs_toQueryableNativeType(), NSNumber(value: Int16.max))
|
||||
XCTAssertEqual(Int32.max.cs_toQueryableNativeType(), NSNumber(value: Int32.max))
|
||||
XCTAssertEqual(Int64.max.cs_toQueryableNativeType(), NSNumber(value: Int64.max))
|
||||
XCTAssertEqual(MAXFLOAT.cs_toQueryableNativeType(), NSNumber(value: MAXFLOAT))
|
||||
XCTAssertEqual(Double(MAXFLOAT).cs_toQueryableNativeType(), NSNumber(value: Double(MAXFLOAT)))
|
||||
}
|
||||
|
||||
@objc
|
||||
@@ -1083,42 +1083,25 @@ extension TestEntity1: ImportableUniqueObject {
|
||||
|
||||
// MARK: ImportableUniqueObject
|
||||
|
||||
typealias UniqueIDType = NSNumber
|
||||
typealias UniqueIDType = Int64
|
||||
|
||||
static var uniqueIDKeyPath: String {
|
||||
|
||||
return #keyPath(TestEntity1.testEntityID)
|
||||
}
|
||||
|
||||
var uniqueIDValue: NSNumber {
|
||||
|
||||
get {
|
||||
|
||||
guard let ID = self.testEntityID else {
|
||||
|
||||
XCTFail()
|
||||
return 0
|
||||
}
|
||||
return ID
|
||||
}
|
||||
set {
|
||||
|
||||
self.testEntityID = newValue
|
||||
}
|
||||
}
|
||||
|
||||
static func shouldUpdate(from source: ImportSource, in transaction: BaseDataTransaction) -> Bool {
|
||||
|
||||
return source["skip_update"] == nil
|
||||
}
|
||||
|
||||
static func uniqueID(from source: ImportSource, in transaction: BaseDataTransaction) throws -> NSNumber? {
|
||||
static func uniqueID(from source: ImportSource, in transaction: BaseDataTransaction) throws -> Int64? {
|
||||
|
||||
if let _ = source["throw_on_id"] {
|
||||
|
||||
throw TestIDError()
|
||||
}
|
||||
return source[(#keyPath(TestEntity1.testEntityID))] as? NSNumber
|
||||
return source[(#keyPath(TestEntity1.testEntityID))] as? Int64
|
||||
}
|
||||
|
||||
func update(from source: ImportSource, in transaction: BaseDataTransaction) throws {
|
||||
|
||||
@@ -35,6 +35,21 @@ import CoreStore
|
||||
|
||||
class ListObserverTests: BaseTestDataTestCase {
|
||||
|
||||
@objc
|
||||
dynamic func test_ThatListObservers_CanDowncast() {
|
||||
|
||||
self.prepareStack { (stack) in
|
||||
|
||||
let monitor = stack.monitorSectionedList(
|
||||
From<TestEntity1>(),
|
||||
SectionBy(#keyPath(TestEntity1.testBoolean)),
|
||||
OrderBy(.ascending(#keyPath(TestEntity1.testBoolean)), .ascending(#keyPath(TestEntity1.testEntityID)))
|
||||
)
|
||||
let downcast = monitor.downcast()
|
||||
XCTAssertTrue(monitor == downcast)
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
dynamic func test_ThatListObservers_CanReceiveInsertNotifications() {
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="10174" systemVersion="15F34" minimumToolsVersion="Xcode 4.3">
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11759" systemVersion="16C67" minimumToolsVersion="Xcode 4.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
|
||||
<entity name="TestEntity1AAA" representedClassName="CoreStoreTests.TestEntity1" syncable="YES">
|
||||
<attribute name="testBoolean" optional="YES" attributeType="Boolean" syncable="YES"/>
|
||||
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
|
||||
<attribute name="testDate" optional="YES" attributeType="Date" syncable="YES"/>
|
||||
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testDecimal" optional="YES" attributeType="Decimal" syncable="YES"/>
|
||||
<attribute name="testEntityID" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="testEntityID" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testNil" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="testNumber" optional="YES" attributeType="Integer 32" syncable="YES"/>
|
||||
<attribute name="testNumber" optional="YES" attributeType="Integer 32" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testString" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<entity name="TestEntity2" representedClassName="CoreStoreTests.TestEntity2" syncable="YES">
|
||||
<attribute name="testBoolean" optional="YES" attributeType="Boolean" syncable="YES"/>
|
||||
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
|
||||
<attribute name="testDate" optional="YES" attributeType="Date" syncable="YES"/>
|
||||
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testDecimal" optional="YES" attributeType="Decimal" syncable="YES"/>
|
||||
<attribute name="testEntityID" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="testEntityID" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testNil" optional="YES" attributeType="String" syncable="YES"/>
|
||||
<attribute name="testNumber" optional="YES" attributeType="Integer 32" syncable="YES"/>
|
||||
<attribute name="testNumber" optional="YES" attributeType="Integer 32" usesScalarValueType="NO" syncable="YES"/>
|
||||
<attribute name="testString" optional="YES" attributeType="String" syncable="YES"/>
|
||||
</entity>
|
||||
<configuration name="Config1">
|
||||
|
||||
@@ -33,7 +33,27 @@ import CoreStore
|
||||
|
||||
// MARK: - ObjectObserverTests
|
||||
|
||||
class ObjectObserverTests: BaseTestDataTestCase {
|
||||
class ObjectObserverTests: BaseTestDataTestCase {
|
||||
|
||||
@objc
|
||||
dynamic func test_ThatObjectObservers_CanDowncast() {
|
||||
|
||||
self.prepareStack { (stack) in
|
||||
|
||||
self.prepareTestDataForStack(stack)
|
||||
|
||||
guard let object = stack.fetchOne(
|
||||
From<TestEntity1>(),
|
||||
Where(#keyPath(TestEntity1.testEntityID), isEqualTo: 101)) else {
|
||||
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
let monitor = stack.monitorObject(object)
|
||||
let downcast = monitor.downcast()
|
||||
XCTAssertTrue(monitor == downcast)
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
dynamic func test_ThatObjectObservers_CanReceiveUpdateNotifications() {
|
||||
|
||||
@@ -29,6 +29,25 @@ import XCTest
|
||||
import CoreStore
|
||||
|
||||
|
||||
// MARK: - XCTAssertAllEqual
|
||||
|
||||
private func XCTAssertAllEqual(_ whereClauses: Where...) {
|
||||
|
||||
XCTAssertAllEqual(whereClauses)
|
||||
}
|
||||
|
||||
private func XCTAssertAllEqual(_ whereClauses: [Where]) {
|
||||
|
||||
for i in whereClauses.indices {
|
||||
|
||||
for j in whereClauses.indices where j != i {
|
||||
|
||||
XCTAssertEqual(whereClauses[i], whereClauses[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//MARK: - WhereTests
|
||||
|
||||
final class WhereTests: XCTestCase {
|
||||
@@ -93,202 +112,114 @@ final class WhereTests: XCTestCase {
|
||||
do {
|
||||
|
||||
let value: Int = 100
|
||||
let whereClause1 = Where("%K == %d", "key", value)
|
||||
let whereClause2 = Where("%K == %d", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %d", "key", NSNumber(value: value))
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause6 = Where("%K == %@", "key", NSNumber(value: value))
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %d", "key", value),
|
||||
Where("%K == %d", "key", value as AnyObject),
|
||||
Where("%K == %d", "key", NSNumber(value: value)),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as AnyObject),
|
||||
Where("%K == %@", "key", NSNumber(value: value)),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: NSNumber(value: value))
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value = NSNumber(value: 100)
|
||||
let whereClause1 = Where("%K == %d", "key", value)
|
||||
let whereClause2 = Where("%K == %d", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %d", "key", value.intValue)
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause6 = Where("%K == %@", "key", value.intValue)
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %d", "key", value),
|
||||
Where("%K == %d", "key", value as AnyObject),
|
||||
Where("%K == %d", "key", value.intValue),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as AnyObject),
|
||||
Where("%K == %@", "key", value.intValue),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: value.intValue)
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value: Int64 = Int64.max
|
||||
let whereClause1 = Where("%K == %d", "key", value)
|
||||
let whereClause2 = Where("%K == %d", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %d", "key", NSNumber(value: value))
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause6 = Where("%K == %@", "key", NSNumber(value: value))
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %d", "key", value),
|
||||
Where("%K == %d", "key", value as AnyObject),
|
||||
Where("%K == %d", "key", NSNumber(value: value)),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as AnyObject),
|
||||
Where("%K == %@", "key", NSNumber(value: value)),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: NSNumber(value: value))
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value = NSNumber(value: Int64.max)
|
||||
let whereClause1 = Where("%K == %d", "key", value)
|
||||
let whereClause2 = Where("%K == %d", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %d", "key", value.int64Value)
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause6 = Where("%K == %@", "key", value.int64Value)
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %d", "key", value),
|
||||
Where("%K == %d", "key", value as AnyObject),
|
||||
Where("%K == %d", "key", value.int64Value),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as AnyObject),
|
||||
Where("%K == %@", "key", value.int64Value),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: value.int64Value)
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value: String = "value"
|
||||
let whereClause1 = Where("%K == %s", "key", value)
|
||||
let whereClause2 = Where("%K == %s", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %s", "key", NSString(string: value))
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause6 = Where("%K == %@", "key", NSString(string: value))
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %s", "key", value),
|
||||
Where("%K == %s", "key", value as AnyObject),
|
||||
Where("%K == %s", "key", NSString(string: value)),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as AnyObject),
|
||||
Where("%K == %@", "key", NSString(string: value)),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: value as NSString),
|
||||
Where("key", isEqualTo: NSString(string: value))
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value = NSString(string: "value")
|
||||
let whereClause1 = Where("%K == %s", "key", value)
|
||||
let whereClause2 = Where("%K == %s", "key", value as String)
|
||||
let whereClause3 = Where("%K == %s", "key", value as String as AnyObject)
|
||||
let whereClause4 = Where("%K == %@", "key", value)
|
||||
let whereClause5 = Where("%K == %@", "key", value as String)
|
||||
let whereClause6 = Where("%K == %@", "key", value as String as AnyObject)
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K == %s", "key", value),
|
||||
Where("%K == %s", "key", value as String),
|
||||
Where("%K == %s", "key", value as String as AnyObject),
|
||||
Where("%K == %@", "key", value),
|
||||
Where("%K == %@", "key", value as String),
|
||||
Where("%K == %@", "key", value as String as AnyObject),
|
||||
Where("key", isEqualTo: value),
|
||||
Where("key", isEqualTo: value as String),
|
||||
Where("key", isEqualTo: value as String as NSString)
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value: [Int] = [100, 200]
|
||||
let whereClause1 = Where("%K == %@", "key", value)
|
||||
let whereClause2 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %@", "key", value as [AnyObject])
|
||||
let whereClause4 = Where("%K == %@", "key", value as NSArray)
|
||||
let whereClause5 = Where("%K == %@", "key", NSArray(array: value))
|
||||
let whereClause6 = Where("%K == %@", "key", value as AnyObject as! NSArray)
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K IN %@", "key", value),
|
||||
Where("%K IN %@", "key", value as AnyObject),
|
||||
Where("%K IN %@", "key", value as [AnyObject]),
|
||||
Where("%K IN %@", "key", value as NSArray),
|
||||
Where("%K IN %@", "key", NSArray(array: value)),
|
||||
Where("%K IN %@", "key", value as AnyObject as! NSArray),
|
||||
Where("key", isMemberOf: value)
|
||||
)
|
||||
}
|
||||
do {
|
||||
|
||||
let value: [Int64] = [Int64.min, 100, Int64.max]
|
||||
let whereClause1 = Where("%K == %@", "key", value)
|
||||
let whereClause2 = Where("%K == %@", "key", value as AnyObject)
|
||||
let whereClause3 = Where("%K == %@", "key", value as [AnyObject])
|
||||
let whereClause4 = Where("%K == %@", "key", value as NSArray)
|
||||
let whereClause5 = Where("%K == %@", "key", NSArray(array: value))
|
||||
let whereClause6 = Where("%K == %@", "key", value as AnyObject as! NSArray)
|
||||
XCTAssertEqual(whereClause1, whereClause2)
|
||||
XCTAssertEqual(whereClause1, whereClause3)
|
||||
XCTAssertEqual(whereClause1, whereClause4)
|
||||
XCTAssertEqual(whereClause1, whereClause5)
|
||||
XCTAssertEqual(whereClause1, whereClause6)
|
||||
XCTAssertEqual(whereClause2, whereClause3)
|
||||
XCTAssertEqual(whereClause2, whereClause4)
|
||||
XCTAssertEqual(whereClause2, whereClause5)
|
||||
XCTAssertEqual(whereClause2, whereClause6)
|
||||
XCTAssertEqual(whereClause3, whereClause4)
|
||||
XCTAssertEqual(whereClause3, whereClause5)
|
||||
XCTAssertEqual(whereClause3, whereClause6)
|
||||
XCTAssertEqual(whereClause4, whereClause5)
|
||||
XCTAssertEqual(whereClause4, whereClause6)
|
||||
XCTAssertEqual(whereClause5, whereClause6)
|
||||
XCTAssertAllEqual(
|
||||
Where("%K IN %@", "key", value),
|
||||
Where("%K IN %@", "key", value as AnyObject),
|
||||
Where("%K IN %@", "key", value as [AnyObject]),
|
||||
Where("%K IN %@", "key", value as NSArray),
|
||||
Where("%K IN %@", "key", NSArray(array: value)),
|
||||
Where("%K IN %@", "key", value as AnyObject as! NSArray),
|
||||
Where("key", isMemberOf: value)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -519,7 +519,7 @@ are created from `beginSynchronous(...)`. While the syntax is similar to its asy
|
||||
```swift
|
||||
CoreStore.beginSynchronous { (transaction) -> Void in
|
||||
// make changes
|
||||
transaction.commit()
|
||||
_ = transaction.commit()
|
||||
}
|
||||
```
|
||||
`transaction` above is a `SynchronousDataTransaction` instance.
|
||||
|
||||
@@ -168,5 +168,8 @@ extension AsynchronousDataTransaction: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSAsynchronousDataTransaction
|
||||
public var bridgeToObjectiveC: CSAsynchronousDataTransaction {
|
||||
|
||||
return CSAsynchronousDataTransaction(self)
|
||||
}
|
||||
}
|
||||
@@ -294,13 +294,3 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
private let swiftTransaction: BaseDataTransaction
|
||||
}
|
||||
|
||||
|
||||
//// MARK: - BaseDataTransaction
|
||||
//
|
||||
//extension BaseDataTransaction: CoreStoreSwiftType {
|
||||
//
|
||||
// // MARK: CoreStoreSwiftType
|
||||
//
|
||||
// public typealias ObjectiveCType = CSBaseDataTransaction
|
||||
//}
|
||||
@@ -277,5 +277,8 @@ extension DataStack: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSDataStack
|
||||
public var bridgeToObjectiveC: CSDataStack {
|
||||
|
||||
return CSDataStack(self)
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public init<T: NSManagedObject>(_ swiftValue: From<T>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue.upcast()
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -118,5 +118,8 @@ extension GroupBy: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSGroupBy
|
||||
public var bridgeToObjectiveC: CSGroupBy {
|
||||
|
||||
return CSGroupBy(self)
|
||||
}
|
||||
}
|
||||
@@ -125,5 +125,8 @@ extension InMemoryStore: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSInMemoryStore
|
||||
public var bridgeToObjectiveC: CSInMemoryStore {
|
||||
|
||||
return CSInMemoryStore(self)
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public required init<T: NSManagedObject>(_ swiftValue: Into<T>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue.upcast()
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
@nonobjc
|
||||
public required init<T: NSManagedObject>(_ swiftValue: ListMonitor<T>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue.upcast()
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -177,5 +177,8 @@ extension MigrationResult: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSMigrationResult
|
||||
public var bridgeToObjectiveC: CSMigrationResult {
|
||||
|
||||
return CSMigrationResult(self)
|
||||
}
|
||||
}
|
||||
@@ -123,5 +123,8 @@ extension MigrationType: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSMigrationType
|
||||
public var bridgeToObjectiveC: CSMigrationType {
|
||||
|
||||
return CSMigrationType(self)
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
@nonobjc
|
||||
public required init<T: NSManagedObject>(_ swiftValue: ObjectMonitor<T>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue.upcast()
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -126,5 +126,8 @@ extension OrderBy: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSOrderBy
|
||||
public var bridgeToObjectiveC: CSOrderBy {
|
||||
|
||||
return CSOrderBy(self)
|
||||
}
|
||||
}
|
||||
@@ -203,5 +203,8 @@ extension SQLiteStore: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSQLiteStore
|
||||
public var bridgeToObjectiveC: CSSQLiteStore {
|
||||
|
||||
return CSSQLiteStore(self)
|
||||
}
|
||||
}
|
||||
@@ -177,5 +177,8 @@ extension SaveResult: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSaveResult
|
||||
public var bridgeToObjectiveC: CSSaveResult {
|
||||
|
||||
return CSSaveResult(self)
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,10 @@ extension SectionBy: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSectionBy
|
||||
public var bridgeToObjectiveC: CSSectionBy {
|
||||
|
||||
return CSSectionBy(self)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -192,7 +192,10 @@ extension SelectTerm: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSelectTerm
|
||||
public var bridgeToObjectiveC: CSSelectTerm {
|
||||
|
||||
return CSSelectTerm(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +181,6 @@ extension SetupResult where T: CoreStoreSwiftType, T.ObjectiveCType: CSStorageIn
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSetupResult
|
||||
|
||||
public var bridgeToObjectiveC: CSSetupResult {
|
||||
|
||||
return CSSetupResult(self)
|
||||
@@ -167,5 +167,8 @@ extension SynchronousDataTransaction: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSSynchronousDataTransaction
|
||||
public var bridgeToObjectiveC: CSSynchronousDataTransaction {
|
||||
|
||||
return CSSynchronousDataTransaction(self)
|
||||
}
|
||||
}
|
||||
@@ -94,5 +94,8 @@ extension Tweak: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSTweak
|
||||
public var bridgeToObjectiveC: CSTweak {
|
||||
|
||||
return CSTweak(self)
|
||||
}
|
||||
}
|
||||
@@ -197,5 +197,8 @@ extension UnsafeDataTransaction: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSUnsafeDataTransaction
|
||||
public var bridgeToObjectiveC: CSUnsafeDataTransaction {
|
||||
|
||||
return CSUnsafeDataTransaction(self)
|
||||
}
|
||||
}
|
||||
@@ -85,9 +85,11 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
- parameter value: the arguments for the `==` operator
|
||||
*/
|
||||
@objc
|
||||
public convenience init(keyPath: KeyPath, isEqualTo value: NSObject?) {
|
||||
public convenience init(keyPath: KeyPath, isEqualTo value: CoreDataNativeType?) {
|
||||
|
||||
self.init(Where(keyPath, isEqualTo: value))
|
||||
self.init(value == nil || value is NSNull
|
||||
? Where("\(keyPath) == nil")
|
||||
: Where("\(keyPath) == %@", value!))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,9 +99,9 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
- parameter list: the array to check membership of
|
||||
*/
|
||||
@objc
|
||||
public convenience init(keyPath: KeyPath, isMemberOf list: [NSObject]) {
|
||||
public convenience init(keyPath: KeyPath, isMemberOf list: [CoreDataNativeType]) {
|
||||
|
||||
self.init(Where(keyPath, isMemberOf: list))
|
||||
self.init(Where("\(keyPath) IN %@", list as NSArray))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,5 +165,8 @@ extension Where: CoreStoreSwiftType {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
public typealias ObjectiveCType = CSWhere
|
||||
public var bridgeToObjectiveC: CSWhere {
|
||||
|
||||
return CSWhere(self)
|
||||
}
|
||||
}
|
||||
77
Sources/CoreDataNativeType.swift
Normal file
77
Sources/CoreDataNativeType.swift
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// CoreDataNativeType.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2017 John Rommel Estropia
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - CoreDataNativeType
|
||||
|
||||
@objc public protocol CoreDataNativeType: class, NSObjectProtocol, AnyObject {}
|
||||
|
||||
|
||||
// MARK: - NSNumber
|
||||
|
||||
extension NSNumber: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSString
|
||||
|
||||
extension NSString: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSDate
|
||||
|
||||
extension NSDate: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSData
|
||||
|
||||
extension NSData: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSSet
|
||||
|
||||
extension NSSet: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSOrderedSet
|
||||
|
||||
extension NSOrderedSet: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSManagedObject
|
||||
|
||||
extension NSManagedObject: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSManagedObjectID
|
||||
|
||||
extension NSManagedObjectID: CoreDataNativeType {}
|
||||
|
||||
|
||||
// MARK: - NSNull
|
||||
|
||||
extension NSNull: CoreDataNativeType {}
|
||||
@@ -68,28 +68,20 @@ public protocol CoreStoreSwiftType {
|
||||
var bridgeToObjectiveC: ObjectiveCType { get }
|
||||
}
|
||||
|
||||
public extension CoreStoreSwiftType where ObjectiveCType: CoreStoreObjectiveCType, Self == ObjectiveCType.SwiftType {
|
||||
|
||||
public var bridgeToObjectiveC: ObjectiveCType {
|
||||
|
||||
return ObjectiveCType(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Internal
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T) -> T.ObjectiveCType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T) -> T.ObjectiveCType {
|
||||
|
||||
return closure().bridgeToObjectiveC
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T?) -> T.ObjectiveCType? where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T?) -> T.ObjectiveCType? {
|
||||
|
||||
return closure()?.bridgeToObjectiveC
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () throws -> T) throws -> T.ObjectiveCType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () throws -> T) throws -> T.ObjectiveCType {
|
||||
|
||||
do {
|
||||
|
||||
317
Sources/CoreStoreImportableAttributeType.swift
Normal file
317
Sources/CoreStoreImportableAttributeType.swift
Normal file
@@ -0,0 +1,317 @@
|
||||
//
|
||||
// CoreStoreImportableAttributeType.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2017 John Rommel Estropia
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - CoreStoreImportableAttributeType
|
||||
|
||||
public protocol CoreStoreImportableAttributeType: CoreStoreQueryableAttributeType {
|
||||
|
||||
associatedtype ImportableNativeType: QueryableNativeType
|
||||
|
||||
@inline(__always)
|
||||
static func cs_emptyValue() -> Self
|
||||
|
||||
@inline(__always)
|
||||
static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Self?
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSNumber
|
||||
|
||||
extension NSNumber: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_emptyValue() -> Self {
|
||||
|
||||
return self.init()
|
||||
}
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSNumber>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSString
|
||||
|
||||
extension NSString: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSString
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_emptyValue() -> Self {
|
||||
|
||||
return self.init()
|
||||
}
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSString>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSDate
|
||||
|
||||
extension NSDate: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSDate
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_emptyValue() -> Self {
|
||||
|
||||
return self.init(timeIntervalSinceReferenceDate: 0)
|
||||
}
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSDate>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSData
|
||||
|
||||
extension NSData: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSData
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_emptyValue() -> Self {
|
||||
|
||||
return self.init()
|
||||
}
|
||||
|
||||
@nonobjc @inline(__always)
|
||||
public class func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSData>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Bool
|
||||
|
||||
extension Bool: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Bool? {
|
||||
|
||||
return value.boolValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int16
|
||||
|
||||
extension Int16: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Int16 {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Int16? {
|
||||
|
||||
return value.int16Value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int32
|
||||
|
||||
extension Int32: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Int32 {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Int32? {
|
||||
|
||||
return value.int32Value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int64
|
||||
|
||||
extension Int64: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Int64 {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Int64? {
|
||||
|
||||
return value.int64Value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Double
|
||||
|
||||
extension Double: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Double {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Double? {
|
||||
|
||||
return value.doubleValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Float
|
||||
|
||||
extension Float: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSNumber
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Float {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Float? {
|
||||
|
||||
return value.floatValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Date
|
||||
|
||||
extension Date: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSDate
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Date {
|
||||
|
||||
return Date(timeIntervalSinceReferenceDate: 0)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Date? {
|
||||
|
||||
return value as Date
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - String
|
||||
|
||||
extension String: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSString
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> String {
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> String? {
|
||||
|
||||
return value as String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
extension Data: CoreStoreImportableAttributeType {
|
||||
|
||||
public typealias ImportableNativeType = NSData
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_emptyValue() -> Data {
|
||||
|
||||
return Data()
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
public static func cs_fromImportableNativeType(_ value: ImportableNativeType) -> Data? {
|
||||
|
||||
return value as Data
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,12 @@ public enum LogLevel {
|
||||
*/
|
||||
public protocol CoreStoreLogger {
|
||||
|
||||
/**
|
||||
When `true`, all `NSManagedObject` attribute and relationship access will raise an assertion when executed on the wrong transaction/datastack queue. Defaults to `false` if not implemented.
|
||||
*/
|
||||
// TODO: test before release (rolled back)
|
||||
// var enableObjectConcurrencyDebugging: Bool { get set }
|
||||
|
||||
/**
|
||||
Handles log messages sent by the `CoreStore` framework.
|
||||
|
||||
@@ -94,6 +100,13 @@ public protocol CoreStoreLogger {
|
||||
|
||||
extension CoreStoreLogger {
|
||||
|
||||
// TODO: test before release (rolled back)
|
||||
// public var enableObjectConcurrencyDebugging: Bool {
|
||||
//
|
||||
// get { return false }
|
||||
// set {}
|
||||
// }
|
||||
|
||||
public func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
|
||||
|
||||
Swift.fatalError(message, file: fileName, line: UInt(lineNumber))
|
||||
272
Sources/CoreStoreQueryableAttributeType.swift
Normal file
272
Sources/CoreStoreQueryableAttributeType.swift
Normal file
@@ -0,0 +1,272 @@
|
||||
//
|
||||
// CoreStoreQueryableAttributeType.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2017 John Rommel Estropia
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - CoreStoreQueryableAttributeType
|
||||
|
||||
public protocol CoreStoreQueryableAttributeType: Hashable {
|
||||
|
||||
associatedtype QueryableNativeType: CoreDataNativeType
|
||||
|
||||
func cs_toQueryableNativeType() -> QueryableNativeType
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSManagedObject
|
||||
|
||||
extension NSManagedObject: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSManagedObjectID
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self.objectID
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSManagedObjectID
|
||||
|
||||
extension NSManagedObjectID: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSManagedObjectID
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSNumber
|
||||
|
||||
extension NSNumber: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSString
|
||||
|
||||
extension NSString: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSString
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSDate
|
||||
|
||||
extension NSDate: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSDate
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSData
|
||||
|
||||
extension NSData: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSData
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Bool
|
||||
|
||||
extension Bool: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int16
|
||||
|
||||
extension Int16: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int32
|
||||
|
||||
extension Int32: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int64
|
||||
|
||||
extension Int64: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Int
|
||||
|
||||
extension Int: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Double
|
||||
|
||||
extension Double: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Float
|
||||
|
||||
extension Float: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - CGFloat
|
||||
|
||||
extension CGFloat: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNumber
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Date
|
||||
|
||||
extension Date: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSDate
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSDate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - String
|
||||
|
||||
extension String: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSString
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSString
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
extension Data: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSData
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self as NSData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - NSNull
|
||||
|
||||
extension NSNull: CoreStoreQueryableAttributeType {
|
||||
|
||||
public typealias QueryableNativeType = NSNull
|
||||
|
||||
public func cs_toQueryableNativeType() -> QueryableNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,9 @@ public final class DataStack: Equatable {
|
||||
- parameter migrationChain: the `MigrationChain` that indicates the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
|
||||
*/
|
||||
public required init(model: NSManagedObjectModel, migrationChain: MigrationChain = nil) {
|
||||
|
||||
// TODO: test before release (rolled back)
|
||||
// _ = DataStack.isGloballyInitialized
|
||||
|
||||
CoreStore.assert(
|
||||
migrationChain.valid,
|
||||
@@ -499,6 +502,13 @@ public final class DataStack: Equatable {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
// TODO: test before release (rolled back)
|
||||
// private static let isGloballyInitialized: Bool = {
|
||||
//
|
||||
// NSManagedObject.cs_swizzleMethodsForLogging()
|
||||
// return true
|
||||
// }()
|
||||
|
||||
private var configurationStoreMapping = [String: NSPersistentStore]()
|
||||
private var entityConfigurationsMapping = [String: Set<String>]()
|
||||
|
||||
@@ -33,6 +33,12 @@ import Foundation
|
||||
*/
|
||||
public final class DefaultLogger: CoreStoreLogger {
|
||||
|
||||
/**
|
||||
When `true`, all `NSManagedObject` attribute and relationship access will raise an assertion when executed on the wrong transaction/datastack queue. Defaults to `false`.
|
||||
*/
|
||||
// TODO: test before release (rolled back)
|
||||
// public var enableObjectConcurrencyDebugging: Bool = false
|
||||
|
||||
/**
|
||||
Creates a `DefaultLogger`.
|
||||
*/
|
||||
@@ -132,16 +132,6 @@ internal final class FetchedResultsControllerDelegate<EntityType: NSManagedObjec
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
|
||||
|
||||
// I don't know if iOS 10 even attempted to fix this mess...
|
||||
if case .update = actualType,
|
||||
indexPath != nil && newIndexPath != nil {
|
||||
|
||||
actualType = .move
|
||||
}
|
||||
}
|
||||
|
||||
switch actualType {
|
||||
|
||||
case .update:
|
||||
@@ -206,7 +206,7 @@ public struct From<T: NSManagedObject> {
|
||||
return stores?.isEmpty == false
|
||||
}
|
||||
|
||||
internal func upcast() -> From<NSManagedObject> {
|
||||
internal func downcast() -> From<NSManagedObject> {
|
||||
|
||||
return From<NSManagedObject>(
|
||||
entityClass: self.entityClass,
|
||||
@@ -59,7 +59,7 @@ public protocol ImportableUniqueObject: ImportableObject {
|
||||
/**
|
||||
The data type for the entity's unique ID attribute
|
||||
*/
|
||||
associatedtype UniqueIDType: CoreStoreSupportedAttributeType
|
||||
associatedtype UniqueIDType: CoreStoreImportableAttributeType
|
||||
|
||||
/**
|
||||
The keyPath to the entity's unique ID attribute
|
||||
@@ -192,14 +192,14 @@ public extension ImportableUniqueObject where Self: NSManagedObject {
|
||||
|
||||
get {
|
||||
|
||||
return UniqueIDType.cs_fromNativeType(
|
||||
self.value(forKey: type(of: self).uniqueIDKeyPath) as! UniqueIDType.CoreStoreNativeType
|
||||
return UniqueIDType.cs_fromImportableNativeType(
|
||||
self.value(forKey: type(of: self).uniqueIDKeyPath) as! UniqueIDType.ImportableNativeType
|
||||
)!
|
||||
}
|
||||
set {
|
||||
|
||||
self.setValue(
|
||||
newValue.cs_toNativeType(),
|
||||
newValue.cs_toQueryableNativeType(),
|
||||
forKey: type(of: self).uniqueIDKeyPath
|
||||
)
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
//
|
||||
// CoreDataNativeType.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2017 John Rommel Estropia
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - CoreDataNativeType
|
||||
|
||||
public protocol CoreDataNativeType: class, NSObjectProtocol, AnyObject {}
|
||||
|
||||
extension NSNumber: CoreDataNativeType {}
|
||||
extension NSString: CoreDataNativeType {}
|
||||
extension NSDate: CoreDataNativeType {}
|
||||
extension NSData: CoreDataNativeType {}
|
||||
extension NSSet: CoreDataNativeType {}
|
||||
extension NSOrderedSet: CoreDataNativeType {}
|
||||
|
||||
|
||||
public protocol CoreStoreSupportedAttributeType {
|
||||
|
||||
associatedtype CoreStoreNativeType: CoreDataNativeType
|
||||
|
||||
static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self?
|
||||
func cs_toNativeType() -> CoreStoreNativeType
|
||||
}
|
||||
|
||||
extension NSNumber: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSNumber>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension NSString: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSString
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSString>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension NSDate: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSDate
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSDate>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension NSData: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSData
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSData>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension NSSet: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSSet
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSSet>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
extension NSOrderedSet: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSOrderedSet
|
||||
|
||||
public class func cs_fromNativeType(_ value: CoreStoreNativeType) -> Self? {
|
||||
|
||||
func forceCast<T: NSOrderedSet>(_ value: Any) -> T? {
|
||||
|
||||
return value as? T
|
||||
}
|
||||
return forceCast(value)
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
extension Bool: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Bool? {
|
||||
|
||||
return value as Bool
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Int16: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Int16? {
|
||||
|
||||
return value as Int16
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Int32: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Int32? {
|
||||
|
||||
return value as Int32
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Int64: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Int64? {
|
||||
|
||||
return value as Int64
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Double: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Double? {
|
||||
|
||||
return value as Double
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Float: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSNumber
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Float? {
|
||||
|
||||
return value as Float
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSNumber
|
||||
}
|
||||
}
|
||||
|
||||
extension Date: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSDate
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Date? {
|
||||
|
||||
return value as Date
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSDate
|
||||
}
|
||||
}
|
||||
|
||||
extension String: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSString
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> String? {
|
||||
|
||||
return value as String
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSString
|
||||
}
|
||||
}
|
||||
|
||||
extension Data: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSData
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Data? {
|
||||
|
||||
return value as Data
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSData
|
||||
}
|
||||
}
|
||||
|
||||
extension Set: CoreStoreSupportedAttributeType {
|
||||
|
||||
public typealias CoreStoreNativeType = NSSet
|
||||
|
||||
public static func cs_fromNativeType(_ value: CoreStoreNativeType) -> Set? {
|
||||
|
||||
return value as? Set
|
||||
}
|
||||
|
||||
public func cs_toNativeType() -> CoreStoreNativeType {
|
||||
|
||||
return self as NSSet
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.1</string>
|
||||
<string>3.1.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -163,7 +163,7 @@ public struct Into<T: NSManagedObject>: Hashable {
|
||||
|
||||
internal let inferStoreIfPossible: Bool
|
||||
|
||||
internal func upcast() -> Into<NSManagedObject> {
|
||||
internal func downcast() -> Into<NSManagedObject> {
|
||||
|
||||
return Into<NSManagedObject>(
|
||||
entityClass: self.entityClass,
|
||||
@@ -202,7 +202,7 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
||||
!self.isPendingRefetch || Thread.isMainThread,
|
||||
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
|
||||
)
|
||||
return (self.fetchedResultsController.fetchedObjects as? [T]) ?? []
|
||||
return self.fetchedResultsController.dynamicCast().fetchedObjects ?? []
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,7 +371,7 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
||||
!self.isPendingRefetch || Thread.isMainThread,
|
||||
"Attempted to access a \(cs_typeName(self)) outside the main thread while a refetch is in progress."
|
||||
)
|
||||
return (self.fetchedResultsController.fetchedObjects as? [T] ?? []).index(of: object)
|
||||
return (self.fetchedResultsController.dynamicCast().fetchedObjects ?? []).index(of: object)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -675,9 +675,14 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
||||
)
|
||||
}
|
||||
|
||||
internal func upcast() -> ListMonitor<NSManagedObject> {
|
||||
internal func downcast() -> ListMonitor<NSManagedObject> {
|
||||
|
||||
return unsafeBitCast(self, to: ListMonitor<NSManagedObject>.self)
|
||||
@inline(__always)
|
||||
func noWarnUnsafeBitCast<T, U>(_ x: T, to type: U.Type) -> U {
|
||||
|
||||
return unsafeBitCast(x, to: type)
|
||||
}
|
||||
return noWarnUnsafeBitCast(self, to: ListMonitor<NSManagedObject>.self)
|
||||
}
|
||||
|
||||
internal func registerChangeNotification(_ notificationKey: UnsafeRawPointer, name: Notification.Name, toObserver observer: AnyObject, callback: @escaping (_ monitor: ListMonitor<T>) -> Void) {
|
||||
@@ -88,7 +88,7 @@ fileprivate func createFRC(fromContext context: NSManagedObjectContext, from: CS
|
||||
let controller = CoreStoreFetchedResultsController(
|
||||
context: context,
|
||||
fetchRequest: CoreStoreFetchRequest().dynamicCast(),
|
||||
from: from?.bridgeToSwift.upcast(),
|
||||
from: from?.bridgeToSwift.downcast(),
|
||||
sectionBy: sectionBy?.bridgeToSwift,
|
||||
applyFetchClauses: { (fetchRequest) in
|
||||
|
||||
241
Sources/NSManagedObject+Logging.swift
Normal file
241
Sources/NSManagedObject+Logging.swift
Normal file
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// NSManagedObject+Logging.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2017 John Rommel Estropia
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
|
||||
// MARK: - NSManagedObject
|
||||
|
||||
internal extension NSManagedObject {
|
||||
|
||||
// TODO: test before release (rolled back)
|
||||
// @nonobjc
|
||||
// internal static func cs_swizzleMethodsForLogging() {
|
||||
//
|
||||
// struct Static {
|
||||
//
|
||||
// static let isSwizzled = Static.swizzle()
|
||||
//
|
||||
// private static func swizzle() -> Bool {
|
||||
//
|
||||
// NSManagedObject.cs_swizzle(
|
||||
// original: #selector(NSManagedObject.willAccessValue(forKey:)),
|
||||
// proxy: #selector(NSManagedObject.cs_willAccessValue(forKey:))
|
||||
// )
|
||||
// NSManagedObject.cs_swizzle(
|
||||
// original: #selector(NSManagedObject.willChangeValue(forKey:)),
|
||||
// proxy: #selector(NSManagedObject.cs_willChangeValue(forKey:))
|
||||
// )
|
||||
// NSManagedObject.cs_swizzle(
|
||||
// original: #selector(NSManagedObject.willChangeValue(forKey:withSetMutation:using:)),
|
||||
// proxy: #selector(NSManagedObject.cs_willChangeValue(forKey:withSetMutation:using:))
|
||||
// )
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// assert(Static.isSwizzled)
|
||||
// }
|
||||
//
|
||||
// @nonobjc
|
||||
// private static func cs_swizzle(original originalSelector: Selector, proxy swizzledSelector: Selector) {
|
||||
//
|
||||
// let originalMethod = class_getInstanceMethod(NSManagedObject.self, originalSelector)
|
||||
// let swizzledMethod = class_getInstanceMethod(NSManagedObject.self, swizzledSelector)
|
||||
// let didAddMethod = class_addMethod(
|
||||
// NSManagedObject.self,
|
||||
// originalSelector,
|
||||
// method_getImplementation(swizzledMethod),
|
||||
// method_getTypeEncoding(swizzledMethod)
|
||||
// )
|
||||
// if didAddMethod {
|
||||
//
|
||||
// class_replaceMethod(
|
||||
// NSManagedObject.self,
|
||||
// swizzledSelector,
|
||||
// method_getImplementation(originalMethod),
|
||||
// method_getTypeEncoding(originalMethod)
|
||||
// )
|
||||
// }
|
||||
// else {
|
||||
//
|
||||
// method_exchangeImplementations(originalMethod, swizzledMethod)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private dynamic func cs_willAccessValue(forKey key: String?) {
|
||||
//
|
||||
// self.cs_willAccessValue(forKey: key)
|
||||
//
|
||||
// guard CoreStore.logger.enableObjectConcurrencyDebugging else {
|
||||
//
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// guard let context = self.managedObjectContext else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to access the \"\(key ?? "")\" key of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(NSManagedObjectContext.self))."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isTransactionContext {
|
||||
//
|
||||
// guard let transaction = context.parentTransaction else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to access the \"\(key ?? "")\" key of an object of type \(cs_typeName(self)) after has been deleted from its transaction."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// transaction.isRunningInAllowedQueue(),
|
||||
// "Attempted to access the \"\(key ?? "")\" key of an object of type \(cs_typeName(self)) outside its transaction's designated queue."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isDataStackContext {
|
||||
//
|
||||
// guard context.parentStack != nil else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to access the \"\(key ?? "")\" key of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(DataStack.self)).")
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// Thread.isMainThread,
|
||||
// "Attempted to access the \"\(key ?? "")\" key of an object of type \(cs_typeName(self)) outside the main thread."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private dynamic func cs_willChangeValue(forKey key: String?) {
|
||||
//
|
||||
// self.cs_willChangeValue(forKey: key)
|
||||
//
|
||||
// guard CoreStore.logger.enableObjectConcurrencyDebugging else {
|
||||
//
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// guard let context = self.managedObjectContext else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to change the \"\(key ?? "")\" of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(NSManagedObjectContext.self))."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isTransactionContext {
|
||||
//
|
||||
// guard let transaction = context.parentTransaction else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to change the \"\(key ?? "")\" of an object of type \(cs_typeName(self)) after has been deleted from its transaction."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// transaction.isRunningInAllowedQueue(),
|
||||
// "Attempted to change the \"\(key ?? "")\" of an object of type \(cs_typeName(self)) outside its transaction's designated queue."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isDataStackContext {
|
||||
//
|
||||
// guard context.parentStack != nil else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to change the \"\(key ?? "")\" of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(DataStack.self)).")
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// Thread.isMainThread,
|
||||
// "Attempted to change the \"\(key ?? "")\" of an object of type \(cs_typeName(self)) outside the main thread."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private dynamic func cs_willChangeValue(forKey inKey: String, withSetMutation inMutationKind: NSKeyValueSetMutationKind, using inObjects: Set<AnyHashable>) {
|
||||
//
|
||||
// self.cs_willChangeValue(
|
||||
// forKey: inKey,
|
||||
// withSetMutation: inMutationKind,
|
||||
// using: inObjects
|
||||
// )
|
||||
//
|
||||
// guard CoreStore.logger.enableObjectConcurrencyDebugging else {
|
||||
//
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// guard let context = self.managedObjectContext else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to mutate the \"\(inKey)\" of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(NSManagedObjectContext.self))."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isTransactionContext {
|
||||
//
|
||||
// guard let transaction = context.parentTransaction else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to mutate the \"\(inKey)\" of an object of type \(cs_typeName(self)) after has been deleted from its transaction."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// transaction.isRunningInAllowedQueue(),
|
||||
// "Attempted to mutate the \"\(inKey)\" of an object of type \(cs_typeName(self)) outside its transaction's designated queue."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// if context.isDataStackContext {
|
||||
//
|
||||
// guard context.parentStack != nil else {
|
||||
//
|
||||
// CoreStore.log(
|
||||
// .warning,
|
||||
// message: "Attempted to mutate the \"\(inKey)\" of an object of type \(cs_typeName(self)) after has been deleted from its \(cs_typeName(DataStack.self)).")
|
||||
// return
|
||||
// }
|
||||
// CoreStore.assert(
|
||||
// Thread.isMainThread,
|
||||
// "Attempted to mutate the \"\(inKey)\" of an object of type \(cs_typeName(self)) outside the main thread."
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user