mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-15 21:53:39 +01:00
WIP: objective-C fetching
This commit is contained in:
@@ -376,11 +376,6 @@
|
||||
B5E2222C1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */; };
|
||||
B5E2222D1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */; };
|
||||
B5E2222E1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */; };
|
||||
B5E222311CA533A400BA2E95 /* CSImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222301CA533A400BA2E95 /* CSImportableObject.swift */; };
|
||||
B5E222321CA533A400BA2E95 /* CSImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222301CA533A400BA2E95 /* CSImportableObject.swift */; };
|
||||
B5E222331CA533A400BA2E95 /* CSImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222301CA533A400BA2E95 /* CSImportableObject.swift */; };
|
||||
B5E222341CA533A400BA2E95 /* CSImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222301CA533A400BA2E95 /* CSImportableObject.swift */; };
|
||||
B5E222351CA533A400BA2E95 /* CSImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222301CA533A400BA2E95 /* CSImportableObject.swift */; };
|
||||
B5E834B91B76311F001D3D50 /* BaseDataTransaction+Importing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */; };
|
||||
B5E834BB1B7691F3001D3D50 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834BA1B7691F3001D3D50 /* Functions.swift */; };
|
||||
B5E84EDF1AFF84500064E85B /* DataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDB1AFF84500064E85B /* DataStack.swift */; };
|
||||
@@ -419,6 +414,66 @@
|
||||
B5E84F391AFF85470064E85B /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
|
||||
B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */; };
|
||||
B5EA11DD1CA3AFD9002282F8 /* NSPersistentStoreCoordinator+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */; };
|
||||
B5ECDBDF1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */; };
|
||||
B5ECDBE01CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */; };
|
||||
B5ECDBE11CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */; };
|
||||
B5ECDBE21CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */; };
|
||||
B5ECDBE31CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */; };
|
||||
B5ECDBE51CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */; };
|
||||
B5ECDBE61CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */; };
|
||||
B5ECDBE71CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */; };
|
||||
B5ECDBE81CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */; };
|
||||
B5ECDBE91CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */; };
|
||||
B5ECDBEC1CA6BF2000C7F112 /* CSFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */; };
|
||||
B5ECDBED1CA6BF2000C7F112 /* CSFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */; };
|
||||
B5ECDBEE1CA6BF2000C7F112 /* CSFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */; };
|
||||
B5ECDBEF1CA6BF2000C7F112 /* CSFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */; };
|
||||
B5ECDBF01CA6BF2000C7F112 /* CSFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */; };
|
||||
B5ECDBF91CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */; };
|
||||
B5ECDBFA1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */; };
|
||||
B5ECDBFB1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */; };
|
||||
B5ECDBFC1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */; };
|
||||
B5ECDBFD1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */; };
|
||||
B5ECDBFF1CA80CBA00C7F112 /* CSWhere.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */; };
|
||||
B5ECDC001CA80CBA00C7F112 /* CSWhere.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */; };
|
||||
B5ECDC011CA80CBA00C7F112 /* CSWhere.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */; };
|
||||
B5ECDC021CA80CBA00C7F112 /* CSWhere.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */; };
|
||||
B5ECDC031CA80CBA00C7F112 /* CSWhere.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */; };
|
||||
B5ECDC051CA8138100C7F112 /* CSOrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */; };
|
||||
B5ECDC061CA8138100C7F112 /* CSOrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */; };
|
||||
B5ECDC071CA8138100C7F112 /* CSOrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */; };
|
||||
B5ECDC081CA8138100C7F112 /* CSOrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */; };
|
||||
B5ECDC091CA8138100C7F112 /* CSOrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */; };
|
||||
B5ECDC0B1CA8161B00C7F112 /* CSGroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */; };
|
||||
B5ECDC0C1CA8161B00C7F112 /* CSGroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */; };
|
||||
B5ECDC0D1CA8161B00C7F112 /* CSGroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */; };
|
||||
B5ECDC0E1CA8161B00C7F112 /* CSGroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */; };
|
||||
B5ECDC0F1CA8161B00C7F112 /* CSGroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */; };
|
||||
B5ECDC111CA816E500C7F112 /* CSTweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC101CA816E500C7F112 /* CSTweak.swift */; };
|
||||
B5ECDC121CA816E500C7F112 /* CSTweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC101CA816E500C7F112 /* CSTweak.swift */; };
|
||||
B5ECDC131CA816E500C7F112 /* CSTweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC101CA816E500C7F112 /* CSTweak.swift */; };
|
||||
B5ECDC141CA816E500C7F112 /* CSTweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC101CA816E500C7F112 /* CSTweak.swift */; };
|
||||
B5ECDC151CA816E500C7F112 /* CSTweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC101CA816E500C7F112 /* CSTweak.swift */; };
|
||||
B5ECDC1D1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */; };
|
||||
B5ECDC1E1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */; };
|
||||
B5ECDC1F1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */; };
|
||||
B5ECDC201CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */; };
|
||||
B5ECDC211CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */; };
|
||||
B5ECDC231CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */; };
|
||||
B5ECDC241CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */; };
|
||||
B5ECDC251CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */; };
|
||||
B5ECDC261CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */; };
|
||||
B5ECDC271CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */; };
|
||||
B5ECDC291CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */; };
|
||||
B5ECDC2A1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */; };
|
||||
B5ECDC2B1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */; };
|
||||
B5ECDC2C1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */; };
|
||||
B5ECDC2D1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */; };
|
||||
B5ECDC2F1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */; };
|
||||
B5ECDC301CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */; };
|
||||
B5ECDC311CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */; };
|
||||
B5ECDC321CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */; };
|
||||
B5ECDC331CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */; };
|
||||
B5F1DA8D1B9AA97D007C5CBB /* ImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */; };
|
||||
B5F1DA901B9AA991007C5CBB /* ImportableUniqueObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8F1B9AA991007C5CBB /* ImportableUniqueObject.swift */; };
|
||||
B5FAD6A91B50A4B400714891 /* NSProgress+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6A81B50A4B300714891 /* NSProgress+Convenience.swift */; };
|
||||
@@ -541,7 +596,6 @@
|
||||
B5DC47C91C93D9C800FA3BF3 /* StorageInterfaceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageInterfaceTests.swift; sourceTree = "<group>"; };
|
||||
B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSSynchronousDataTransaction.swift; sourceTree = "<group>"; };
|
||||
B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSUnsafeDataTransaction.swift; sourceTree = "<group>"; };
|
||||
B5E222301CA533A400BA2E95 /* CSImportableObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSImportableObject.swift; sourceTree = "<group>"; };
|
||||
B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "BaseDataTransaction+Importing.swift"; sourceTree = "<group>"; };
|
||||
B5E834BA1B7691F3001D3D50 /* Functions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Functions.swift; sourceTree = "<group>"; };
|
||||
B5E84ED81AFF82360064E85B /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
|
||||
@@ -581,6 +635,18 @@
|
||||
B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Transaction.swift"; sourceTree = "<group>"; };
|
||||
B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Querying.swift"; sourceTree = "<group>"; };
|
||||
B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClauseTypes.swift; sourceTree = "<group>"; };
|
||||
B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSBaseDataTransaction+Querying.swift"; sourceTree = "<group>"; };
|
||||
B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSClauseTypes.swift; sourceTree = "<group>"; };
|
||||
B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSFrom.swift; sourceTree = "<group>"; };
|
||||
B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+ObjectiveC.swift"; sourceTree = "<group>"; };
|
||||
B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSWhere.swift; sourceTree = "<group>"; };
|
||||
B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSOrderBy.swift; sourceTree = "<group>"; };
|
||||
B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSGroupBy.swift; sourceTree = "<group>"; };
|
||||
B5ECDC101CA816E500C7F112 /* CSTweak.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSTweak.swift; sourceTree = "<group>"; };
|
||||
B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSDataStack+Querying.swift"; sourceTree = "<group>"; };
|
||||
B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSCoreStore+Querying.swift"; sourceTree = "<group>"; };
|
||||
B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSDataStack+Transaction.swift"; sourceTree = "<group>"; };
|
||||
B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CSCoreStore+Transaction.swift"; sourceTree = "<group>"; };
|
||||
B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportableObject.swift; sourceTree = "<group>"; };
|
||||
B5F1DA8F1B9AA991007C5CBB /* ImportableUniqueObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportableUniqueObject.swift; sourceTree = "<group>"; };
|
||||
B5FAD6A81B50A4B300714891 /* NSProgress+Convenience.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSProgress+Convenience.swift"; sourceTree = "<group>"; };
|
||||
@@ -809,6 +875,8 @@
|
||||
B5519A5E1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift */,
|
||||
B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */,
|
||||
B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */,
|
||||
B5ECDC281CA81CC700C7F112 /* CSDataStack+Transaction.swift */,
|
||||
B5ECDC2E1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift */,
|
||||
B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */,
|
||||
);
|
||||
name = "Saving and Processing";
|
||||
@@ -847,7 +915,7 @@
|
||||
B5519A491CA1F4FB002BEF78 /* CSError.swift */,
|
||||
B546F9611C9A13F400D5AC55 /* Setup */,
|
||||
B5519A5D1CA20093002BEF78 /* Saving and Processing */,
|
||||
B5E2222F1CA5339200BA2E95 /* Importing Data */,
|
||||
B5E2222F1CA5339200BA2E95 /* Fetching and Querying */,
|
||||
B5E222211CA4DE5700BA2E95 /* Internal */,
|
||||
);
|
||||
path = ObjectiveC;
|
||||
@@ -857,16 +925,21 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B5AEFAB41C9962AE00AD137F /* CoreStoreBridge.swift */,
|
||||
B5ECDBF81CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift */,
|
||||
);
|
||||
name = Internal;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E2222F1CA5339200BA2E95 /* Importing Data */ = {
|
||||
B5E2222F1CA5339200BA2E95 /* Fetching and Querying */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B5E222301CA533A400BA2E95 /* CSImportableObject.swift */,
|
||||
B5ECDBDE1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift */,
|
||||
B5ECDC1C1CA81A2100C7F112 /* CSDataStack+Querying.swift */,
|
||||
B5ECDC221CA81A3900C7F112 /* CSCoreStore+Querying.swift */,
|
||||
B5ECDBEA1CA6BEAC00C7F112 /* Protocol Clauses */,
|
||||
B5ECDBF11CA6BF2300C7F112 /* Concrete Clauses */,
|
||||
);
|
||||
name = "Importing Data";
|
||||
name = "Fetching and Querying";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5E834B61B7630BD001D3D50 /* Importing Data */ = {
|
||||
@@ -995,6 +1068,26 @@
|
||||
path = Internal;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5ECDBEA1CA6BEAC00C7F112 /* Protocol Clauses */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B5ECDBE41CA6BEA300C7F112 /* CSClauseTypes.swift */,
|
||||
);
|
||||
name = "Protocol Clauses";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5ECDBF11CA6BF2300C7F112 /* Concrete Clauses */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B5ECDBEB1CA6BF2000C7F112 /* CSFrom.swift */,
|
||||
B5ECDBFE1CA80CBA00C7F112 /* CSWhere.swift */,
|
||||
B5ECDC041CA8138100C7F112 /* CSOrderBy.swift */,
|
||||
B5ECDC0A1CA8161B00C7F112 /* CSGroupBy.swift */,
|
||||
B5ECDC101CA816E500C7F112 /* CSTweak.swift */,
|
||||
);
|
||||
name = "Concrete Clauses";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B5FE4DA01C84818B00FA6A91 /* StorageInterfaces */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1320,6 +1413,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B5E84F221AFF84860064E85B /* ObjectMonitor.swift in Sources */,
|
||||
B5ECDBF91CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */,
|
||||
B5C976E71C6E3A5A00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
|
||||
B5F1DA901B9AA991007C5CBB /* ImportableUniqueObject.swift in Sources */,
|
||||
B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */,
|
||||
@@ -1327,6 +1421,8 @@
|
||||
B5D1E22C19FA9FBC003B2874 /* CoreStoreError.swift in Sources */,
|
||||
B5E84F131AFF847B0064E85B /* Where.swift in Sources */,
|
||||
B5D3F6451C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
|
||||
B5ECDBFF1CA80CBA00C7F112 /* CSWhere.swift in Sources */,
|
||||
B5ECDC051CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5519A5F1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B54A6A551BA15F2A007870FD /* FetchedResultsControllerDelegate.swift in Sources */,
|
||||
B5A261211B64BFDB006EB6D3 /* MigrationType.swift in Sources */,
|
||||
@@ -1334,9 +1430,12 @@
|
||||
B5D7A5B61CA3BF8F005C752B /* CSInto.swift in Sources */,
|
||||
B56007141B3F6C2800A9A8F9 /* SectionBy.swift in Sources */,
|
||||
B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
B5ECDC1D1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B5C976E31C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
|
||||
B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */,
|
||||
B5ECDC231CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B5E84F0E1AFF847B0064E85B /* Tweak.swift in Sources */,
|
||||
B5ECDC291CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B5E84F121AFF847B0064E85B /* OrderBy.swift in Sources */,
|
||||
B546F9581C99B17400D5AC55 /* CSCoreStore+Setup.swift in Sources */,
|
||||
B5E84F361AFF85470064E85B /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
@@ -1350,6 +1449,7 @@
|
||||
B50392F91C478FF3009900CA /* NSManagedObject+Transaction.swift in Sources */,
|
||||
B5202CFA1C04688100DED140 /* NSFetchedResultsController+Convenience.swift in Sources */,
|
||||
B5519A591CA2008C002BEF78 /* CSBaseDataTransaction.swift in Sources */,
|
||||
B5ECDBDF1CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */,
|
||||
B546F96E1C9B14AC00D5AC55 /* CSStorageInterface.swift in Sources */,
|
||||
B5E84F251AFF84860064E85B /* ObjectObserver.swift in Sources */,
|
||||
B5E84F2F1AFF849C0064E85B /* NotificationObserver.swift in Sources */,
|
||||
@@ -1357,6 +1457,7 @@
|
||||
B56965241B356B820075EE4A /* MigrationResult.swift in Sources */,
|
||||
B5FE4DAC1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
2F291E2719C6D3CF007AF63F /* CoreStore.swift in Sources */,
|
||||
B5ECDC111CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
B5E84F411AFF8CCD0064E85B /* ClauseTypes.swift in Sources */,
|
||||
B5E84F0D1AFF847B0064E85B /* BaseDataTransaction+Querying.swift in Sources */,
|
||||
B5FAD6AC1B51285300714891 /* MigrationManager.swift in Sources */,
|
||||
@@ -1368,6 +1469,7 @@
|
||||
B5E84F231AFF84860064E85B /* ListMonitor.swift in Sources */,
|
||||
B5E84EF71AFF846E0064E85B /* UnsafeDataTransaction.swift in Sources */,
|
||||
B56964D41B22FFAD0075EE4A /* DataStack+Migration.swift in Sources */,
|
||||
B5ECDBE51CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B5519A4A1CA1F4FB002BEF78 /* CSError.swift in Sources */,
|
||||
B5E84EF51AFF846E0064E85B /* BaseDataTransaction.swift in Sources */,
|
||||
B5E84EFB1AFF846E0064E85B /* SaveResult.swift in Sources */,
|
||||
@@ -1382,7 +1484,7 @@
|
||||
B5E2222A1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
|
||||
B5E84F391AFF85470064E85B /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
B5E84EE81AFF84610064E85B /* CoreStoreLogger.swift in Sources */,
|
||||
B5E222311CA533A400BA2E95 /* CSImportableObject.swift in Sources */,
|
||||
B5ECDC2F1CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
|
||||
B5E84F311AFF849C0064E85B /* WeakObject.swift in Sources */,
|
||||
B5E84F101AFF847B0064E85B /* GroupBy.swift in Sources */,
|
||||
B5E84F201AFF84860064E85B /* DataStack+Observing.swift in Sources */,
|
||||
@@ -1391,11 +1493,13 @@
|
||||
B546F9691C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
B5E84F211AFF84860064E85B /* CoreStore+Observing.swift in Sources */,
|
||||
B5FE4DA71C84FB4400FA6A91 /* InMemoryStore.swift in Sources */,
|
||||
B5ECDBEC1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
B5E834B91B76311F001D3D50 /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
B5E84EE61AFF84610064E85B /* DefaultLogger.swift in Sources */,
|
||||
B5E84EF41AFF846E0064E85B /* AsynchronousDataTransaction.swift in Sources */,
|
||||
B5DBE2CD1C9914A900B5CEFA /* CSCoreStore.swift in Sources */,
|
||||
B546F95D1C9A12B800D5AC55 /* CSSQliteStore.swift in Sources */,
|
||||
B5ECDC0B1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
B5E84F151AFF847B0064E85B /* CoreStore+Querying.swift in Sources */,
|
||||
B5E84F241AFF84860064E85B /* ListObserver.swift in Sources */,
|
||||
B5E84F2E1AFF849C0064E85B /* AssociatedObjects.swift in Sources */,
|
||||
@@ -1422,6 +1526,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
82BA18B61C4BBD3F00A0916E /* DataStack+Querying.swift in Sources */,
|
||||
B5ECDBFB1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */,
|
||||
B5C976E81C6E3A5D00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
|
||||
82BA18A21C4BBD1D00A0916E /* CoreStoreError.swift in Sources */,
|
||||
82BA18B21C4BBD3900A0916E /* ImportableObject.swift in Sources */,
|
||||
@@ -1429,6 +1534,8 @@
|
||||
82BA18AE1C4BBD3100A0916E /* DataStack+Transaction.swift in Sources */,
|
||||
82BA18AB1C4BBD3100A0916E /* AsynchronousDataTransaction.swift in Sources */,
|
||||
82BA18CE1C4BBD7100A0916E /* FetchedResultsControllerDelegate.swift in Sources */,
|
||||
B5ECDC011CA80CBA00C7F112 /* CSWhere.swift in Sources */,
|
||||
B5ECDC071CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5519A601CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B5FE4DAD1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
82BA18C51C4BBD5300A0916E /* ListObserver.swift in Sources */,
|
||||
@@ -1436,9 +1543,12 @@
|
||||
B5D7A5B81CA3BF8F005C752B /* CSInto.swift in Sources */,
|
||||
82BA18A51C4BBD2200A0916E /* CoreStore+Setup.swift in Sources */,
|
||||
82BA18BD1C4BBD4A00A0916E /* GroupBy.swift in Sources */,
|
||||
B5ECDC1F1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B5C976E41C6C9F9A00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
|
||||
B5D3F6461C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
|
||||
B5ECDC251CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
82BA18B31C4BBD3900A0916E /* ImportableUniqueObject.swift in Sources */,
|
||||
B5ECDC2B1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
82BA18A11C4BBD1D00A0916E /* CoreStore.swift in Sources */,
|
||||
B546F9591C99B17400D5AC55 /* CSCoreStore+Setup.swift in Sources */,
|
||||
82BA18CF1C4BBD7100A0916E /* Functions.swift in Sources */,
|
||||
@@ -1452,6 +1562,7 @@
|
||||
82BA18B41C4BBD3900A0916E /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
82BA18CA1C4BBD5900A0916E /* MigrationResult.swift in Sources */,
|
||||
B5519A5A1CA2008C002BEF78 /* CSBaseDataTransaction.swift in Sources */,
|
||||
B5ECDBE11CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */,
|
||||
B546F96F1C9B14AC00D5AC55 /* CSStorageInterface.swift in Sources */,
|
||||
82BA18C11C4BBD5300A0916E /* CoreStore+Observing.swift in Sources */,
|
||||
82BA18BC1C4BBD4A00A0916E /* OrderBy.swift in Sources */,
|
||||
@@ -1459,6 +1570,7 @@
|
||||
82BA18D41C4BBD7100A0916E /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
82BA18D51C4BBD7100A0916E /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
B5FE4DA31C8481E100FA6A91 /* StorageInterface.swift in Sources */,
|
||||
B5ECDC131CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
82BA18C91C4BBD5900A0916E /* MigrationType.swift in Sources */,
|
||||
82BA18D01C4BBD7100A0916E /* MigrationManager.swift in Sources */,
|
||||
82BA18C61C4BBD5900A0916E /* DataStack+Migration.swift in Sources */,
|
||||
@@ -1470,6 +1582,7 @@
|
||||
82BA18A91C4BBD3100A0916E /* Into.swift in Sources */,
|
||||
82BA18D11C4BBD7100A0916E /* NotificationObserver.swift in Sources */,
|
||||
82BA18BB1C4BBD4A00A0916E /* Where.swift in Sources */,
|
||||
B5ECDBE71CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B5519A4B1CA1F4FB002BEF78 /* CSError.swift in Sources */,
|
||||
82BA18D71C4BBD7100A0916E /* NSManagedObjectModel+Setup.swift in Sources */,
|
||||
82BA18C31C4BBD5300A0916E /* ObjectObserver.swift in Sources */,
|
||||
@@ -1484,7 +1597,7 @@
|
||||
B5E2222C1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
|
||||
82BA18A71C4BBD2900A0916E /* CoreStore+Logging.swift in Sources */,
|
||||
82BA18D81C4BBD7100A0916E /* WeakObject.swift in Sources */,
|
||||
B5E222331CA533A400BA2E95 /* CSImportableObject.swift in Sources */,
|
||||
B5ECDC311CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
|
||||
82BA18AF1C4BBD3100A0916E /* CoreStore+Transaction.swift in Sources */,
|
||||
82BA18CB1C4BBD6400A0916E /* NSManagedObject+Convenience.swift in Sources */,
|
||||
82BA18B51C4BBD3F00A0916E /* BaseDataTransaction+Querying.swift in Sources */,
|
||||
@@ -1493,11 +1606,13 @@
|
||||
B546F96A1C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
82BA18A81C4BBD2900A0916E /* CoreStoreLogger.swift in Sources */,
|
||||
82BA18B81C4BBD4200A0916E /* ClauseTypes.swift in Sources */,
|
||||
B5ECDBEE1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
82BA18D61C4BBD7100A0916E /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
82BA18B91C4BBD4A00A0916E /* From.swift in Sources */,
|
||||
82BA18BE1C4BBD4A00A0916E /* Tweak.swift in Sources */,
|
||||
B5DBE2CE1C9914A900B5CEFA /* CSCoreStore.swift in Sources */,
|
||||
B546F95E1C9A12B800D5AC55 /* CSSQliteStore.swift in Sources */,
|
||||
B5ECDC0D1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
82BA18CC1C4BBD6400A0916E /* NSProgress+Convenience.swift in Sources */,
|
||||
82BA18C01C4BBD5300A0916E /* DataStack+Observing.swift in Sources */,
|
||||
82BA18A61C4BBD2900A0916E /* DefaultLogger.swift in Sources */,
|
||||
@@ -1525,10 +1640,15 @@
|
||||
files = (
|
||||
B5DBE2D01C9914A900B5CEFA /* CSCoreStore.swift in Sources */,
|
||||
B52DD1BE1BE1F94300949AFE /* NSProgress+Convenience.swift in Sources */,
|
||||
B5ECDC151CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
B546F9761C9C553300D5AC55 /* SetupResult.swift in Sources */,
|
||||
B5ECDC271CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B52DD1951BE1F92500949AFE /* CoreStoreError.swift in Sources */,
|
||||
B546F9601C9A12B800D5AC55 /* CSSQliteStore.swift in Sources */,
|
||||
B5ECDC0F1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
B5ECDC211CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B52DD1C21BE1F94600949AFE /* MigrationManager.swift in Sources */,
|
||||
B5ECDC2D1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B5D7A5BA1CA3BF8F005C752B /* CSInto.swift in Sources */,
|
||||
B5FEC1911C9166E700532541 /* NSPersistentStore+Setup.swift in Sources */,
|
||||
B52DD1AB1BE1F93900949AFE /* From.swift in Sources */,
|
||||
@@ -1538,16 +1658,19 @@
|
||||
B5D3F6481C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
|
||||
B52DD19E1BE1F92C00949AFE /* AsynchronousDataTransaction.swift in Sources */,
|
||||
B52DD1981BE1F92500949AFE /* CoreStore+Setup.swift in Sources */,
|
||||
B5ECDBF01CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
B52DD1941BE1F92500949AFE /* CoreStore.swift in Sources */,
|
||||
B52DD1A61BE1F92F00949AFE /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
B52DD1A91BE1F93200949AFE /* CoreStore+Querying.swift in Sources */,
|
||||
B5519A4D1CA1F4FB002BEF78 /* CSError.swift in Sources */,
|
||||
B52DD1961BE1F92500949AFE /* DataStack.swift in Sources */,
|
||||
B5ECDBFD1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */,
|
||||
B52DD1BD1BE1F94300949AFE /* NSManagedObject+Convenience.swift in Sources */,
|
||||
B52DD1AD1BE1F93900949AFE /* Where.swift in Sources */,
|
||||
B52DD1C41BE1F94600949AFE /* NSFileManager+Setup.swift in Sources */,
|
||||
B5ECDBE31CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */,
|
||||
B5ECDC031CA80CBA00C7F112 /* CSWhere.swift in Sources */,
|
||||
B52DD1AC1BE1F93900949AFE /* Select.swift in Sources */,
|
||||
B5E222351CA533A400BA2E95 /* CSImportableObject.swift in Sources */,
|
||||
B5FE4DAF1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
B52DD1C71BE1F94600949AFE /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
B52DD1C81BE1F94600949AFE /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
@@ -1555,7 +1678,9 @@
|
||||
B52DD1A81BE1F93200949AFE /* DataStack+Querying.swift in Sources */,
|
||||
B52DD1BC1BE1F94000949AFE /* MigrationResult.swift in Sources */,
|
||||
B52DD19D1BE1F92C00949AFE /* BaseDataTransaction.swift in Sources */,
|
||||
B5ECDBE91CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B52DD1B81BE1F94000949AFE /* DataStack+Migration.swift in Sources */,
|
||||
B5ECDC091CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B52DD1A51BE1F92F00949AFE /* ImportableUniqueObject.swift in Sources */,
|
||||
B5E222271CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */,
|
||||
B5519A621CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
@@ -1582,6 +1707,7 @@
|
||||
B52DD1A21BE1F92C00949AFE /* CoreStore+Transaction.swift in Sources */,
|
||||
B5E2222E1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
|
||||
B52DD1A01BE1F92C00949AFE /* UnsafeDataTransaction.swift in Sources */,
|
||||
B5ECDC331CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
|
||||
B52DD1BB1BE1F94000949AFE /* MigrationType.swift in Sources */,
|
||||
B52DD1C91BE1F94600949AFE /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
B52DD19B1BE1F92800949AFE /* CoreStoreLogger.swift in Sources */,
|
||||
@@ -1615,6 +1741,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B56321A91BD65219006C9394 /* NSProgress+Convenience.swift in Sources */,
|
||||
B5ECDBFC1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */,
|
||||
B5C976E91C6E3A5E00B1AF90 /* CoreStoreFetchedResultsController.swift in Sources */,
|
||||
B56321801BD65216006C9394 /* CoreStoreError.swift in Sources */,
|
||||
B56321AD1BD6521C006C9394 /* MigrationManager.swift in Sources */,
|
||||
@@ -1622,6 +1749,8 @@
|
||||
B563219D1BD65216006C9394 /* DataStack+Observing.swift in Sources */,
|
||||
B56321961BD65216006C9394 /* From.swift in Sources */,
|
||||
B56321AA1BD6521C006C9394 /* AssociatedObjects.swift in Sources */,
|
||||
B5ECDC021CA80CBA00C7F112 /* CSWhere.swift in Sources */,
|
||||
B5ECDC081CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5519A611CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */,
|
||||
B5FE4DAE1C85D44E00FA6A91 /* SQLiteStore.swift in Sources */,
|
||||
B563218C1BD65216006C9394 /* DataStack+Transaction.swift in Sources */,
|
||||
@@ -1629,9 +1758,12 @@
|
||||
B5D7A5B91CA3BF8F005C752B /* CSInto.swift in Sources */,
|
||||
B56321891BD65216006C9394 /* AsynchronousDataTransaction.swift in Sources */,
|
||||
B56321831BD65216006C9394 /* CoreStore+Setup.swift in Sources */,
|
||||
B5ECDC201CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B5C976E51C6C9F9B00B1AF90 /* UnsafeDataTransaction+Observing.swift in Sources */,
|
||||
B5D3F6471C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */,
|
||||
B5ECDC261CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B563217F1BD65216006C9394 /* CoreStore.swift in Sources */,
|
||||
B5ECDC2C1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B56321911BD65216006C9394 /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
B546F95A1C99B17400D5AC55 /* CSCoreStore+Setup.swift in Sources */,
|
||||
B56321941BD65216006C9394 /* CoreStore+Querying.swift in Sources */,
|
||||
@@ -1645,6 +1777,7 @@
|
||||
B56321AF1BD6521C006C9394 /* NSFileManager+Setup.swift in Sources */,
|
||||
B50392FA1C47963F009900CA /* NSManagedObject+Transaction.swift in Sources */,
|
||||
B5519A5B1CA2008C002BEF78 /* CSBaseDataTransaction.swift in Sources */,
|
||||
B5ECDBE21CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */,
|
||||
B546F9701C9B14AC00D5AC55 /* CSStorageInterface.swift in Sources */,
|
||||
B56321971BD65216006C9394 /* Select.swift in Sources */,
|
||||
B56321AB1BD6521C006C9394 /* FetchedResultsControllerDelegate.swift in Sources */,
|
||||
@@ -1652,6 +1785,7 @@
|
||||
B56321B21BD6521C006C9394 /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
B5FE4DA41C8481E100FA6A91 /* StorageInterface.swift in Sources */,
|
||||
B56321B31BD6521C006C9394 /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
B5ECDC141CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
B56321AE1BD6521C006C9394 /* NotificationObserver.swift in Sources */,
|
||||
B56321931BD65216006C9394 /* DataStack+Querying.swift in Sources */,
|
||||
B56321A71BD65216006C9394 /* MigrationResult.swift in Sources */,
|
||||
@@ -1663,6 +1797,7 @@
|
||||
B56321901BD65216006C9394 /* ImportableUniqueObject.swift in Sources */,
|
||||
B56321871BD65216006C9394 /* Into.swift in Sources */,
|
||||
B563219A1BD65216006C9394 /* GroupBy.swift in Sources */,
|
||||
B5ECDBE81CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B5519A4C1CA1F4FB002BEF78 /* CSError.swift in Sources */,
|
||||
B563219B1BD65216006C9394 /* Tweak.swift in Sources */,
|
||||
B56321B51BD6521C006C9394 /* NSManagedObjectModel+Setup.swift in Sources */,
|
||||
@@ -1677,7 +1812,7 @@
|
||||
B5E2222D1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
|
||||
B563219F1BD65216006C9394 /* ObjectMonitor.swift in Sources */,
|
||||
B56321B61BD6521C006C9394 /* WeakObject.swift in Sources */,
|
||||
B5E222341CA533A400BA2E95 /* CSImportableObject.swift in Sources */,
|
||||
B5ECDC321CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
|
||||
B56321AC1BD6521C006C9394 /* Functions.swift in Sources */,
|
||||
B56321851BD65216006C9394 /* CoreStore+Logging.swift in Sources */,
|
||||
B56321921BD65216006C9394 /* BaseDataTransaction+Querying.swift in Sources */,
|
||||
@@ -1686,11 +1821,13 @@
|
||||
B546F96B1C9AF26D00D5AC55 /* CSInMemoryStore.swift in Sources */,
|
||||
B563218B1BD65216006C9394 /* UnsafeDataTransaction.swift in Sources */,
|
||||
B56321A61BD65216006C9394 /* MigrationType.swift in Sources */,
|
||||
B5ECDBEF1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
B56321B41BD6521C006C9394 /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
B56321861BD65216006C9394 /* CoreStoreLogger.swift in Sources */,
|
||||
B56321841BD65216006C9394 /* DefaultLogger.swift in Sources */,
|
||||
B5DBE2CF1C9914A900B5CEFA /* CSCoreStore.swift in Sources */,
|
||||
B546F95F1C9A12B800D5AC55 /* CSSQliteStore.swift in Sources */,
|
||||
B5ECDC0E1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
B56321A41BD65216006C9394 /* CoreStore+Migration.swift in Sources */,
|
||||
B56321A01BD65216006C9394 /* ObjectObserver.swift in Sources */,
|
||||
B56321951BD65216006C9394 /* ClauseTypes.swift in Sources */,
|
||||
@@ -1701,6 +1838,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B5ECDC0C1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
|
||||
B5EA11DD1CA3AFD9002282F8 /* NSPersistentStoreCoordinator+Setup.swift in Sources */,
|
||||
B5D9E2EF1CA2C317007A9D52 /* ObjectMonitor.swift in Sources */,
|
||||
B59983491CA54BC100E1A417 /* CSBaseDataTransaction.swift in Sources */,
|
||||
@@ -1720,13 +1858,16 @@
|
||||
B5D9E2F81CA2C317007A9D52 /* SectionBy.swift in Sources */,
|
||||
B5D9E2F91CA2C317007A9D52 /* NSManagedObjectContext+Transaction.swift in Sources */,
|
||||
B5D9E2FA1CA2C317007A9D52 /* UnsafeDataTransaction+Observing.swift in Sources */,
|
||||
B5ECDC061CA8138100C7F112 /* CSOrderBy.swift in Sources */,
|
||||
B5D9E2FB1CA2C317007A9D52 /* MigrationChain.swift in Sources */,
|
||||
B5D9E2FC1CA2C317007A9D52 /* Tweak.swift in Sources */,
|
||||
B5D9E2FD1CA2C317007A9D52 /* OrderBy.swift in Sources */,
|
||||
B5D9E2FE1CA2C317007A9D52 /* NSManagedObjectContext+Setup.swift in Sources */,
|
||||
B5D9E2FF1CA2C317007A9D52 /* CoreStore+Migration.swift in Sources */,
|
||||
B5D9E3001CA2C317007A9D52 /* CoreStore+Logging.swift in Sources */,
|
||||
B5ECDC1E1CA81A2100C7F112 /* CSDataStack+Querying.swift in Sources */,
|
||||
B5D9E3011CA2C317007A9D52 /* Into.swift in Sources */,
|
||||
B5ECDC301CA81CDC00C7F112 /* CSCoreStore+Transaction.swift in Sources */,
|
||||
B5D9E3021CA2C317007A9D52 /* Select.swift in Sources */,
|
||||
B5D7A5B41CA3BAE7005C752B /* NSPersistentStore+Setup.swift in Sources */,
|
||||
B5D9E3031CA2C317007A9D52 /* NSManagedObject+Transaction.swift in Sources */,
|
||||
@@ -1745,10 +1886,13 @@
|
||||
B5D9E3101CA2C317007A9D52 /* Functions.swift in Sources */,
|
||||
B5D9E3431CA2C6C4007A9D52 /* GCDBlock.swift in Sources */,
|
||||
B5D9E3111CA2C317007A9D52 /* ListMonitor.swift in Sources */,
|
||||
B5ECDC2A1CA81CC700C7F112 /* CSDataStack+Transaction.swift in Sources */,
|
||||
B5E222241CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */,
|
||||
B5D9E3121CA2C317007A9D52 /* UnsafeDataTransaction.swift in Sources */,
|
||||
B5ECDBE01CA6BB2B00C7F112 /* CSBaseDataTransaction+Querying.swift in Sources */,
|
||||
B5D9E3131CA2C317007A9D52 /* DataStack+Migration.swift in Sources */,
|
||||
B5D9E3141CA2C317007A9D52 /* BaseDataTransaction.swift in Sources */,
|
||||
B5ECDC241CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
|
||||
B5D9E3151CA2C317007A9D52 /* SaveResult.swift in Sources */,
|
||||
B529C2051CA4A2DB007E7EBD /* CSSaveResult.swift in Sources */,
|
||||
B5D9E3161CA2C317007A9D52 /* From.swift in Sources */,
|
||||
@@ -1756,20 +1900,24 @@
|
||||
B5D9E3171CA2C317007A9D52 /* NSFileManager+Setup.swift in Sources */,
|
||||
B5D9E3181CA2C317007A9D52 /* NSProgress+Convenience.swift in Sources */,
|
||||
B5D9E3191CA2C317007A9D52 /* SynchronousDataTransaction.swift in Sources */,
|
||||
B5ECDBE61CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
|
||||
B5D9E31A1CA2C317007A9D52 /* NSManagedObject+Convenience.swift in Sources */,
|
||||
B5D9E31B1CA2C317007A9D52 /* NSManagedObjectModel+Setup.swift in Sources */,
|
||||
B5D7A5B01CA3B738005C752B /* StorageInterface.swift in Sources */,
|
||||
B5ECDBED1CA6BF2000C7F112 /* CSFrom.swift in Sources */,
|
||||
B5D9E3441CA2C6C4007A9D52 /* GCDGroup.swift in Sources */,
|
||||
B5D9E31C1CA2C317007A9D52 /* NSManagedObjectContext+Querying.swift in Sources */,
|
||||
B5ECDC001CA80CBA00C7F112 /* CSWhere.swift in Sources */,
|
||||
B5ECDC121CA816E500C7F112 /* CSTweak.swift in Sources */,
|
||||
B5D9E31D1CA2C317007A9D52 /* CoreStoreLogger.swift in Sources */,
|
||||
B5D9E31E1CA2C317007A9D52 /* WeakObject.swift in Sources */,
|
||||
B5D7A5B21CA3B738005C752B /* SQLiteStore.swift in Sources */,
|
||||
B5D9E3471CA2C6C4007A9D52 /* GCDSemaphore.swift in Sources */,
|
||||
B5D9E31F1CA2C317007A9D52 /* GroupBy.swift in Sources */,
|
||||
B5D9E3201CA2C317007A9D52 /* DataStack+Observing.swift in Sources */,
|
||||
B5ECDBFA1CA804FD00C7F112 /* NSManagedObjectContext+ObjectiveC.swift in Sources */,
|
||||
B5D9E3211CA2C317007A9D52 /* CoreStore+Transaction.swift in Sources */,
|
||||
B5D9E3221CA2C317007A9D52 /* NSManagedObjectContext+CoreStore.swift in Sources */,
|
||||
B5E222321CA533A400BA2E95 /* CSImportableObject.swift in Sources */,
|
||||
B5D9E3481CA2C6C4007A9D52 /* GCDTimer.swift in Sources */,
|
||||
B5D9E3231CA2C317007A9D52 /* CoreStore+Observing.swift in Sources */,
|
||||
B5D9E3241CA2C317007A9D52 /* BaseDataTransaction+Importing.swift in Sources */,
|
||||
|
||||
@@ -103,12 +103,7 @@ public extension BaseDataTransaction {
|
||||
@warn_unused_result
|
||||
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchOne(from, fetchClauses)
|
||||
return self.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +120,6 @@ public extension BaseDataTransaction {
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -139,12 +133,7 @@ public extension BaseDataTransaction {
|
||||
@warn_unused_result
|
||||
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchAll(from, fetchClauses)
|
||||
return self.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +150,6 @@ public extension BaseDataTransaction {
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -175,12 +163,7 @@ public extension BaseDataTransaction {
|
||||
@warn_unused_result
|
||||
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchCount(from, fetchClauses)
|
||||
return self.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,12 +194,7 @@ public extension BaseDataTransaction {
|
||||
@warn_unused_result
|
||||
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchObjectID(from, fetchClauses)
|
||||
return self.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,7 +211,6 @@ public extension BaseDataTransaction {
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -247,12 +224,7 @@ public extension BaseDataTransaction {
|
||||
@warn_unused_result
|
||||
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchObjectIDs(from, fetchClauses)
|
||||
return self.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,7 +241,6 @@ public extension BaseDataTransaction {
|
||||
self.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
return self.context.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import CoreData
|
||||
let person = transaction.fetchOne(From<MyPersonEntity>("Configuration1"))
|
||||
```
|
||||
*/
|
||||
public struct From<T: NSManagedObject> {
|
||||
public struct From<T: NSManagedObject>: Hashable {
|
||||
|
||||
/**
|
||||
Initializes a `From` clause.
|
||||
@@ -299,8 +299,20 @@ public struct From<T: NSManagedObject> {
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
|
||||
return ObjectIdentifier(self.entityClass).hashValue
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal
|
||||
|
||||
internal let entityClass: AnyClass
|
||||
|
||||
internal let findPersistentStores: (context: NSManagedObjectContext) -> [NSPersistentStore]?
|
||||
|
||||
internal func applyToFetchRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext, applyAffectedStores: Bool = true) {
|
||||
|
||||
fetchRequest.entity = context.entityDescriptionForEntityClass(self.entityClass)
|
||||
@@ -317,58 +329,77 @@ public struct From<T: NSManagedObject> {
|
||||
return stores?.isEmpty == false
|
||||
}
|
||||
|
||||
internal init(entityClass: AnyClass, findPersistentStores: (context: NSManagedObjectContext) -> [NSPersistentStore]?) {
|
||||
|
||||
self.entityClass = entityClass
|
||||
self.findPersistentStores = findPersistentStores
|
||||
}
|
||||
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let entityClass: AnyClass
|
||||
|
||||
private let findPersistentStores: (context: NSManagedObjectContext) -> [NSPersistentStore]?
|
||||
|
||||
private init(entityClass: AnyClass) {
|
||||
|
||||
self.entityClass = entityClass
|
||||
self.findPersistentStores = { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)
|
||||
}
|
||||
self.init(
|
||||
entityClass: entityClass,
|
||||
findPersistentStores: { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private init(entityClass: AnyClass, configurations: [String?]) {
|
||||
|
||||
let configurationsSet = Set(configurations.map { $0 ?? Into.defaultConfigurationName })
|
||||
self.entityClass = entityClass
|
||||
self.findPersistentStores = { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
self.init(
|
||||
entityClass: entityClass,
|
||||
findPersistentStores: { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return configurationsSet.contains($0.configurationName)
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
|
||||
return configurationsSet.contains($0.configurationName)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private init(entityClass: AnyClass, storeURLs: [NSURL]) {
|
||||
|
||||
let storeURLsSet = Set(storeURLs)
|
||||
self.entityClass = entityClass
|
||||
self.findPersistentStores = { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
self.init(
|
||||
entityClass: entityClass,
|
||||
findPersistentStores: { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return $0.URL != nil && storeURLsSet.contains($0.URL!)
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
|
||||
return $0.URL != nil && storeURLsSet.contains($0.URL!)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private init(entityClass: AnyClass, persistentStores: [NSPersistentStore]) {
|
||||
|
||||
let persistentStores = Set(persistentStores)
|
||||
self.entityClass = entityClass
|
||||
self.findPersistentStores = { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
self.init(
|
||||
entityClass: entityClass,
|
||||
findPersistentStores: { (context: NSManagedObjectContext) -> [NSPersistentStore]? in
|
||||
|
||||
return persistentStores.contains($0)
|
||||
return context.parentStack?.persistentStoresForEntityClass(entityClass)?.filter {
|
||||
|
||||
return persistentStores.contains($0)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - From: Equatable
|
||||
|
||||
@warn_unused_result
|
||||
public func == <T: NSManagedObject, U: NSManagedObject>(lhs: From<T>, rhs: From<U>) -> Bool {
|
||||
|
||||
return lhs.entityClass == rhs.entityClass
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import CoreData
|
||||
/**
|
||||
The `GroupBy` clause specifies that the result of a query be grouped accoording to the specified key path.
|
||||
*/
|
||||
public struct GroupBy: QueryClause {
|
||||
public struct GroupBy: QueryClause, Hashable {
|
||||
|
||||
/**
|
||||
Initializes a `GroupBy` clause with a list of key path strings
|
||||
@@ -80,4 +80,21 @@ public struct GroupBy: QueryClause {
|
||||
|
||||
fetchRequest.propertiesToGroupBy = self.keyPaths
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
|
||||
return (self.keyPaths as NSArray).hashValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - GroupBy: Equatable
|
||||
|
||||
@warn_unused_result
|
||||
public func == (lhs: GroupBy, rhs: GroupBy) -> Bool {
|
||||
|
||||
return lhs.keyPaths == rhs.keyPaths
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public enum SortKey {
|
||||
/**
|
||||
The `OrderBy` clause specifies the sort order for results for a fetch or a query.
|
||||
*/
|
||||
public struct OrderBy: FetchClause, QueryClause, DeleteClause {
|
||||
public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
|
||||
|
||||
/**
|
||||
Initializes a `OrderBy` clause with a list of sort descriptors
|
||||
@@ -147,4 +147,21 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause {
|
||||
|
||||
fetchRequest.sortDescriptors = self.sortDescriptors
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
|
||||
return (self.sortDescriptors as NSArray).hashValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - OrderBy: Equatable
|
||||
|
||||
@warn_unused_result
|
||||
public func == (lhs: OrderBy, rhs: OrderBy) -> Bool {
|
||||
|
||||
return lhs.sortDescriptors == rhs.sortDescriptors
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public prefix func !(clause: Where) -> Where {
|
||||
/**
|
||||
The `Where` clause specifies the conditions for a fetch or a query.
|
||||
*/
|
||||
public struct Where: FetchClause, QueryClause, DeleteClause {
|
||||
public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
|
||||
|
||||
/**
|
||||
Initializes a `Where` clause with an `NSPredicate`
|
||||
@@ -152,4 +152,21 @@ public struct Where: FetchClause, QueryClause, DeleteClause {
|
||||
|
||||
fetchRequest.predicate = self.predicate
|
||||
}
|
||||
|
||||
|
||||
// MARK: Hashable
|
||||
|
||||
public var hashValue: Int {
|
||||
|
||||
return self.predicate.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Where: Equatable
|
||||
|
||||
@warn_unused_result
|
||||
public func == (lhs: Where, rhs: Where) -> Bool {
|
||||
|
||||
return lhs.predicate == rhs.predicate
|
||||
}
|
||||
|
||||
@@ -110,7 +110,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -128,7 +127,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -146,7 +144,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -164,7 +161,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -182,7 +178,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -200,7 +195,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -218,7 +212,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -236,7 +229,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -254,7 +246,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -272,7 +263,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
@@ -293,7 +283,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to query from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.queryValue(from, selectClause, queryClauses)
|
||||
}
|
||||
|
||||
@@ -314,7 +303,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to query from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.queryValue(from, selectClause, queryClauses)
|
||||
}
|
||||
|
||||
@@ -335,7 +323,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to query from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.queryAttributes(from, selectClause, queryClauses)
|
||||
}
|
||||
|
||||
@@ -356,7 +343,6 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to query from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
|
||||
return self.mainContext.queryAttributes(from, selectClause, queryClauses)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,9 @@ import CoreData
|
||||
|
||||
internal extension NSManagedObjectContext {
|
||||
|
||||
// MARK: Internal
|
||||
// MARK: Internal: Fetch Existing
|
||||
|
||||
@nonobjc
|
||||
internal func fetchExisting<T: NSManagedObject>(object: T) -> T? {
|
||||
|
||||
if object.objectID.temporaryID {
|
||||
@@ -69,11 +70,16 @@ internal extension NSManagedObjectContext {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Fetch One
|
||||
|
||||
@nonobjc
|
||||
internal func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
|
||||
|
||||
return self.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -81,11 +87,13 @@ internal extension NSManagedObjectContext {
|
||||
|
||||
fetchRequest.fetchLimit = 1
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in fetchClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.fetchOne(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchOne<T: NSManagedObject>(fetchRequest: NSFetchRequest) -> T? {
|
||||
|
||||
var fetchResults: [T]?
|
||||
var fetchError: ErrorType?
|
||||
@@ -112,11 +120,16 @@ internal extension NSManagedObjectContext {
|
||||
return fetchResults?.first
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Fetch All
|
||||
|
||||
@nonobjc
|
||||
internal func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
|
||||
|
||||
return self.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -124,11 +137,13 @@ internal extension NSManagedObjectContext {
|
||||
|
||||
fetchRequest.fetchLimit = 0
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in fetchClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.fetchAll(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchAll<T: NSManagedObject>(fetchRequest: NSFetchRequest) -> [T]? {
|
||||
|
||||
var fetchResults: [T]?
|
||||
var fetchError: ErrorType?
|
||||
@@ -155,20 +170,27 @@ internal extension NSManagedObjectContext {
|
||||
return fetchResults
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Count
|
||||
|
||||
@nonobjc
|
||||
internal func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
|
||||
|
||||
return self.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.applyToFetchRequest(fetchRequest, context: self)
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in fetchClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.fetchCount(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchCount(fetchRequest: NSFetchRequest) -> Int? {
|
||||
|
||||
var count = 0
|
||||
var error: NSError?
|
||||
@@ -188,11 +210,16 @@ internal extension NSManagedObjectContext {
|
||||
return count
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Object ID
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
|
||||
|
||||
return self.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -200,11 +227,13 @@ internal extension NSManagedObjectContext {
|
||||
|
||||
fetchRequest.fetchLimit = 1
|
||||
fetchRequest.resultType = .ManagedObjectIDResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in fetchClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.fetchObjectID(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectID(fetchRequest: NSFetchRequest) -> NSManagedObjectID? {
|
||||
|
||||
var fetchResults: [NSManagedObjectID]?
|
||||
var fetchError: ErrorType?
|
||||
@@ -231,11 +260,16 @@ internal extension NSManagedObjectContext {
|
||||
return fetchResults?.first
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Object IDs
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
|
||||
|
||||
return self.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -243,11 +277,13 @@ internal extension NSManagedObjectContext {
|
||||
|
||||
fetchRequest.fetchLimit = 0
|
||||
fetchRequest.resultType = .ManagedObjectIDResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in fetchClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.fetchObjectIDs(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectIDs(fetchRequest: NSFetchRequest) -> [NSManagedObjectID]? {
|
||||
|
||||
var fetchResults: [NSManagedObjectID]?
|
||||
var fetchError: ErrorType?
|
||||
@@ -274,11 +310,16 @@ internal extension NSManagedObjectContext {
|
||||
return fetchResults
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Delete All
|
||||
|
||||
@nonobjc
|
||||
internal func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: DeleteClause...) -> Int? {
|
||||
|
||||
return self.deleteAll(from, deleteClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -288,11 +329,13 @@ internal extension NSManagedObjectContext {
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchRequest.returnsObjectsAsFaults = true
|
||||
fetchRequest.includesPropertyValues = false
|
||||
deleteClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
for clause in deleteClauses {
|
||||
|
||||
clause.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
return self.deleteAll(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func deleteAll(fetchRequest: NSFetchRequest) -> Int? {
|
||||
|
||||
var numberOfDeletedObjects: Int?
|
||||
var fetchError: ErrorType?
|
||||
@@ -302,7 +345,7 @@ internal extension NSManagedObjectContext {
|
||||
|
||||
do {
|
||||
|
||||
let fetchResults = try self.executeFetchRequest(fetchRequest) as? [T] ?? []
|
||||
let fetchResults = try self.executeFetchRequest(fetchRequest) as? [NSManagedObject] ?? []
|
||||
for object in fetchResults {
|
||||
|
||||
self.deleteObject(object)
|
||||
@@ -327,11 +370,16 @@ internal extension NSManagedObjectContext {
|
||||
return numberOfDeletedObjects
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Value
|
||||
|
||||
@nonobjc
|
||||
internal func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
|
||||
|
||||
return self.queryValue(from, selectClause, queryClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
@@ -376,11 +424,16 @@ internal extension NSManagedObjectContext {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// MARK: Internal: Attributes
|
||||
|
||||
@nonobjc
|
||||
internal func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
|
||||
|
||||
return self.queryAttributes(from, selectClause, queryClauses)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
|
||||
206
Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift
Normal file
206
Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift
Normal file
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// CSBaseDataTransaction+Querying.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSBaseDataTransaction
|
||||
|
||||
public extension CSBaseDataTransaction {
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter object: a reference to the object created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
|
||||
do {
|
||||
|
||||
return try self.swift.context.existingObjectWithID(object.objectID)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instance in the transaction's context from an `NSManagedObjectID`.
|
||||
|
||||
- parameter objectID: the `NSManagedObjectID` for the object
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
|
||||
do {
|
||||
|
||||
return try self.swift.context.existingObjectWithID(objectID)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instances in the transaction's context from references created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter objects: an array of `NSManagedObject`s created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjects(objects: [NSManagedObject]) -> [NSManagedObject] {
|
||||
|
||||
return objects.flatMap { try? self.swift.context.existingObjectWithID($0.objectID) }
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instances in the transaction's context from a list of `NSManagedObjectID`.
|
||||
|
||||
- parameter objectIDs: the `NSManagedObjectID` array for the objects
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [NSManagedObject] {
|
||||
|
||||
return objectIDs.flatMap { try? self.swift.context.existingObjectWithID($0) }
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObject]? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the number of `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchObjectIDsFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Deletes all `NSManagedObject`s that satisfy the specified `DeleteClause`s. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter deleteClauses: a series of `DeleteClause` instances for the delete request. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
- returns: the number of `NSManagedObject`s deleted
|
||||
*/
|
||||
@objc
|
||||
public func deleteAllFrom(from: CSFrom, deleteClauses: [CSDeleteClause]) -> NSNumber? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.swift.isRunningInAllowedQueue(),
|
||||
"Attempted to delete from a \(typeName(self)) outside its designated queue."
|
||||
)
|
||||
return self.swift.context.deleteAll(from, deleteClauses)
|
||||
}
|
||||
}
|
||||
66
Sources/ObjectiveC/CSClauseTypes.swift
Normal file
66
Sources/ObjectiveC/CSClauseTypes.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// CSClauseTypes.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSFetchClause
|
||||
|
||||
/**
|
||||
The `CSFetchClause` implement clauses used to configure `NSFetchRequest`s.
|
||||
*/
|
||||
@objc
|
||||
public protocol CSFetchClause {
|
||||
|
||||
@objc
|
||||
func applyToFetchRequest(fetchRequest: NSFetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - CSQueryClause
|
||||
|
||||
/**
|
||||
The `CSQueryClause` implement clauses used to configure `NSFetchRequest`s.
|
||||
*/
|
||||
@objc
|
||||
public protocol CSQueryClause {
|
||||
|
||||
@objc
|
||||
func applyToFetchRequest(fetchRequest: NSFetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - CSDeleteClause
|
||||
|
||||
/**
|
||||
The `CSDeleteClause` implement clauses used to configure `NSFetchRequest`s.
|
||||
*/
|
||||
@objc
|
||||
public protocol CSDeleteClause {
|
||||
|
||||
@objc
|
||||
func applyToFetchRequest(fetchRequest: NSFetchRequest)
|
||||
}
|
||||
168
Sources/ObjectiveC/CSCoreStore+Querying.swift
Normal file
168
Sources/ObjectiveC/CSCoreStore+Querying.swift
Normal file
@@ -0,0 +1,168 @@
|
||||
//
|
||||
// CSCoreStore+Querying.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSCoreStore
|
||||
|
||||
public extension CSCoreStore {
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter object: a reference to the object created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
|
||||
return self.defaultStack.fetchExistingObject(object)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObject` instance in the transaction's context from an `NSManagedObjectID`.
|
||||
|
||||
- parameter objectID: the `NSManagedObjectID` for the object
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
|
||||
return self.defaultStack.fetchExistingObjectWithID(objectID)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObject` instances in the transaction's context from references created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter objects: an array of `NSManagedObject`s created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObjects(objects: [NSManagedObject]) -> [NSManagedObject] {
|
||||
|
||||
return self.defaultStack.fetchExistingObjects(objects)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObject` instances in the transaction's context from a list of `NSManagedObjectID`.
|
||||
|
||||
- parameter objectIDs: the `NSManagedObjectID` array for the objects
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [NSManagedObject] {
|
||||
|
||||
return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
|
||||
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObject]? {
|
||||
|
||||
return self.defaultStack.fetchAllFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the number of `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||
|
||||
return self.defaultStack.fetchCountFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||
|
||||
return self.defaultStack.fetchObjectIDFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, fetches the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchObjectIDsFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||
|
||||
return self.defaultStack.fetchObjectIDsFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, deletes all `NSManagedObject`s that satisfy the specified `DeleteClause`s. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter deleteClauses: a series of `DeleteClause` instances for the delete request. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
- returns: the number of `NSManagedObject`s deleted
|
||||
*/
|
||||
@objc
|
||||
public static func deleteAllFrom(from: CSFrom, deleteClauses: [CSDeleteClause]) -> NSNumber? {
|
||||
|
||||
return self.defaultStack.deleteAllFrom(from, deleteClauses: deleteClauses)
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public extension CSCoreStore {
|
||||
@objc
|
||||
public class var modelVersion: String {
|
||||
|
||||
return CoreStore.defaultStack.modelVersion
|
||||
return CoreStore.modelVersion
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public extension CSCoreStore {
|
||||
@objc
|
||||
public static var entityClassesByName: [String: NSManagedObject.Type] {
|
||||
|
||||
return CoreStore.defaultStack.entityTypesByName
|
||||
return CoreStore.entityTypesByName
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public extension CSCoreStore {
|
||||
@objc
|
||||
public static func entityClassWithName(name: String) -> NSManagedObject.Type? {
|
||||
|
||||
return CoreStore.defaultStack.entityTypesByName[name]
|
||||
return CoreStore.entityTypesByName[name]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public extension CSCoreStore {
|
||||
@objc
|
||||
public static func entityDescriptionForClass(type: NSManagedObject.Type) -> NSEntityDescription? {
|
||||
|
||||
return CoreStore.defaultStack.entityDescriptionForType(type)
|
||||
return CoreStore.entityDescriptionForType(type)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ public extension CSCoreStore {
|
||||
|
||||
return try bridge {
|
||||
|
||||
try CoreStore.defaultStack.addStorageAndWait(InMemoryStore)
|
||||
try CoreStore.addStorageAndWait(InMemoryStore)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public extension CSCoreStore {
|
||||
|
||||
return try bridge {
|
||||
|
||||
try CoreStore.defaultStack.addStorageAndWait(SQLiteStore)
|
||||
try CoreStore.addStorageAndWait(SQLiteStore)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public extension CSCoreStore {
|
||||
|
||||
return try bridge {
|
||||
|
||||
try CoreStore.defaultStack.addStorageAndWait(storage.swift)
|
||||
try CoreStore.addStorageAndWait(storage.swift)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public extension CSCoreStore {
|
||||
|
||||
return try bridge {
|
||||
|
||||
try CoreStore.defaultStack.addStorageAndWait(storage.swift)
|
||||
try CoreStore.addStorageAndWait(storage.swift)
|
||||
}
|
||||
}
|
||||
}
|
||||
105
Sources/ObjectiveC/CSCoreStore+Transaction.swift
Normal file
105
Sources/ObjectiveC/CSCoreStore+Transaction.swift
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// CSCoreStore+Transaction.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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
|
||||
|
||||
|
||||
// MARK: - CSCoreStore
|
||||
|
||||
public extension CSCoreStore {
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made.
|
||||
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
*/
|
||||
@objc
|
||||
public static func beginAsynchronous(closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
|
||||
return CoreStore.beginAsynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.objc)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, begins a transaction synchronously where `NSManagedObject` creates, updates, and deletes can be made.
|
||||
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||
*/
|
||||
@objc
|
||||
public static func beginSynchronous(closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
CoreStore.beginSynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.objc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
|
||||
|
||||
To support "undo" methods such as `-undo`, `-redo`, and `-rollback`, use the `-beginSafeWithSupportsUndo:` method passing `YES` to the argument. Without "undo" support, calling those methods will raise an exception.
|
||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func beginUnsafe() -> CSUnsafeDataTransaction {
|
||||
|
||||
return bridge {
|
||||
|
||||
CoreStore.beginUnsafe()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Using the `defaultStack`, begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
|
||||
|
||||
- prameter supportsUndo: `-undo`, `-redo`, and `-rollback` methods are only available when this parameter is `YES`, otherwise those method will raise an exception. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
|
||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func beginUnsafeWithSupportsUndo(supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
||||
|
||||
return bridge {
|
||||
|
||||
CoreStore.beginUnsafe(supportsUndo: supportsUndo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Refreshes all registered objects `NSManagedObject`s in the `defaultStack`.
|
||||
*/
|
||||
@objc
|
||||
public static func refreshAllObjectsAsFaults() {
|
||||
|
||||
CoreStore.refreshAllObjectsAsFaults()
|
||||
}
|
||||
}
|
||||
206
Sources/ObjectiveC/CSDataStack+Querying.swift
Normal file
206
Sources/ObjectiveC/CSDataStack+Querying.swift
Normal file
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// CSDataStack+Querying.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSDataStack
|
||||
|
||||
public extension CSDataStack {
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter object: a reference to the object created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
|
||||
do {
|
||||
|
||||
return try self.swift.mainContext.existingObjectWithID(object.objectID)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instance in the transaction's context from an `NSManagedObjectID`.
|
||||
|
||||
- parameter objectID: the `NSManagedObjectID` for the object
|
||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
|
||||
do {
|
||||
|
||||
return try self.swift.mainContext.existingObjectWithID(objectID)
|
||||
}
|
||||
catch _ {
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instances in the transaction's context from references created from a transaction or from a different managed object context.
|
||||
|
||||
- parameter objects: an array of `NSManagedObject`s created/fetched outside the transaction
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjects(objects: [NSManagedObject]) -> [NSManagedObject] {
|
||||
|
||||
return objects.flatMap { try? self.swift.mainContext.existingObjectWithID($0.objectID) }
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObject` instances in the transaction's context from a list of `NSManagedObjectID`.
|
||||
|
||||
- parameter objectIDs: the `NSManagedObjectID` array for the objects
|
||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [NSManagedObject] {
|
||||
|
||||
return objectIDs.flatMap { try? self.swift.mainContext.existingObjectWithID($0) }
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.fetchOne(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObject]? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.fetchAll(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the number of `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.fetchCount(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.fetchObjectID(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Fetches the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
|
||||
- parameter from: a `CSFrom` clause indicating the entity type
|
||||
- parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
|
||||
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchObjectIDsFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to fetch from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.fetchObjectIDs(from, fetchClauses)
|
||||
}
|
||||
|
||||
/**
|
||||
Deletes all `NSManagedObject`s that satisfy the specified `DeleteClause`s. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
|
||||
- parameter from: a `From` clause indicating the entity type
|
||||
- parameter deleteClauses: a series of `DeleteClause` instances for the delete request. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
|
||||
- returns: the number of `NSManagedObject`s deleted
|
||||
*/
|
||||
@objc
|
||||
public func deleteAllFrom(from: CSFrom, deleteClauses: [CSDeleteClause]) -> NSNumber? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to delete from a \(typeName(self)) outside the main thread."
|
||||
)
|
||||
return self.swift.mainContext.deleteAll(from, deleteClauses)
|
||||
}
|
||||
}
|
||||
105
Sources/ObjectiveC/CSDataStack+Transaction.swift
Normal file
105
Sources/ObjectiveC/CSDataStack+Transaction.swift
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// CSDataStack+Transaction.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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
|
||||
|
||||
|
||||
// MARK: - CSDataStack
|
||||
|
||||
public extension CSDataStack {
|
||||
|
||||
/**
|
||||
Begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made.
|
||||
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
*/
|
||||
@objc
|
||||
public func beginAsynchronous(closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
|
||||
return self.swift.beginAsynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.objc)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Begins a transaction synchronously where `NSManagedObject` creates, updates, and deletes can be made.
|
||||
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||
*/
|
||||
@objc
|
||||
public func beginSynchronous(closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
self.swift.beginSynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.objc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
|
||||
|
||||
To support "undo" methods such as `-undo`, `-redo`, and `-rollback`, use the `-beginSafeWithSupportsUndo:` method passing `YES` to the argument. Without "undo" support, calling those methods will raise an exception.
|
||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func beginUnsafe() -> CSUnsafeDataTransaction {
|
||||
|
||||
return bridge {
|
||||
|
||||
self.swift.beginUnsafe()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
|
||||
|
||||
- prameter supportsUndo: `-undo`, `-redo`, and `-rollback` methods are only available when this parameter is `YES`, otherwise those method will raise an exception. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
|
||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func beginUnsafeWithSupportsUndo(supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
||||
|
||||
return bridge {
|
||||
|
||||
self.swift.beginUnsafe(supportsUndo: supportsUndo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Refreshes all registered objects `NSManagedObject`s in the `DataStack`.
|
||||
*/
|
||||
@objc
|
||||
public func refreshAllObjectsAsFaults() {
|
||||
|
||||
self.swift.refreshAllObjectsAsFaults()
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import CoreData
|
||||
// MARK: - CSError
|
||||
|
||||
/**
|
||||
The `CSError` provides a facade for CoreStore Objective-C constants.
|
||||
The `CSError` provides a facade for global CoreStore error declarations.
|
||||
*/
|
||||
public final class CSError: NSObject {
|
||||
|
||||
|
||||
151
Sources/ObjectiveC/CSFrom.swift
Normal file
151
Sources/ObjectiveC/CSFrom.swift
Normal file
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// CSFrom.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSFrom
|
||||
|
||||
/**
|
||||
The `CSFrom` serves as the Objective-C bridging type for `From`.
|
||||
*/
|
||||
@objc
|
||||
public final class CSFrom: NSObject, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSFrom` clause with the specified entity class.
|
||||
```
|
||||
MyPersonEntity *people = [transaction fetchAllFrom:[CSFrom entityClass:[MyPersonEntity class]]];
|
||||
```
|
||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||
- returns: a `CSFrom` clause with the specified entity class
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass) -> CSFrom {
|
||||
|
||||
return self.init(From(entityClass))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSFrom` clause with the specified configurations.
|
||||
```
|
||||
MyPersonEntity *people = [transaction fetchAllFrom:[CSFrom entityClass:[MyPersonEntity class] configuration:@"Configuration1"]];
|
||||
```
|
||||
- parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
|
||||
- parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter)
|
||||
- returns: a `CSFrom` clause with the specified configurations
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass, configuration: String?) -> CSFrom {
|
||||
|
||||
return self.init(From(entityClass, configuration))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSFrom` clause with the specified configurations.
|
||||
```
|
||||
MyPersonEntity *people = [transaction fetchAllFrom:[CSFrom entityClass:[MyPersonEntity class] configurations:@[[NSNull null], @"Configuration1"]]];
|
||||
```
|
||||
- parameter entity: the associated `NSManagedObject` entity class
|
||||
- parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `[NSNull null]` to use the default configuration.
|
||||
- returns: a `CSFrom` clause with the specified configurations
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass, configurations: [AnyObject]) -> CSFrom {
|
||||
|
||||
return self.init(From(entityClass, configurations.map { $0 is NSNull ? nil : ($0 as! String) }))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSFrom` clause with the specified store URLs.
|
||||
|
||||
- parameter entity: the associated `NSManagedObject` entity class
|
||||
- parameter storeURLs: the persistent store URLs to associate objects from.
|
||||
- returns: a `CSFrom` clause with the specified store URLs
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass, storeURLs: [NSURL]) -> CSFrom {
|
||||
|
||||
return self.init(From(entityClass, storeURLs))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSFrom` clause with the specified `NSPersistentStore`s.
|
||||
|
||||
- parameter entity: the associated `NSManagedObject` entity class
|
||||
- parameter persistentStores: the `NSPersistentStore`s to associate objects from.
|
||||
- returns: a `CSFrom` clause with the specified `NSPersistentStore`s
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass, persistentStores: [NSPersistentStore]) -> CSFrom {
|
||||
|
||||
return self.init(From(entityClass, persistentStores))
|
||||
}
|
||||
|
||||
|
||||
// MARK: NSObject
|
||||
|
||||
public override var hash: Int {
|
||||
|
||||
return self.swift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(object: AnyObject?) -> Bool {
|
||||
|
||||
guard let object = object as? CSFrom else {
|
||||
|
||||
return false
|
||||
}
|
||||
return self.swift == object.swift
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreBridge
|
||||
|
||||
internal let swift: From<NSManagedObject>
|
||||
|
||||
internal init<T: NSManagedObject>(_ swiftObject: From<T>) {
|
||||
|
||||
self.swift = From<NSManagedObject>(
|
||||
entityClass: swiftObject.entityClass,
|
||||
findPersistentStores: swiftObject.findPersistentStores
|
||||
)
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - From
|
||||
|
||||
extension From: CoreStoreBridgeable {
|
||||
|
||||
// MARK: CoreStoreBridgeable
|
||||
|
||||
internal var objc: CSFrom {
|
||||
|
||||
return CSFrom(self)
|
||||
}
|
||||
}
|
||||
96
Sources/ObjectiveC/CSGroupBy.swift
Normal file
96
Sources/ObjectiveC/CSGroupBy.swift
Normal file
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// CSGroupBy.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSGroupBy
|
||||
|
||||
/**
|
||||
The `CSGroupBy` serves as the Objective-C bridging type for `GroupBy`.
|
||||
*/
|
||||
@objc
|
||||
public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSGroupBy` clause with a list of key path strings
|
||||
|
||||
- parameter keyPaths: a list of key path strings to group results with
|
||||
- returns: a `CSGroupBy` clause with a list of key path strings
|
||||
*/
|
||||
@objc
|
||||
public static func keyPaths(keyPaths: [KeyPath]) -> CSGroupBy {
|
||||
|
||||
return self.init(GroupBy(keyPaths))
|
||||
}
|
||||
|
||||
|
||||
// MARK: NSObject
|
||||
|
||||
public override var hash: Int {
|
||||
|
||||
return self.swift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(object: AnyObject?) -> Bool {
|
||||
|
||||
guard let object = object as? CSGroupBy else {
|
||||
|
||||
return false
|
||||
}
|
||||
return self.swift == object.swift
|
||||
}
|
||||
|
||||
|
||||
// MARK: CSQueryClause
|
||||
|
||||
@objc
|
||||
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
|
||||
|
||||
self.swift.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreBridge
|
||||
|
||||
internal let swift: GroupBy
|
||||
|
||||
internal init(_ swiftObject: GroupBy) {
|
||||
|
||||
self.swift = swiftObject
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - GroupBy
|
||||
|
||||
extension GroupBy: CoreStoreBridgeable {
|
||||
|
||||
// MARK: CoreStoreBridgeable
|
||||
|
||||
internal typealias ObjCType = CSGroupBy
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// CSImportableObject.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSImportableObject
|
||||
|
||||
@objc
|
||||
public protocol CSImportableObject: class, AnyObject {
|
||||
|
||||
/**
|
||||
Return the expected class of the import source. If not implemented, transactions will not validate the import source's type.
|
||||
|
||||
- returns: the expected class of the import source
|
||||
*/
|
||||
@objc
|
||||
optional static func classForImportSource() -> AnyClass
|
||||
|
||||
/**
|
||||
Return `YES` if an object should be created from `source`. Return `NO` to ignore and skip `source`. If not implemented, transactions assume `YES`.
|
||||
|
||||
- parameter source: the object to import from
|
||||
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
|
||||
- returns: `YES` if an object should be created from `source`. Return `NO` to ignore.
|
||||
*/
|
||||
@objc
|
||||
optional static func shouldInsertFromImportSource(source: AnyObject, inTransaction transaction: CSBaseDataTransaction) -> Bool
|
||||
|
||||
/**
|
||||
Implements the actual importing of data from `source`. Implementers should pull values from `source` and assign them to the receiver's attributes. Note that throwing from this method will cause subsequent imports that are part of the same `-importObjects:sourceArray:` call to be cancelled.
|
||||
|
||||
- parameter source: the object to import from
|
||||
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
|
||||
*/
|
||||
@objc
|
||||
func didInsertFromImportSource(source: AnyObject, inTransaction transaction: CSBaseDataTransaction) throws
|
||||
}
|
||||
@@ -37,12 +37,11 @@ public final class CSInto: NSObject, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSInto` clause with the specified entity class.
|
||||
Sample Usage:
|
||||
```
|
||||
MyPersonEntity *person = [transaction create:[CSInto entityClass:[MyPersonEntity class]]];
|
||||
MyPersonEntity *person = [transaction createInto:[CSInto entityClass:[MyPersonEntity class]]];
|
||||
```
|
||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||
- returns: a new `CSInto` with the specified entity class
|
||||
- returns: a `CSInto` clause with the specified entity class
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass) -> CSInto {
|
||||
@@ -51,14 +50,13 @@ public final class CSInto: NSObject, CoreStoreBridge {
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes an `CSInto` clause with the specified configuration.
|
||||
Sample Usage:
|
||||
Initializes a `CSInto` clause with the specified configuration.
|
||||
```
|
||||
MyPersonEntity *person = [transaction create:[CSInto entityClass:[MyPersonEntity class]]];
|
||||
MyPersonEntity *person = [transaction createInto:[CSInto entityClass:[MyPersonEntity class]]];
|
||||
```
|
||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||
- parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
|
||||
- returns: a new `CSInto` with the specified configuration
|
||||
- returns: a `CSInto` clause with the specified configuration
|
||||
*/
|
||||
@objc
|
||||
public static func entityClass(entityClass: AnyClass, configuration: String?) -> CSInto {
|
||||
|
||||
108
Sources/ObjectiveC/CSOrderBy.swift
Normal file
108
Sources/ObjectiveC/CSOrderBy.swift
Normal file
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// CSOrderBy.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSOrderBy
|
||||
|
||||
/**
|
||||
The `CSOrderBy` serves as the Objective-C bridging type for `OrderBy`.
|
||||
*/
|
||||
@objc
|
||||
public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSOrderBy` clause with a list of sort descriptors
|
||||
|
||||
- parameter sortDescriptors: a series of `NSSortDescriptor`s
|
||||
- returns: a `CSOrderBy` clause with a list of sort descriptors
|
||||
*/
|
||||
@objc
|
||||
public static func sortDescriptors(sortDescriptors: [NSSortDescriptor]) -> CSOrderBy {
|
||||
|
||||
return self.init(OrderBy(sortDescriptors))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSOrderBy` clause with a single sort descriptor
|
||||
|
||||
- parameter sortDescriptor: a `NSSortDescriptor`
|
||||
- returns: a `CSOrderBy` clause with a single sort descriptor
|
||||
*/
|
||||
@objc
|
||||
public static func sortDescriptor(sortDescriptor: NSSortDescriptor) -> CSOrderBy {
|
||||
|
||||
return self.init(OrderBy(sortDescriptor))
|
||||
}
|
||||
|
||||
|
||||
// MARK: NSObject
|
||||
|
||||
public override var hash: Int {
|
||||
|
||||
return self.swift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(object: AnyObject?) -> Bool {
|
||||
|
||||
guard let object = object as? CSOrderBy else {
|
||||
|
||||
return false
|
||||
}
|
||||
return self.swift == object.swift
|
||||
}
|
||||
|
||||
|
||||
// MARK: CSFetchClause, CSQueryClause, CSDeleteClause
|
||||
|
||||
@objc
|
||||
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
|
||||
|
||||
self.swift.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreBridge
|
||||
|
||||
internal let swift: OrderBy
|
||||
|
||||
internal init(_ swiftObject: OrderBy) {
|
||||
|
||||
self.swift = swiftObject
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - OrderBy
|
||||
|
||||
extension OrderBy: CoreStoreBridgeable {
|
||||
|
||||
// MARK: CoreStoreBridgeable
|
||||
|
||||
internal typealias ObjCType = CSOrderBy
|
||||
}
|
||||
79
Sources/ObjectiveC/CSTweak.swift
Normal file
79
Sources/ObjectiveC/CSTweak.swift
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// CSTweak.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSTweak
|
||||
|
||||
/**
|
||||
The `CSTweak` serves as the Objective-C bridging type for `Tweak`.
|
||||
*/
|
||||
@objc
|
||||
public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSTweak` clause with a closure where the `NSFetchRequest` may be configured.
|
||||
|
||||
- parameter customization: a list of key path strings to group results with
|
||||
- returns: a `CSTweak` clause with a closure where the `NSFetchRequest` may be configured
|
||||
*/
|
||||
@objc
|
||||
public static func customization(customization: (fetchRequest: NSFetchRequest) -> Void) -> CSTweak {
|
||||
|
||||
return self.init(Tweak(customization))
|
||||
}
|
||||
|
||||
|
||||
// MARK: CSFetchClause, CSQueryClause, CSDeleteClause
|
||||
|
||||
@objc
|
||||
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
|
||||
|
||||
self.swift.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreBridge
|
||||
|
||||
internal let swift: Tweak
|
||||
|
||||
internal init(_ swiftObject: Tweak) {
|
||||
|
||||
self.swift = swiftObject
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Tweak
|
||||
|
||||
extension Tweak: CoreStoreBridgeable {
|
||||
|
||||
// MARK: CoreStoreBridgeable
|
||||
|
||||
internal typealias ObjCType = CSTweak
|
||||
}
|
||||
147
Sources/ObjectiveC/CSWhere.swift
Normal file
147
Sources/ObjectiveC/CSWhere.swift
Normal file
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// CSWhere.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - CSWhere
|
||||
|
||||
/**
|
||||
The `CSWhere` serves as the Objective-C bridging type for `Where`.
|
||||
*/
|
||||
@objc
|
||||
public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreBridge {
|
||||
|
||||
/**
|
||||
Initializes a `CSWhere` clause with an `NSPredicate`
|
||||
|
||||
- parameter predicate: the `NSPredicate` for the fetch or query
|
||||
- returns: a `CSWhere` clause with an `NSPredicate`
|
||||
*/
|
||||
@objc
|
||||
public static func predicate(predicate: NSPredicate) -> CSWhere {
|
||||
|
||||
return self.init(Where(predicate))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSWhere` clause with a predicate that always evaluates to the specified boolean value
|
||||
|
||||
- parameter value: the boolean value for the predicate
|
||||
- returns: a `CSWhere` clause with a predicate that always evaluates to the specified boolean value
|
||||
*/
|
||||
@objc
|
||||
public static func value(value: Bool) -> CSWhere {
|
||||
|
||||
return self.init(Where(value))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSWhere` clause with a predicate using the specified string format and arguments
|
||||
|
||||
- parameter format: the format string for the predicate
|
||||
- parameter argumentArray: the arguments for `format`
|
||||
- returns: a `CSWhere` clause with a predicate using the specified string format and arguments
|
||||
*/
|
||||
@objc
|
||||
public static func format(format: String, argumentArray: [NSObject]?) -> CSWhere {
|
||||
|
||||
return self.init(Where(format, argumentArray: argumentArray))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSWhere` clause that compares equality
|
||||
|
||||
- parameter keyPath: the keyPath to compare with
|
||||
- parameter value: the arguments for the `==` operator
|
||||
- returns: a `CSWhere` clause that compares equality
|
||||
*/
|
||||
@objc
|
||||
public static func keyPath(keyPath: KeyPath, isEqualTo value: NSObject?) -> CSWhere {
|
||||
|
||||
return self.init(Where(keyPath, isEqualTo: value))
|
||||
}
|
||||
|
||||
/**
|
||||
Initializes a `CSWhere` clause that compares membership
|
||||
|
||||
- parameter keyPath: the keyPath to compare with
|
||||
- parameter list: the array to check membership of
|
||||
- returns: a `CSWhere` clause that compares membership
|
||||
*/
|
||||
@objc
|
||||
public static func keyPath(keyPath: KeyPath, isMemberOf list: NSArray) -> CSWhere {
|
||||
|
||||
return self.init(Where(keyPath, isMemberOf: list))
|
||||
}
|
||||
|
||||
|
||||
// MARK: NSObject
|
||||
|
||||
public override var hash: Int {
|
||||
|
||||
return self.swift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(object: AnyObject?) -> Bool {
|
||||
|
||||
guard let object = object as? CSWhere else {
|
||||
|
||||
return false
|
||||
}
|
||||
return self.swift == object.swift
|
||||
}
|
||||
|
||||
|
||||
// MARK: CSFetchClause, CSQueryClause, CSDeleteClause
|
||||
|
||||
@objc
|
||||
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
|
||||
|
||||
self.swift.applyToFetchRequest(fetchRequest)
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreBridge
|
||||
|
||||
internal let swift: Where
|
||||
|
||||
internal init(_ swiftObject: Where) {
|
||||
|
||||
self.swift = swiftObject
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Where
|
||||
|
||||
extension Where: CoreStoreBridgeable {
|
||||
|
||||
// MARK: CoreStoreBridgeable
|
||||
|
||||
internal typealias ObjCType = CSWhere
|
||||
}
|
||||
@@ -92,4 +92,19 @@ internal func bridge(@noescape closure: () throws -> Void) throws {
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge<T>(error: NSErrorPointer, @noescape _ closure: () throws -> T) -> T? {
|
||||
|
||||
do {
|
||||
|
||||
let result = try closure()
|
||||
error.memory = nil
|
||||
return result
|
||||
}
|
||||
catch let swiftError {
|
||||
|
||||
error.memory = swiftError.objc
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
112
Sources/ObjectiveC/NSManagedObjectContext+ObjectiveC.swift
Normal file
112
Sources/ObjectiveC/NSManagedObjectContext+ObjectiveC.swift
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// NSManagedObjectContext+ObjectiveC.swift
|
||||
// CoreStore
|
||||
//
|
||||
// Copyright © 2016 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: - NSManagedObjectContext
|
||||
|
||||
internal extension NSManagedObjectContext {
|
||||
|
||||
// MARK: Internal
|
||||
|
||||
@nonobjc
|
||||
internal func fetchOne(from: CSFrom, _ fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
|
||||
fetchRequest.fetchLimit = 1
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.fetchOne(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchAll(from: CSFrom, _ fetchClauses: [CSFetchClause]) -> [NSManagedObject]? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
|
||||
fetchRequest.fetchLimit = 0
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.fetchAll(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchCount(from: CSFrom, _ fetchClauses: [CSFetchClause]) -> Int? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.fetchCount(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectID(from: CSFrom, _ fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
|
||||
fetchRequest.fetchLimit = 1
|
||||
fetchRequest.resultType = .ManagedObjectIDResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.fetchObjectID(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func fetchObjectIDs(from: CSFrom, _ fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
|
||||
fetchRequest.fetchLimit = 0
|
||||
fetchRequest.resultType = .ManagedObjectIDResultType
|
||||
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.fetchObjectIDs(fetchRequest)
|
||||
}
|
||||
|
||||
@nonobjc
|
||||
internal func deleteAll(from: CSFrom, _ deleteClauses: [CSDeleteClause]) -> Int? {
|
||||
|
||||
let fetchRequest = NSFetchRequest()
|
||||
from.swift.applyToFetchRequest(fetchRequest, context: self)
|
||||
|
||||
fetchRequest.fetchLimit = 0
|
||||
fetchRequest.resultType = .ManagedObjectResultType
|
||||
fetchRequest.returnsObjectsAsFaults = true
|
||||
fetchRequest.includesPropertyValues = false
|
||||
deleteClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
|
||||
|
||||
return self.deleteAll(fetchRequest)
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public extension CoreStore {
|
||||
}
|
||||
|
||||
/**
|
||||
Refreshes all registered objects `NSManagedObject`s in the `DataStack`.
|
||||
Refreshes all registered objects `NSManagedObject`s in the `defaultStack`.
|
||||
*/
|
||||
public static func refreshAllObjectsAsFaults() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user