WIP: segfault

This commit is contained in:
John Rommel Estropia
2016-07-20 08:12:04 +09:00
parent f486ace437
commit 267c21063a
129 changed files with 2205 additions and 3282 deletions
+1 -1
View File
@@ -1 +1 @@
github "JohnEstropia/GCDKit" "1.2.4"
github "JohnEstropia/GCDKit" "1.2.5"
+81 -385
View File
@@ -67,31 +67,25 @@
82BA18D81C4BBD7100A0916E /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
82BA18DC1C4BBD9C00A0916E /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D372821A39CD6900F583D9 /* Model.xcdatamodeld */; };
82BA18DD1C4BBE1400A0916E /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
82BA18DF1C4BBE2600A0916E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BA18DE1C4BBE2600A0916E /* Foundation.framework */; };
82BA18E11C4BBE2C00A0916E /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BA18E01C4BBE2C00A0916E /* CoreData.framework */; };
B501FDDD1CA8D05000BE22EF /* CSSectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDDC1CA8D05000BE22EF /* CSSectionBy.swift */; };
B501FDDE1CA8D05000BE22EF /* CSSectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDDC1CA8D05000BE22EF /* CSSectionBy.swift */; };
B501FDDF1CA8D05000BE22EF /* CSSectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDDC1CA8D05000BE22EF /* CSSectionBy.swift */; };
B501FDE01CA8D05000BE22EF /* CSSectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDDC1CA8D05000BE22EF /* CSSectionBy.swift */; };
B501FDE21CA8D1F500BE22EF /* CSListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE11CA8D1F500BE22EF /* CSListMonitor.swift */; };
B501FDE31CA8D1F500BE22EF /* CSListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE11CA8D1F500BE22EF /* CSListMonitor.swift */; };
B501FDE41CA8D1F500BE22EF /* CSListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE11CA8D1F500BE22EF /* CSListMonitor.swift */; };
B501FDE51CA8D1F500BE22EF /* CSListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE11CA8D1F500BE22EF /* CSListMonitor.swift */; };
B501FDE71CA8D20500BE22EF /* CSListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE61CA8D20500BE22EF /* CSListObserver.swift */; };
B501FDE81CA8D20500BE22EF /* CSListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE61CA8D20500BE22EF /* CSListObserver.swift */; };
B501FDE91CA8D20500BE22EF /* CSListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE61CA8D20500BE22EF /* CSListObserver.swift */; };
B501FDEA1CA8D20500BE22EF /* CSListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501FDE61CA8D20500BE22EF /* CSListObserver.swift */; };
B50392F91C478FF3009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B50392FA1C47963F009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B50392FB1C479640009900CA /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B504D0D61B02362500B2BBB1 /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; };
B519E4581C4CD2CA00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E4591C4CD2D100E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E45A1C4CD2DA00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B519E45B1C4CD2ED00E7B469 /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B519E4571C4CD2CA00E7B469 /* GCDKit.framework */; };
B517A9811D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */; };
B517A9821D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */; };
B517A9831D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */; };
B517A9841D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */; };
B51BE06A1B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
B51FE5AB1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
B51FE5AC1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
B51FE5AD1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
B51FE5AE1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
B51FE5AF1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */; };
@@ -150,18 +144,14 @@
B52557891D02DE8100E51965 /* FetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557871D02DE8100E51965 /* FetchTests.swift */; };
B525578A1D02DE8100E51965 /* FetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52557871D02DE8100E51965 /* FetchTests.swift */; };
B52661401CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */; };
B52661411CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */; };
B52661421CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */; };
B52661431CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */; };
B52661441CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */; };
B529C2041CA4A2DB007E7EBD /* CSSaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */; };
B529C2051CA4A2DB007E7EBD /* CSSaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */; };
B529C2061CA4A2DB007E7EBD /* CSSaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */; };
B529C2071CA4A2DC007E7EBD /* CSSaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */; };
B529C2081CA4A2DC007E7EBD /* CSSaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B529C2031CA4A2DB007E7EBD /* CSSaveResult.swift */; };
B52DD17E1BE1F8CD00949AFE /* CoreStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B52DD1741BE1F8CC00949AFE /* CoreStore.framework */; };
B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD51BD65AE00077652A /* Foundation.framework */; };
B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5548CD71BD65AE50077652A /* CoreData.framework */; };
B52DD1931BE1F8FD00949AFE /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
B52DD1941BE1F92500949AFE /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
B52DD1951BE1F92500949AFE /* CoreStoreError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* CoreStoreError.swift */; };
@@ -207,38 +197,31 @@
B52DD1C91BE1F94600949AFE /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
B52DD1CA1BE1F94600949AFE /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
B52DD1CB1BE1F94600949AFE /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
B538BA761D15B3E30003A766 /* CoreStoreBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = B538BA701D15B3E30003A766 /* CoreStoreBridge.m */; };
B538BA771D15B3E30003A766 /* CoreStoreBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = B538BA701D15B3E30003A766 /* CoreStoreBridge.m */; };
B538BA781D15B3E30003A766 /* CoreStoreBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = B538BA701D15B3E30003A766 /* CoreStoreBridge.m */; };
B538BA791D15B3E30003A766 /* CoreStoreBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = B538BA701D15B3E30003A766 /* CoreStoreBridge.m */; };
B538BA7A1D15B3E30003A766 /* CoreStoreBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = B538BA701D15B3E30003A766 /* CoreStoreBridge.m */; };
B53FB9FE1CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */; };
B53FB9FF1CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */; };
B53FBA001CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */; };
B53FBA011CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */; };
B53FBA021CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FB9FD1CAB2D2F00F0D40A /* CSMigrationResult.swift */; };
B53FBA041CAB300C00F0D40A /* CSMigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA031CAB300C00F0D40A /* CSMigrationType.swift */; };
B53FBA051CAB300C00F0D40A /* CSMigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA031CAB300C00F0D40A /* CSMigrationType.swift */; };
B53FBA061CAB300C00F0D40A /* CSMigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA031CAB300C00F0D40A /* CSMigrationType.swift */; };
B53FBA071CAB300C00F0D40A /* CSMigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA031CAB300C00F0D40A /* CSMigrationType.swift */; };
B53FBA081CAB300C00F0D40A /* CSMigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA031CAB300C00F0D40A /* CSMigrationType.swift */; };
B53FBA0B1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA0A1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift */; };
B53FBA0C1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA0A1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift */; };
B53FBA0D1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA0A1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift */; };
B53FBA0E1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA0A1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift */; };
B53FBA0F1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA0A1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift */; };
B53FBA121CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA111CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift */; };
B53FBA131CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA111CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift */; };
B53FBA141CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA111CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift */; };
B53FBA151CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA111CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift */; };
B53FBA161CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA111CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift */; };
B53FBA181CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA171CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift */; };
B53FBA191CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA171CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift */; };
B53FBA1A1CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA171CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift */; };
B53FBA1B1CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA171CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift */; };
B53FBA1C1CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA171CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift */; };
B53FBA1E1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA1D1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift */; };
B53FBA1F1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA1D1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift */; };
B53FBA201CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA1D1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift */; };
B53FBA211CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53FBA1D1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift */; };
B546F9581C99B17400D5AC55 /* CSCoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B546F9571C99B17400D5AC55 /* CSCoreStore+Setup.swift */; };
@@ -288,27 +271,22 @@
B5519A601CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A5E1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift */; };
B5519A611CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A5E1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift */; };
B5519A621CA21954002BEF78 /* CSAsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A5E1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift */; };
B55717431D15B09D009BDBCA /* CoreStoreBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = B55717421D15AF9C009BDBCA /* CoreStoreBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
B55717441D15B09E009BDBCA /* CoreStoreBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = B55717421D15AF9C009BDBCA /* CoreStoreBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
B55717451D15B09F009BDBCA /* CoreStoreBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = B55717421D15AF9C009BDBCA /* CoreStoreBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
B55717461D15B0A1009BDBCA /* CoreStoreBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = B55717421D15AF9C009BDBCA /* CoreStoreBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
B55717471D15B0A1009BDBCA /* CoreStoreBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = B55717421D15AF9C009BDBCA /* CoreStoreBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
B5598BCC1BE2093D0092EFCE /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B5D372821A39CD6900F583D9 /* Model.xcdatamodeld */; };
B559CD431CAA8B6300E4D58B /* CSSetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD421CAA8B6300E4D58B /* CSSetupResult.swift */; };
B559CD441CAA8B6300E4D58B /* CSSetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD421CAA8B6300E4D58B /* CSSetupResult.swift */; };
B559CD451CAA8B6300E4D58B /* CSSetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD421CAA8B6300E4D58B /* CSSetupResult.swift */; };
B559CD461CAA8B6300E4D58B /* CSSetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD421CAA8B6300E4D58B /* CSSetupResult.swift */; };
B559CD471CAA8B6300E4D58B /* CSSetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD421CAA8B6300E4D58B /* CSSetupResult.swift */; };
B559CD491CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD481CAA8C6D00E4D58B /* CSStorageInterface.swift */; };
B559CD4A1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD481CAA8C6D00E4D58B /* CSStorageInterface.swift */; };
B559CD4B1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD481CAA8C6D00E4D58B /* CSStorageInterface.swift */; };
B559CD4C1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD481CAA8C6D00E4D58B /* CSStorageInterface.swift */; };
B559CD4D1CAA8C6D00E4D58B /* CSStorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B559CD481CAA8C6D00E4D58B /* CSStorageInterface.swift */; };
B56007111B3F6BD500A9A8F9 /* Into.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007101B3F6BD500A9A8F9 /* Into.swift */; };
B56007141B3F6C2800A9A8F9 /* SectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007131B3F6C2800A9A8F9 /* SectionBy.swift */; };
B56007161B4018AB00A9A8F9 /* MigrationChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007151B4018AB00A9A8F9 /* MigrationChain.swift */; };
B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56321791BD650DE006C9394 /* CoreData.framework */; };
B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B563217B1BD650E3006C9394 /* Foundation.framework */; };
B563217E1BD65110006C9394 /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
B563217F1BD65216006C9394 /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
B56321801BD65216006C9394 /* CoreStoreError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* CoreStoreError.swift */; };
@@ -362,8 +340,17 @@
B56321B41BD6521C006C9394 /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
B56321B51BD6521C006C9394 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
B56321B61BD6521C006C9394 /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
B56507901D393087000596DA /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B565078F1D393087000596DA /* GCDKit.framework */; };
B56507921D3930B5000596DA /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507911D3930B5000596DA /* GCDKit.framework */; };
B56507941D3930BC000596DA /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507931D3930BC000596DA /* CoreData.framework */; };
B56507961D3930C1000596DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507951D3930C1000596DA /* Foundation.framework */; };
B56507981D3930CC000596DA /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507971D3930CC000596DA /* CoreData.framework */; };
B565079A1D3930D1000596DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507991D3930D1000596DA /* Foundation.framework */; };
B565079C1D3930D8000596DA /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B565079B1D3930D8000596DA /* GCDKit.framework */; };
B565079E1D3930ED000596DA /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B565079D1D3930ED000596DA /* CoreData.framework */; };
B56507A01D3930F5000596DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B565079F1D3930F5000596DA /* Foundation.framework */; };
B56507A21D393101000596DA /* GCDKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56507A11D393101000596DA /* GCDKit.framework */; };
B5677D3D1CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */; };
B5677D3E1CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */; };
B5677D3F1CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */; };
B5677D401CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */; };
B5677D411CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */; };
@@ -382,16 +369,13 @@
B59851491C90289D00C99590 /* NSPersistentStoreCoordinator+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */; };
B598514A1C90289E00C99590 /* NSPersistentStoreCoordinator+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */; };
B598514B1C90289F00C99590 /* NSPersistentStoreCoordinator+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */; };
B59983491CA54BC100E1A417 /* CSBaseDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A581CA2008C002BEF78 /* CSBaseDataTransaction.swift */; };
B59AFF411C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59AFF401C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift */; };
B59FA0AE1CCBAC95007C9BCA /* ICloudStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */; };
B59FA0AF1CCBACA6007C9BCA /* ICloudStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */; };
B59FA0B01CCBACA7007C9BCA /* ICloudStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */; };
B59FA0B11CCBACA7007C9BCA /* ICloudStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */; };
B59FA0B21CCBACA8007C9BCA /* ICloudStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B59FA0AD1CCBAC95007C9BCA /* ICloudStore.swift */; };
B5A261211B64BFDB006EB6D3 /* MigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A261201B64BFDB006EB6D3 /* MigrationType.swift */; };
B5A5F2661CAEC50F004AB9AF /* CSSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5F2651CAEC50F004AB9AF /* CSSelect.swift */; };
B5A5F2671CAEC50F004AB9AF /* CSSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5F2651CAEC50F004AB9AF /* CSSelect.swift */; };
B5A5F2681CAEC50F004AB9AF /* CSSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5F2651CAEC50F004AB9AF /* CSSelect.swift */; };
B5A5F2691CAEC50F004AB9AF /* CSSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5F2651CAEC50F004AB9AF /* CSSelect.swift */; };
B5A5F26A1CAEC50F004AB9AF /* CSSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A5F2651CAEC50F004AB9AF /* CSSelect.swift */; };
@@ -412,82 +396,10 @@
B5D3F6461C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D3F6441C887C0A00C7492A /* LegacySQLiteStore.swift */; };
B5D3F6471C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D3F6441C887C0A00C7492A /* LegacySQLiteStore.swift */; };
B5D3F6481C887C0A00C7492A /* LegacySQLiteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D3F6441C887C0A00C7492A /* LegacySQLiteStore.swift */; };
B5D7A5AF1CA3B738005C752B /* (null) in Sources */ = {isa = PBXBuildFile; };
B5D7A5B01CA3B738005C752B /* StorageInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FE4DA11C8481E100FA6A91 /* StorageInterface.swift */; };
B5D7A5B11CA3B738005C752B /* InMemoryStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FE4DA61C84FB4400FA6A91 /* InMemoryStore.swift */; };
B5D7A5B21CA3B738005C752B /* SQLiteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FE4DAB1C85D44E00FA6A91 /* SQLiteStore.swift */; };
B5D7A5B31CA3B738005C752B /* LegacySQLiteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D3F6441C887C0A00C7492A /* LegacySQLiteStore.swift */; };
B5D7A5B41CA3BAE7005C752B /* NSPersistentStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FEC18D1C9166E200532541 /* NSPersistentStore+Setup.swift */; };
B5D7A5B61CA3BF8F005C752B /* CSInto.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D7A5B51CA3BF8F005C752B /* CSInto.swift */; };
B5D7A5B71CA3BF8F005C752B /* CSInto.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D7A5B51CA3BF8F005C752B /* CSInto.swift */; };
B5D7A5B81CA3BF8F005C752B /* CSInto.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D7A5B51CA3BF8F005C752B /* CSInto.swift */; };
B5D7A5B91CA3BF8F005C752B /* CSInto.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D7A5B51CA3BF8F005C752B /* CSInto.swift */; };
B5D7A5BA1CA3BF8F005C752B /* CSInto.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D7A5B51CA3BF8F005C752B /* CSInto.swift */; };
B5D9E2EF1CA2C317007A9D52 /* ObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1C1AFF84860064E85B /* ObjectMonitor.swift */; };
B5D9E2F01CA2C317007A9D52 /* CoreStoreFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */; };
B5D9E2F11CA2C317007A9D52 /* ImportableUniqueObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8F1B9AA991007C5CBB /* ImportableUniqueObject.swift */; };
B5D9E2F21CA2C317007A9D52 /* CoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */; };
B5D9E2F31CA2C317007A9D52 /* CoreStoreError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D1E22B19FA9FBC003B2874 /* CoreStoreError.swift */; };
B5D9E2F41CA2C317007A9D52 /* Where.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F051AFF847B0064E85B /* Where.swift */; };
B5D9E2F51CA2C317007A9D52 /* FetchedResultsControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */; };
B5D9E2F61CA2C317007A9D52 /* MigrationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A261201B64BFDB006EB6D3 /* MigrationType.swift */; };
B5D9E2F71CA2C317007A9D52 /* DataStack+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F061AFF847B0064E85B /* DataStack+Querying.swift */; };
B5D9E2F81CA2C317007A9D52 /* SectionBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007131B3F6C2800A9A8F9 /* SectionBy.swift */; };
B5D9E2F91CA2C317007A9D52 /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
B5D9E2FA1CA2C317007A9D52 /* UnsafeDataTransaction+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C976E21C6C9F6A00B1AF90 /* UnsafeDataTransaction+Observing.swift */; };
B5D9E2FB1CA2C317007A9D52 /* MigrationChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007151B4018AB00A9A8F9 /* MigrationChain.swift */; };
B5D9E2FC1CA2C317007A9D52 /* Tweak.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F001AFF847B0064E85B /* Tweak.swift */; };
B5D9E2FD1CA2C317007A9D52 /* OrderBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F041AFF847B0064E85B /* OrderBy.swift */; };
B5D9E2FE1CA2C317007A9D52 /* NSManagedObjectContext+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */; };
B5D9E2FF1CA2C317007A9D52 /* CoreStore+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AD1B518DCB00714891 /* CoreStore+Migration.swift */; };
B5D9E3001CA2C317007A9D52 /* CoreStore+Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE41AFF84610064E85B /* CoreStore+Logging.swift */; };
B5D9E3011CA2C317007A9D52 /* Into.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56007101B3F6BD500A9A8F9 /* Into.swift */; };
B5D9E3021CA2C317007A9D52 /* Select.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F031AFF847B0064E85B /* Select.swift */; };
B5D9E3031CA2C317007A9D52 /* NSManagedObject+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */; };
B5D9E3041CA2C317007A9D52 /* NSFetchedResultsController+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5202CF91C04688100DED140 /* NSFetchedResultsController+Convenience.swift */; };
B5D9E3051CA2C317007A9D52 /* (null) in Sources */ = {isa = PBXBuildFile; };
B5D9E3061CA2C317007A9D52 /* ObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1F1AFF84860064E85B /* ObjectObserver.swift */; };
B5D9E3071CA2C317007A9D52 /* NotificationObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */; };
B5D9E3081CA2C317007A9D52 /* ImportableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F1DA8C1B9AA97D007C5CBB /* ImportableObject.swift */; };
B5D9E3091CA2C317007A9D52 /* MigrationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56965231B356B820075EE4A /* MigrationResult.swift */; };
B5D9E30A1CA2C317007A9D52 /* CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F291E2619C6D3CF007AF63F /* CoreStore.swift */; };
B5D9E30B1CA2C317007A9D52 /* ClauseTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F401AFF8CCD0064E85B /* ClauseTypes.swift */; };
B5D9E30C1CA2C317007A9D52 /* BaseDataTransaction+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EFE1AFF847B0064E85B /* BaseDataTransaction+Querying.swift */; };
B5D9E30D1CA2C317007A9D52 /* MigrationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6AB1B51285300714891 /* MigrationManager.swift */; };
B5D9E30E1CA2C317007A9D52 /* DataStack+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEC1AFF846E0064E85B /* DataStack+Transaction.swift */; };
B5D9E30F1CA2C317007A9D52 /* DataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EDB1AFF84500064E85B /* DataStack.swift */; };
B5D9E3101CA2C317007A9D52 /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834BA1B7691F3001D3D50 /* Functions.swift */; };
B5D9E3111CA2C317007A9D52 /* ListMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1D1AFF84860064E85B /* ListMonitor.swift */; };
B5D9E3121CA2C317007A9D52 /* UnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EED1AFF846E0064E85B /* UnsafeDataTransaction.swift */; };
B5D9E3131CA2C317007A9D52 /* DataStack+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56964D31B22FFAD0075EE4A /* DataStack+Migration.swift */; };
B5D9E3141CA2C317007A9D52 /* BaseDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEB1AFF846E0064E85B /* BaseDataTransaction.swift */; };
B5D9E3151CA2C317007A9D52 /* SaveResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EF21AFF846E0064E85B /* SaveResult.swift */; };
B5D9E3161CA2C317007A9D52 /* From.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F011AFF847B0064E85B /* From.swift */; };
B5D9E3181CA2C317007A9D52 /* NSProgress+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FAD6A81B50A4B300714891 /* NSProgress+Convenience.swift */; };
B5D9E3191CA2C317007A9D52 /* SynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EF31AFF846E0064E85B /* SynchronousDataTransaction.swift */; };
B5D9E31A1CA2C317007A9D52 /* NSManagedObject+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F271AFF84920064E85B /* NSManagedObject+Convenience.swift */; };
B5D9E31B1CA2C317007A9D52 /* NSManagedObjectModel+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */; };
B5D9E31C1CA2C317007A9D52 /* NSManagedObjectContext+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */; };
B5D9E31D1CA2C317007A9D52 /* CoreStoreLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE51AFF84610064E85B /* CoreStoreLogger.swift */; };
B5D9E31E1CA2C317007A9D52 /* WeakObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2D1AFF849C0064E85B /* WeakObject.swift */; };
B5D9E31F1CA2C317007A9D52 /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F021AFF847B0064E85B /* GroupBy.swift */; };
B5D9E3201CA2C317007A9D52 /* DataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1A1AFF84860064E85B /* DataStack+Observing.swift */; };
B5D9E3211CA2C317007A9D52 /* CoreStore+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEE1AFF846E0064E85B /* CoreStore+Transaction.swift */; };
B5D9E3221CA2C317007A9D52 /* NSManagedObjectContext+CoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */; };
B5D9E3231CA2C317007A9D52 /* CoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1B1AFF84860064E85B /* CoreStore+Observing.swift */; };
B5D9E3241CA2C317007A9D52 /* BaseDataTransaction+Importing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E834B81B76311F001D3D50 /* BaseDataTransaction+Importing.swift */; };
B5D9E3251CA2C317007A9D52 /* DefaultLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EE31AFF84610064E85B /* DefaultLogger.swift */; };
B5D9E3261CA2C317007A9D52 /* AsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84EEA1AFF846E0064E85B /* AsynchronousDataTransaction.swift */; };
B5D9E3271CA2C317007A9D52 /* CoreStore+Querying.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F071AFF847B0064E85B /* CoreStore+Querying.swift */; };
B5D9E3281CA2C317007A9D52 /* ListObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F1E1AFF84860064E85B /* ListObserver.swift */; };
B5D9E32C1CA2C317007A9D52 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5D39A0119FD00C9000E91BB /* Foundation.framework */; };
B5D9E32D1CA2C317007A9D52 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2F03A54C19C5C872005002A5 /* CoreData.framework */; };
B5D9E32F1CA2C317007A9D52 /* CoreStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F03A53519C5C6DA005002A5 /* CoreStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
B5D9E3431CA2C6C4007A9D52 /* GCDBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9E3371CA2C6BF007A9D52 /* GCDBlock.swift */; };
B5D9E3441CA2C6C4007A9D52 /* GCDGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9E3381CA2C6BF007A9D52 /* GCDGroup.swift */; };
B5D9E3461CA2C6C4007A9D52 /* GCDQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9E33A1CA2C6BF007A9D52 /* GCDQueue.swift */; };
B5D9E3471CA2C6C4007A9D52 /* GCDSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9E33B1CA2C6BF007A9D52 /* GCDSemaphore.swift */; };
B5D9E3481CA2C6C4007A9D52 /* GCDTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5D9E33C1CA2C6BF007A9D52 /* GCDTimer.swift */; };
B5DBE2CD1C9914A900B5CEFA /* CSCoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DBE2CC1C9914A900B5CEFA /* CSCoreStore.swift */; };
B5DBE2CE1C9914A900B5CEFA /* CSCoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DBE2CC1C9914A900B5CEFA /* CSCoreStore.swift */; };
B5DBE2CF1C9914A900B5CEFA /* CSCoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DBE2CC1C9914A900B5CEFA /* CSCoreStore.swift */; };
@@ -506,33 +418,26 @@
B5DC47CB1C93D9C800FA3BF3 /* StorageInterfaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DC47C91C93D9C800FA3BF3 /* StorageInterfaceTests.swift */; };
B5DC47CC1C93D9C800FA3BF3 /* StorageInterfaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DC47C91C93D9C800FA3BF3 /* StorageInterfaceTests.swift */; };
B5E1B5931CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5921CAA0C15007FD580 /* CSObjectMonitor.swift */; };
B5E1B5941CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5921CAA0C15007FD580 /* CSObjectMonitor.swift */; };
B5E1B5951CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5921CAA0C15007FD580 /* CSObjectMonitor.swift */; };
B5E1B5961CAA0C15007FD580 /* CSObjectMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5921CAA0C15007FD580 /* CSObjectMonitor.swift */; };
B5E1B5981CAA0C23007FD580 /* CSObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5971CAA0C23007FD580 /* CSObjectObserver.swift */; };
B5E1B5991CAA0C23007FD580 /* CSObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5971CAA0C23007FD580 /* CSObjectObserver.swift */; };
B5E1B59A1CAA0C23007FD580 /* CSObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5971CAA0C23007FD580 /* CSObjectObserver.swift */; };
B5E1B59B1CAA0C23007FD580 /* CSObjectObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5971CAA0C23007FD580 /* CSObjectObserver.swift */; };
B5E1B59D1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B59C1CAA2568007FD580 /* CSDataStack+Observing.swift */; };
B5E1B59E1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B59C1CAA2568007FD580 /* CSDataStack+Observing.swift */; };
B5E1B59F1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B59C1CAA2568007FD580 /* CSDataStack+Observing.swift */; };
B5E1B5A01CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B59C1CAA2568007FD580 /* CSDataStack+Observing.swift */; };
B5E1B5A21CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A11CAA4365007FD580 /* CSCoreStore+Observing.swift */; };
B5E1B5A31CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A11CAA4365007FD580 /* CSCoreStore+Observing.swift */; };
B5E1B5A41CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A11CAA4365007FD580 /* CSCoreStore+Observing.swift */; };
B5E1B5A51CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A11CAA4365007FD580 /* CSCoreStore+Observing.swift */; };
B5E1B5A81CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A71CAA49E2007FD580 /* CSDataStack+Migrating.swift */; };
B5E1B5A91CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A71CAA49E2007FD580 /* CSDataStack+Migrating.swift */; };
B5E1B5AA1CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A71CAA49E2007FD580 /* CSDataStack+Migrating.swift */; };
B5E1B5AB1CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A71CAA49E2007FD580 /* CSDataStack+Migrating.swift */; };
B5E1B5AC1CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1B5A71CAA49E2007FD580 /* CSDataStack+Migrating.swift */; };
B5E222231CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */; };
B5E222241CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */; };
B5E222251CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */; };
B5E222261CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */; };
B5E222271CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222221CA4E12600BA2E95 /* CSSynchronousDataTransaction.swift */; };
B5E2222A1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */; };
B5E2222B1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E222291CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift */; };
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 */; };
@@ -572,76 +477,54 @@
B5E84F371AFF85470064E85B /* NSManagedObjectContext+Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E84F331AFF85470064E85B /* NSManagedObjectContext+Transaction.swift */; };
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 */; };
B5ECDC3A1CA8369400C7F112 /* CSDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DBE2D11C991B3E00B5CEFA /* CSDataStack.swift */; };
B5ECDC3B1CA836AD00C7F112 /* CoreStoreBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AEFAB41C9962AE00AD137F /* CoreStoreBridge.swift */; };
B5ECDC3C1CA836B600C7F112 /* CSCoreStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DBE2CC1C9914A900B5CEFA /* CSCoreStore.swift */; };
B5ECDC3D1CA836BA00C7F112 /* CSError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A491CA1F4FB002BEF78 /* CSError.swift */; };
B5ECDC3E1CA836BE00C7F112 /* CSCoreStore+Setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = B546F9571C99B17400D5AC55 /* CSCoreStore+Setup.swift */; };
B5ECDC401CA836C800C7F112 /* CSInMemoryStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B546F9681C9AF26D00D5AC55 /* CSInMemoryStore.swift */; };
B5ECDC411CA836C800C7F112 /* CSSQliteStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B546F95C1C9A12B800D5AC55 /* CSSQliteStore.swift */; };
B5ECDC421CA836CF00C7F112 /* CSAsynchronousDataTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5519A5E1CA21954002BEF78 /* CSAsynchronousDataTransaction.swift */; };
B5ECDC431CA836F800C7F112 /* SetupResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = B546F9721C9C553300D5AC55 /* SetupResult.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 */; };
@@ -706,6 +589,7 @@
B501FDE61CA8D20500BE22EF /* CSListObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSListObserver.swift; sourceTree = "<group>"; };
B50392F81C478FF3009900CA /* NSManagedObject+Transaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Transaction.swift"; sourceTree = "<group>"; };
B504D0D51B02362500B2BBB1 /* CoreStore+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+Setup.swift"; sourceTree = "<group>"; };
B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSFetchRequest+CoreStore.swift"; sourceTree = "<group>"; };
B519E4571C4CD2CA00E7B469 /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = "../../Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/GCDKit.framework"; sourceTree = "<group>"; };
B51BE0691B47FC4B0069F532 /* NSManagedObjectModel+Setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectModel+Setup.swift"; sourceTree = "<group>"; };
B51FE5AA1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CoreStore+CustomDebugStringConvertible.swift"; sourceTree = "<group>"; };
@@ -757,6 +641,16 @@
B563216F1BD65082006C9394 /* CoreStore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B56321791BD650DE006C9394 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.0.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; };
B563217B1BD650E3006C9394 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
B565078F1D393087000596DA /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = "../../../Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/GCDKit.framework"; sourceTree = "<group>"; };
B56507911D3930B5000596DA /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = "Carthage/Checkouts/GCDKit/build/Debug-appletvos/GCDKit.framework"; sourceTree = "<group>"; };
B56507931D3930BC000596DA /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; };
B56507951D3930C1000596DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
B56507971D3930CC000596DA /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; };
B56507991D3930D1000596DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
B565079B1D3930D8000596DA /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = "Carthage/Checkouts/GCDKit/build/Debug-watchos/GCDKit.framework"; sourceTree = "<group>"; };
B565079D1D3930ED000596DA /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; };
B565079F1D3930F5000596DA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
B56507A11D393101000596DA /* GCDKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDKit.framework; path = Carthage/Checkouts/GCDKit/build/Debug/GCDKit.framework; sourceTree = "<group>"; };
B5677D3C1CD3B1E400322BFC /* ICloudStoreObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ICloudStoreObserver.swift; sourceTree = "<group>"; };
B56964D31B22FFAD0075EE4A /* DataStack+Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DataStack+Migration.swift"; sourceTree = "<group>"; };
B56965231B356B820075EE4A /* MigrationResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MigrationResult.swift; sourceTree = "<group>"; };
@@ -779,12 +673,6 @@
B5D3F6441C887C0A00C7492A /* LegacySQLiteStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacySQLiteStore.swift; sourceTree = "<group>"; };
B5D7A5B51CA3BF8F005C752B /* CSInto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSInto.swift; sourceTree = "<group>"; };
B5D9C8F61B160ED200E64F0E /* CoreStore.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = CoreStore.podspec; sourceTree = SOURCE_ROOT; };
B5D9E3341CA2C317007A9D52 /* CoreStore_iOS7.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreStore_iOS7.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B5D9E3371CA2C6BF007A9D52 /* GCDBlock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GCDBlock.swift; path = Carthage/Checkouts/GCDKit/Sources/GCDBlock.swift; sourceTree = "<group>"; };
B5D9E3381CA2C6BF007A9D52 /* GCDGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GCDGroup.swift; path = Carthage/Checkouts/GCDKit/Sources/GCDGroup.swift; sourceTree = "<group>"; };
B5D9E33A1CA2C6BF007A9D52 /* GCDQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GCDQueue.swift; path = Carthage/Checkouts/GCDKit/Sources/GCDQueue.swift; sourceTree = "<group>"; };
B5D9E33B1CA2C6BF007A9D52 /* GCDSemaphore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GCDSemaphore.swift; path = Carthage/Checkouts/GCDKit/Sources/GCDSemaphore.swift; sourceTree = "<group>"; };
B5D9E33C1CA2C6BF007A9D52 /* GCDTimer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GCDTimer.swift; path = Carthage/Checkouts/GCDKit/Sources/GCDTimer.swift; sourceTree = "<group>"; };
B5DBE2CC1C9914A900B5CEFA /* CSCoreStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSCoreStore.swift; sourceTree = "<group>"; };
B5DBE2D11C991B3E00B5CEFA /* CSDataStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSDataStack.swift; sourceTree = "<group>"; };
B5DBE2DA1C9939E100B5CEFA /* CoreStoreTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CoreStoreTests-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -865,7 +753,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B519E4581C4CD2CA00E7B469 /* GCDKit.framework in Frameworks */,
B56507901D393087000596DA /* GCDKit.framework in Frameworks */,
B5D39A0219FD00C9000E91BB /* Foundation.framework in Frameworks */,
2F03A54D19C5C872005002A5 /* CoreData.framework in Frameworks */,
);
@@ -883,9 +771,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B519E4591C4CD2D100E7B469 /* GCDKit.framework in Frameworks */,
82BA18E11C4BBE2C00A0916E /* CoreData.framework in Frameworks */,
82BA18DF1C4BBE2600A0916E /* Foundation.framework in Frameworks */,
B56507961D3930C1000596DA /* Foundation.framework in Frameworks */,
B56507941D3930BC000596DA /* CoreData.framework in Frameworks */,
B56507921D3930B5000596DA /* GCDKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -901,9 +789,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B519E45A1C4CD2DA00E7B469 /* GCDKit.framework in Frameworks */,
B52DD1921BE1F8F000949AFE /* CoreData.framework in Frameworks */,
B52DD1911BE1F8EB00949AFE /* Foundation.framework in Frameworks */,
B56507A21D393101000596DA /* GCDKit.framework in Frameworks */,
B56507A01D3930F5000596DA /* Foundation.framework in Frameworks */,
B565079E1D3930ED000596DA /* CoreData.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -919,18 +807,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B519E45B1C4CD2ED00E7B469 /* GCDKit.framework in Frameworks */,
B563217C1BD650E3006C9394 /* Foundation.framework in Frameworks */,
B563217A1BD650DE006C9394 /* CoreData.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B5D9E32A1CA2C317007A9D52 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B5D9E32C1CA2C317007A9D52 /* Foundation.framework in Frameworks */,
B5D9E32D1CA2C317007A9D52 /* CoreData.framework in Frameworks */,
B565079C1D3930D8000596DA /* GCDKit.framework in Frameworks */,
B565079A1D3930D1000596DA /* Foundation.framework in Frameworks */,
B56507981D3930CC000596DA /* CoreData.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -957,7 +836,6 @@
B52DD17D1BE1F8CC00949AFE /* CoreStoreTests.xctest */,
82BA18891C4BBCBA00A0916E /* CoreStore.framework */,
82BA18921C4BBCBA00A0916E /* CoreStoreTests.xctest */,
B5D9E3341CA2C317007A9D52 /* CoreStore_iOS7.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -1030,7 +908,16 @@
2F291E3119C6D4D3007AF63F /* Frameworks */ = {
isa = PBXGroup;
children = (
B5D9E3361CA2C6A3007A9D52 /* GCDKit iOS7 */,
B56507A11D393101000596DA /* GCDKit.framework */,
B565079F1D3930F5000596DA /* Foundation.framework */,
B565079D1D3930ED000596DA /* CoreData.framework */,
B565079B1D3930D8000596DA /* GCDKit.framework */,
B56507991D3930D1000596DA /* Foundation.framework */,
B56507971D3930CC000596DA /* CoreData.framework */,
B56507951D3930C1000596DA /* Foundation.framework */,
B56507931D3930BC000596DA /* CoreData.framework */,
B56507911D3930B5000596DA /* GCDKit.framework */,
B565078F1D393087000596DA /* GCDKit.framework */,
B519E4571C4CD2CA00E7B469 /* GCDKit.framework */,
B5548CD71BD65AE50077652A /* CoreData.framework */,
B56321791BD650DE006C9394 /* CoreData.framework */,
@@ -1152,18 +1039,6 @@
name = Swift;
sourceTree = "<group>";
};
B5D9E3361CA2C6A3007A9D52 /* GCDKit iOS7 */ = {
isa = PBXGroup;
children = (
B5D9E3371CA2C6BF007A9D52 /* GCDBlock.swift */,
B5D9E3381CA2C6BF007A9D52 /* GCDGroup.swift */,
B5D9E33A1CA2C6BF007A9D52 /* GCDQueue.swift */,
B5D9E33B1CA2C6BF007A9D52 /* GCDSemaphore.swift */,
B5D9E33C1CA2C6BF007A9D52 /* GCDTimer.swift */,
);
name = "GCDKit iOS7";
sourceTree = "<group>";
};
B5DBE2CB1C99148100B5CEFA /* ObjectiveC */ = {
isa = PBXGroup;
children = (
@@ -1324,11 +1199,12 @@
isa = PBXGroup;
children = (
B5C976E61C6E3A5900B1AF90 /* CoreStoreFetchedResultsController.swift */,
B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */,
B54A6A541BA15F2A007870FD /* FetchedResultsControllerDelegate.swift */,
B5E834BA1B7691F3001D3D50 /* Functions.swift */,
B5FAD6AB1B51285300714891 /* MigrationManager.swift */,
B5E84F2B1AFF849C0064E85B /* NotificationObserver.swift */,
B526613F1CADD585007B85D9 /* CoreStoreFetchRequest.swift */,
B517A9801D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift */,
B5E84F2C1AFF849C0064E85B /* NSManagedObjectContext+CoreStore.swift */,
B5E84F351AFF85470064E85B /* NSManagedObjectContext+Querying.swift */,
B5E84F321AFF85470064E85B /* NSManagedObjectContext+Setup.swift */,
@@ -1414,15 +1290,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B5D9E32E1CA2C317007A9D52 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
B55717431D15B09D009BDBCA /* CoreStoreBridge.h in Headers */,
B5D9E32F1CA2C317007A9D52 /* CoreStore.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
@@ -1552,24 +1419,6 @@
productReference = B563216F1BD65082006C9394 /* CoreStore.framework */;
productType = "com.apple.product-type.framework";
};
B5D9E2ED1CA2C317007A9D52 /* CoreStore iOS7 */ = {
isa = PBXNativeTarget;
buildConfigurationList = B5D9E3311CA2C317007A9D52 /* Build configuration list for PBXNativeTarget "CoreStore iOS7" */;
buildPhases = (
B5D9E2EE1CA2C317007A9D52 /* Sources */,
B5D9E32A1CA2C317007A9D52 /* Frameworks */,
B5D9E32E1CA2C317007A9D52 /* Headers */,
B5D9E3301CA2C317007A9D52 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "CoreStore iOS7";
productName = CoreStore;
productReference = B5D9E3341CA2C317007A9D52 /* CoreStore_iOS7.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -1582,9 +1431,11 @@
TargetAttributes = {
2F03A52F19C5C6DA005002A5 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
};
2F03A53A19C5C6DA005002A5 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0800;
};
82BA18881C4BBCBA00A0916E = {
CreatedOnToolsVersion = 7.2;
@@ -1616,7 +1467,6 @@
projectDirPath = "";
projectRoot = "";
targets = (
B5D9E2ED1CA2C317007A9D52 /* CoreStore iOS7 */,
2F03A52F19C5C6DA005002A5 /* CoreStore iOS */,
2F03A53A19C5C6DA005002A5 /* CoreStoreTests iOS */,
82BA18881C4BBCBA00A0916E /* CoreStore tvOS */,
@@ -1678,13 +1528,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B5D9E3301CA2C317007A9D52 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -1756,6 +1599,7 @@
B5E84EF61AFF846E0064E85B /* DataStack+Transaction.swift in Sources */,
B5FEC18E1C9166E200532541 /* NSPersistentStore+Setup.swift in Sources */,
B5E1B5A21CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */,
B517A9811D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */,
B5E84EDF1AFF84500064E85B /* DataStack.swift in Sources */,
B59AFF411C6593E400C0ABE2 /* NSPersistentStoreCoordinator+Setup.swift in Sources */,
B5E834BB1B7691F3001D3D50 /* Functions.swift in Sources */,
@@ -1904,6 +1748,7 @@
B59851491C90289D00C99590 /* NSPersistentStoreCoordinator+Setup.swift in Sources */,
B5E1B5A41CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */,
B5FEC18F1C9166E600532541 /* NSPersistentStore+Setup.swift in Sources */,
B517A9821D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */,
82BA18B71C4BBD3F00A0916E /* CoreStore+Querying.swift in Sources */,
82BA18AA1C4BBD3100A0916E /* BaseDataTransaction.swift in Sources */,
82BA18A91C4BBD3100A0916E /* Into.swift in Sources */,
@@ -2052,6 +1897,7 @@
B52DD19C1BE1F92C00949AFE /* Into.swift in Sources */,
B5FE4DA51C8481E100FA6A91 /* StorageInterface.swift in Sources */,
B529C2081CA4A2DC007E7EBD /* CSSaveResult.swift in Sources */,
B517A9841D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */,
B5FE4DAA1C84FB4400FA6A91 /* InMemoryStore.swift in Sources */,
B52DD1AF1BE1F93900949AFE /* GroupBy.swift in Sources */,
B52DD1B01BE1F93900949AFE /* Tweak.swift in Sources */,
@@ -2200,6 +2046,7 @@
B56321A11BD65216006C9394 /* ListMonitor.swift in Sources */,
B5E1B5A51CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */,
B56321881BD65216006C9394 /* BaseDataTransaction.swift in Sources */,
B517A9831D3EE31C006C3791 /* NSFetchRequest+CoreStore.swift in Sources */,
B56321A31BD65216006C9394 /* DataStack+Migration.swift in Sources */,
B56321901BD65216006C9394 /* ImportableUniqueObject.swift in Sources */,
B56321871BD65216006C9394 /* Into.swift in Sources */,
@@ -2249,130 +2096,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B5D9E2EE1CA2C317007A9D52 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B5ECDC0C1CA8161B00C7F112 /* CSGroupBy.swift in Sources */,
B5EA11DD1CA3AFD9002282F8 /* NSPersistentStoreCoordinator+Setup.swift in Sources */,
B53FBA191CAB63E200F0D40A /* NSManagedObject+ObjectiveC.swift in Sources */,
B538BA761D15B3E30003A766 /* CoreStoreBridge.m in Sources */,
B5ECDC3A1CA8369400C7F112 /* CSDataStack.swift in Sources */,
B5D9E2EF1CA2C317007A9D52 /* ObjectMonitor.swift in Sources */,
B5ECDC3B1CA836AD00C7F112 /* CoreStoreBridge.swift in Sources */,
B5ECDC431CA836F800C7F112 /* SetupResult.swift in Sources */,
B59983491CA54BC100E1A417 /* CSBaseDataTransaction.swift in Sources */,
B5E2222B1CA51B6E00BA2E95 /* CSUnsafeDataTransaction.swift in Sources */,
B501FDE81CA8D20500BE22EF /* CSListObserver.swift in Sources */,
B5D9E2F01CA2C317007A9D52 /* CoreStoreFetchedResultsController.swift in Sources */,
B5D9E3461CA2C6C4007A9D52 /* GCDQueue.swift in Sources */,
B5E1B5A31CAA4365007FD580 /* CSCoreStore+Observing.swift in Sources */,
B5D9E2F11CA2C317007A9D52 /* ImportableUniqueObject.swift in Sources */,
B5D9E2F21CA2C317007A9D52 /* CoreStore+Setup.swift in Sources */,
B5D7A5B31CA3B738005C752B /* LegacySQLiteStore.swift in Sources */,
B5D7A5AF1CA3B738005C752B /* (null) in Sources */,
B5D7A5B11CA3B738005C752B /* InMemoryStore.swift in Sources */,
B5ECDC3E1CA836BE00C7F112 /* CSCoreStore+Setup.swift in Sources */,
B5D9E2F31CA2C317007A9D52 /* CoreStoreError.swift in Sources */,
B5D9E2F41CA2C317007A9D52 /* Where.swift in Sources */,
B5677D3E1CD3B1E400322BFC /* ICloudStoreObserver.swift in Sources */,
B5D9E2F51CA2C317007A9D52 /* FetchedResultsControllerDelegate.swift in Sources */,
B5D9E2F61CA2C317007A9D52 /* MigrationType.swift in Sources */,
B5D9E2F71CA2C317007A9D52 /* DataStack+Querying.swift in Sources */,
B5D9E2F81CA2C317007A9D52 /* SectionBy.swift in Sources */,
B5D9E2F91CA2C317007A9D52 /* NSManagedObjectContext+Transaction.swift in Sources */,
B52661411CADD585007B85D9 /* CoreStoreFetchRequest.swift in Sources */,
B5D9E2FA1CA2C317007A9D52 /* UnsafeDataTransaction+Observing.swift in Sources */,
B5E1B5991CAA0C23007FD580 /* CSObjectObserver.swift in Sources */,
B5ECDC061CA8138100C7F112 /* CSOrderBy.swift in Sources */,
B5ECDC401CA836C800C7F112 /* CSInMemoryStore.swift in Sources */,
B5D9E2FB1CA2C317007A9D52 /* MigrationChain.swift in Sources */,
B5E1B5941CAA0C15007FD580 /* CSObjectMonitor.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 */,
B53FBA1F1CAB63FA00F0D40A /* NSFetchedResultsController+ObjectiveC.swift in Sources */,
B5D7A5B41CA3BAE7005C752B /* NSPersistentStore+Setup.swift in Sources */,
B5D9E3031CA2C317007A9D52 /* NSManagedObject+Transaction.swift in Sources */,
B53FBA0C1CAB5E6500F0D40A /* CSCoreStore+Migrating.swift in Sources */,
B5D9E3041CA2C317007A9D52 /* NSFetchedResultsController+Convenience.swift in Sources */,
B5D9E3051CA2C317007A9D52 /* (null) in Sources */,
B51FE5AC1CD4D00300E54258 /* CoreStore+CustomDebugStringConvertible.swift in Sources */,
B5D9E3061CA2C317007A9D52 /* ObjectObserver.swift in Sources */,
B5D9E3071CA2C317007A9D52 /* NotificationObserver.swift in Sources */,
B53FBA051CAB300C00F0D40A /* CSMigrationType.swift in Sources */,
B5D9E3081CA2C317007A9D52 /* ImportableObject.swift in Sources */,
B53FBA131CAB63CB00F0D40A /* NSProgress+ObjectiveC.swift in Sources */,
B5ECDC3C1CA836B600C7F112 /* CSCoreStore.swift in Sources */,
B5D9E3091CA2C317007A9D52 /* MigrationResult.swift in Sources */,
B53FB9FF1CAB2D2F00F0D40A /* CSMigrationResult.swift in Sources */,
B5D9E30A1CA2C317007A9D52 /* CoreStore.swift in Sources */,
B5D9E30B1CA2C317007A9D52 /* ClauseTypes.swift in Sources */,
B5D9E30C1CA2C317007A9D52 /* BaseDataTransaction+Querying.swift in Sources */,
B5D9E30D1CA2C317007A9D52 /* MigrationManager.swift in Sources */,
B5D9E30E1CA2C317007A9D52 /* DataStack+Transaction.swift in Sources */,
B5A5F2671CAEC50F004AB9AF /* CSSelect.swift in Sources */,
B5D9E30F1CA2C317007A9D52 /* DataStack.swift in Sources */,
B5D9E3101CA2C317007A9D52 /* Functions.swift in Sources */,
B5D9E3431CA2C6C4007A9D52 /* GCDBlock.swift in Sources */,
B501FDE31CA8D1F500BE22EF /* CSListMonitor.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 */,
B559CD441CAA8B6300E4D58B /* CSSetupResult.swift in Sources */,
B5E1B59E1CAA2568007FD580 /* CSDataStack+Observing.swift in Sources */,
B5ECDC241CA81A3900C7F112 /* CSCoreStore+Querying.swift in Sources */,
B5D9E3151CA2C317007A9D52 /* SaveResult.swift in Sources */,
B529C2051CA4A2DB007E7EBD /* CSSaveResult.swift in Sources */,
B5E1B5A91CAA49E2007FD580 /* CSDataStack+Migrating.swift in Sources */,
B5D9E3161CA2C317007A9D52 /* From.swift in Sources */,
B5ECDC421CA836CF00C7F112 /* CSAsynchronousDataTransaction.swift in Sources */,
B5D7A5B71CA3BF8F005C752B /* CSInto.swift in Sources */,
B5D9E3181CA2C317007A9D52 /* NSProgress+Convenience.swift in Sources */,
B5D9E3191CA2C317007A9D52 /* SynchronousDataTransaction.swift in Sources */,
B5ECDBE61CA6BEA300C7F112 /* CSClauseTypes.swift in Sources */,
B559CD4A1CAA8C6D00E4D58B /* CSStorageInterface.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 */,
B5ECDC411CA836C800C7F112 /* CSSQliteStore.swift in Sources */,
B5D7A5B21CA3B738005C752B /* SQLiteStore.swift in Sources */,
B501FDDE1CA8D05000BE22EF /* CSSectionBy.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 */,
B5D9E3481CA2C6C4007A9D52 /* GCDTimer.swift in Sources */,
B59FA0AF1CCBACA6007C9BCA /* ICloudStore.swift in Sources */,
B5D9E3231CA2C317007A9D52 /* CoreStore+Observing.swift in Sources */,
B5ECDC3D1CA836BA00C7F112 /* CSError.swift in Sources */,
B5D9E3241CA2C317007A9D52 /* BaseDataTransaction+Importing.swift in Sources */,
B5D9E3251CA2C317007A9D52 /* DefaultLogger.swift in Sources */,
B5D9E3261CA2C317007A9D52 /* AsynchronousDataTransaction.swift in Sources */,
B5D9E3271CA2C317007A9D52 /* CoreStore+Querying.swift in Sources */,
B5D9E3281CA2C317007A9D52 /* ListObserver.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -2511,6 +2234,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -2526,6 +2250,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -2544,6 +2269,7 @@
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "CoreStoreTests/CoreStoreTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -2557,6 +2283,7 @@
PRODUCT_NAME = CoreStoreTests;
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "CoreStoreTests/CoreStoreTests-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -2568,6 +2295,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug-appletvos",
);
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -2586,6 +2317,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug-appletvos",
);
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -2639,6 +2374,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug",
);
FRAMEWORK_VERSION = A;
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -2662,6 +2401,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug",
);
FRAMEWORK_VERSION = A;
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -2716,6 +2459,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug-watchos",
);
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -2736,6 +2483,10 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Checkouts/GCDKit/build/Debug-watchos",
);
GCC_NO_COMMON_BLOCKS = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -2745,52 +2496,6 @@
};
name = Release;
};
B5D9E3321CA2C317007A9D52 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"USE_FRAMEWORKS=0",
"SWIFT_OBJC_INTERFACE_HEADER_NAME=<$(SWIFT_MODULE_NAME)/$(SWIFT_OBJC_INTERFACE_HEADER_NAME)>",
);
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_NAME = CoreStore_iOS7;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
B5D9E3331CA2C317007A9D52 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_PREPROCESSOR_DEFINITIONS = (
"USE_FRAMEWORKS=0",
"SWIFT_OBJC_INTERFACE_HEADER_NAME=<$(SWIFT_MODULE_NAME)/$(SWIFT_OBJC_INTERFACE_HEADER_NAME)>",
);
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "";
PRODUCT_NAME = CoreStore_iOS7;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -2866,15 +2571,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B5D9E3311CA2C317007A9D52 /* Build configuration list for PBXNativeTarget "CoreStore iOS7" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B5D9E3321CA2C317007A9D52 /* Debug */,
B5D9E3331CA2C317007A9D52 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCVersionGroup section */
@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B5D9E2ED1CA2C317007A9D52"
BuildableName = "CoreStore_iOS7.framework"
BlueprintName = "CoreStore iOS7"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F03A53A19C5C6DA005002A5"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests iOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F03A53A19C5C6DA005002A5"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests iOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F03A52F19C5C6DA005002A5"
BuildableName = "CoreStore.framework"
BlueprintName = "CoreStore iOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B5D9E2ED1CA2C317007A9D52"
BuildableName = "CoreStore_iOS7.framework"
BlueprintName = "CoreStore iOS7"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -19,7 +19,7 @@ private struct Static {
SQLiteStore(
fileName: "TimeZoneDemo.sqlite",
configuration: "FetchingAndQueryingDemo",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
@@ -53,7 +53,7 @@ private struct Static {
SQLiteStore(
fileName: "ColorsDemo.sqlite",
configuration: "ObservingDemo",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
@@ -52,15 +52,15 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
func log(level level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
GCDQueue.Main.async { [weak self] in
GCDQueue.main.async { [weak self] in
let levelString: String
switch level {
case .Trace: levelString = "Trace"
case .Notice: levelString = "Notice"
case .Warning: levelString = "Warning"
case .Fatal: levelString = "Fatal"
case .trace: levelString = "Trace"
case .notice: levelString = "Notice"
case .warning: levelString = "Warning"
case .fatal: levelString = "Fatal"
}
self?.textView?.insertText("\((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ [Log:\(levelString)] \(message)\n\n")
}
@@ -68,7 +68,7 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
func log(error error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
GCDQueue.Main.async { [weak self] in
GCDQueue.main.async { [weak self] in
self?.textView?.insertText("\((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ [Error] \(message): \(error)\n\n")
}
@@ -82,7 +82,7 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
}
let messageString = message()
GCDQueue.Main.async { [weak self] in
GCDQueue.main.async { [weak self] in
self?.textView?.insertText("\((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ [Assert] \(messageString)\n\n")
}
@@ -22,14 +22,14 @@ private struct Static {
SQLiteStore(
fileName: "AccountsDemo_FB_Male.sqlite",
configuration: maleConfiguration,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
try! dataStack.addStorageAndWait(
SQLiteStore(
fileName: "AccountsDemo_FB_Female.sqlite",
configuration: femaleConfiguration,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
@@ -60,14 +60,14 @@ private struct Static {
SQLiteStore(
fileName: "AccountsDemo_TW_Male.sqlite",
configuration: maleConfiguration,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
try! dataStack.addStorageAndWait(
SQLiteStore(
fileName: "AccountsDemo_TW_Female.sqlite",
configuration: femaleConfiguration,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
@@ -22,7 +22,7 @@ private struct Static {
SQLiteStore(
fileName: "PlaceDemo.sqlite",
configuration: "TransactionsDemo",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
+26 -26
View File
@@ -36,11 +36,11 @@ class BaseTestCase: XCTestCase {
// MARK: Internal
@nonobjc
func prepareStack<T>(configurations configurations: [String?] = [nil], @noescape _ closure: (dataStack: DataStack) -> T) -> T {
func prepareStack<T>(_ configurations: [String?] = [nil], @noescape _ closure: (dataStack: DataStack) -> T) -> T {
let stack = DataStack(
modelName: "Model",
bundle: NSBundle(forClass: self.dynamicType)
bundle: Bundle(forClass: self.dynamicType)
)
do {
@@ -49,10 +49,10 @@ class BaseTestCase: XCTestCase {
try stack.addStorageAndWait(
SQLiteStore(
fileURL: SQLiteStore.defaultRootDirectory
.URLByAppendingPathComponent(NSUUID().UUIDString)
.URLByAppendingPathComponent(UUID().UUIDString)
.URLByAppendingPathComponent("\(self.dynamicType)_\(($0 ?? "-null-")).sqlite"),
configuration: $0,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
)
}
@@ -65,7 +65,7 @@ class BaseTestCase: XCTestCase {
}
@nonobjc
func expectLogger<T>(expectations: [TestLogger.Expectation], @noescape closure: () -> T) -> T {
func expectLogger<T>(_ expectations: [TestLogger.Expectation], @noescape closure: () -> T) -> T {
CoreStore.logger = TestLogger(self.prepareLoggerExpectations(expectations))
defer {
@@ -77,18 +77,18 @@ class BaseTestCase: XCTestCase {
}
@nonobjc
func expectLogger(expectations: [TestLogger.Expectation: XCTestExpectation]) {
func expectLogger(_ expectations: [TestLogger.Expectation: XCTestExpectation]) {
CoreStore.logger = TestLogger(expectations)
}
@nonobjc
func prepareLoggerExpectations(expectations: [TestLogger.Expectation]) -> [TestLogger.Expectation: XCTestExpectation] {
func prepareLoggerExpectations(_ expectations: [TestLogger.Expectation]) -> [TestLogger.Expectation: XCTestExpectation] {
var testExpectations: [TestLogger.Expectation: XCTestExpectation] = [:]
for expectation in expectations {
testExpectations[expectation] = self.expectationWithDescription("Logger Expectation: \(expectation)")
testExpectations[expectation] = self.expectation(withDescription: "Logger Expectation: \(expectation)")
}
return testExpectations
}
@@ -96,13 +96,13 @@ class BaseTestCase: XCTestCase {
@nonobjc
func checkExpectationsImmediately() {
self.waitForExpectationsWithTimeout(0, handler: nil)
self.waitForExpectations(withTimeout: 0, handler: nil)
}
@nonobjc
func waitAndCheckExpectations() {
self.waitForExpectationsWithTimeout(10, handler: nil)
self.waitForExpectations(withTimeout: 10, handler: nil)
}
// MARK: XCTestCase
@@ -126,7 +126,7 @@ class BaseTestCase: XCTestCase {
private func deleteStores() {
_ = try? NSFileManager.defaultManager().removeItemAtURL(SQLiteStore.defaultRootDirectory)
_ = try? FileManager.defaultManager().removeItemAtURL(SQLiteStore.defaultRootDirectory)
}
}
@@ -137,11 +137,11 @@ class TestLogger: CoreStoreLogger {
enum Expectation {
case LogWarning
case LogFatal
case LogError
case AssertionFailure
case FatalError
case logWarning
case logFatal
case logError
case assertionFailure
case fatalError
}
init(_ expectations: [Expectation: XCTestExpectation]) {
@@ -152,33 +152,33 @@ class TestLogger: CoreStoreLogger {
// MARK: CoreStoreLogger
func log(level level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
func log(_ level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
switch level {
case .Warning: self.fulfill(.LogWarning)
case .Fatal: self.fulfill(.LogFatal)
case .warning: self.fulfill(.logWarning)
case .fatal: self.fulfill(.logFatal)
default: break
}
}
func log(error error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
func log(_ error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
self.fulfill(.LogError)
self.fulfill(.logError)
}
func assert(@autoclosure condition: () -> Bool, @autoclosure message: () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
func assert(@autoclosure _ condition: () -> Bool, @autoclosure message: () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
if condition() {
return
}
self.fulfill(.AssertionFailure)
self.fulfill(.assertionFailure)
}
func abort(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
self.fulfill(.FatalError)
self.fulfill(.fatalError)
}
@@ -186,7 +186,7 @@ class TestLogger: CoreStoreLogger {
private var expectations: [Expectation: XCTestExpectation]
private func fulfill(expectation: Expectation) {
private func fulfill(_ expectation: Expectation) {
if let instance = self.expectations[expectation] {
@@ -17,18 +17,18 @@ import CoreStore
class BaseTestDataTestCase: BaseTestCase {
@nonobjc
let dateFormatter: NSDateFormatter = {
let dateFormatter: DateFormatter = {
let formatter = NSDateFormatter()
formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
formatter.timeZone = NSTimeZone(name: "UTC")
formatter.calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian)
let formatter = DateFormatter()
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
formatter.timeZone = TimeZone(name: "UTC")
formatter.calendar = Calendar(identifier: Calendar.Identifier.gregorian)
formatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"
return formatter
}()
@nonobjc
func prepareTestDataForStack(stack: DataStack, configurations: [String?] = [nil]) {
func prepareTestDataForStack(_ stack: DataStack, configurations: [String?] = [nil]) {
stack.beginSynchronous { (transaction) in
+5 -5
View File
@@ -58,7 +58,7 @@ final class ErrorTests: XCTestCase {
@objc
dynamic func test_ThatDifferentStorageExistsAtURLErrors_BridgeCorrectly() {
let dummyURL = NSURL(string: "file:///test1/test2.sqlite")!
let dummyURL = URL(string: "file:///test1/test2.sqlite")!
let error = CoreStoreError.DifferentStorageExistsAtURL(existingPersistentStoreURL: dummyURL)
XCTAssertEqual((error as NSError).domain, CoreStoreErrorDomain)
@@ -83,9 +83,9 @@ final class ErrorTests: XCTestCase {
@objc
dynamic func test_ThatMappingModelNotFoundErrors_BridgeCorrectly() {
let dummyURL = NSURL(string: "file:///test1/test2.sqlite")!
let dummyURL = URL(string: "file:///test1/test2.sqlite")!
let model = NSManagedObjectModel.fromBundle(NSBundle(forClass: self.dynamicType), modelName: "Model")
let model = NSManagedObjectModel.fromBundle(Bundle(forClass: self.dynamicType), modelName: "Model")
let version = "1.0.0"
let error = CoreStoreError.MappingModelNotFound(localStoreURL: dummyURL, targetModel: model, targetModelVersion: version)
@@ -113,7 +113,7 @@ final class ErrorTests: XCTestCase {
@objc
dynamic func test_ThatProgressiveMigrationRequiredErrors_BridgeCorrectly() {
let dummyURL = NSURL(string: "file:///test1/test2.sqlite")!
let dummyURL = URL(string: "file:///test1/test2.sqlite")!
let error = CoreStoreError.ProgressiveMigrationRequired(localStoreURL: dummyURL)
XCTAssertEqual((error as NSError).domain, CoreStoreErrorDomain)
@@ -144,7 +144,7 @@ final class ErrorTests: XCTestCase {
userInfo: [
"key1": "value1",
"key2": 2,
"key3": NSDate()
"key3": Date()
]
)
let error = CoreStoreError.InternalError(NSError: internalError)
+2 -2
View File
@@ -97,7 +97,7 @@ final class FetchTests: BaseTestDataTestCase {
XCTAssertEqual(existing1!.objectID, object.objectID)
XCTAssertEqual(existing1!.managedObjectContext, transaction.context)
GCDQueue.Main.async {
GCDQueue.main.async {
let existing2 = stack.fetchExisting(existing1!)
XCTAssertNotNil(existing2)
@@ -204,7 +204,7 @@ final class FetchTests: BaseTestDataTestCase {
XCTAssertEqual(object.managedObjectContext, transaction.context)
}
GCDQueue.Main.async {
GCDQueue.main.async {
let existing2 = stack.fetchExisting(existing1)
XCTAssertEqual(
+12 -12
View File
@@ -883,17 +883,17 @@ class ImportTests: BaseTestDataTestCase {
// MARK: - TestInsertError
private struct TestInsertError: ErrorType {}
private struct TestInsertError: ErrorProtocol {}
// MARK: - TestUpdateError
private struct TestUpdateError: ErrorType {}
private struct TestUpdateError: ErrorProtocol {}
// MARK: - TestIDError
private struct TestIDError: ErrorType {}
private struct TestIDError: ErrorProtocol {}
// MARK: - TestEntity1
@@ -904,12 +904,12 @@ extension TestEntity1: ImportableUniqueObject {
typealias ImportSource = [String: AnyObject]
static func shouldInsertFromImportSource(source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) -> Bool {
static func shouldInsertFromImportSource(_ source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) -> Bool {
return source["skip_insert"] == nil
}
func didInsertFromImportSource(source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws {
func didInsertFromImportSource(_ source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws {
if let _ = source["throw_on_insert"] {
@@ -919,8 +919,8 @@ extension TestEntity1: ImportableUniqueObject {
self.testNumber = source["testNumber"] as? NSNumber
self.testDecimal = source["testDecimal"] as? NSDecimalNumber
self.testString = source["testString"] as? String
self.testData = source["testData"] as? NSData
self.testDate = source["testDate"] as? NSDate
self.testData = source["testData"] as? Data
self.testDate = source["testDate"] as? Date
self.testNil = nil
}
@@ -951,12 +951,12 @@ extension TestEntity1: ImportableUniqueObject {
}
}
static func shouldUpdateFromImportSource(source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) -> Bool {
static func shouldUpdateFromImportSource(_ source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) -> Bool {
return source["skip_update"] == nil
}
static func uniqueIDFromImportSource(source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws -> NSNumber? {
static func uniqueIDFromImportSource(_ source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws -> NSNumber? {
if let _ = source["throw_on_id"] {
@@ -965,7 +965,7 @@ extension TestEntity1: ImportableUniqueObject {
return source["testEntityID"] as? NSNumber
}
func updateFromImportSource(source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws {
func updateFromImportSource(_ source: [String: AnyObject], inTransaction transaction: BaseDataTransaction) throws {
if let _ = source["throw_on_update"] {
@@ -975,8 +975,8 @@ extension TestEntity1: ImportableUniqueObject {
self.testNumber = source["testNumber"] as? NSNumber
self.testDecimal = source["testDecimal"] as? NSDecimalNumber
self.testString = source["testString"] as? String
self.testData = source["testData"] as? NSData
self.testDate = source["testDate"] as? NSDate
self.testData = source["testData"] as? Data
self.testDate = source["testDate"] as? Date
self.testNil = nil
}
}
+28 -28
View File
@@ -562,37 +562,37 @@ class TestListObserver: ListSectionObserver {
typealias ListEntityType = TestEntity1
func listMonitorWillChange(monitor: ListMonitor<TestEntity1>) {
func listMonitorWillChange(_ monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorWillChange:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitorWillChange:"),
object: self,
userInfo: [:]
)
}
func listMonitorDidChange(monitor: ListMonitor<TestEntity1>) {
func listMonitorDidChange(_ monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorDidChange:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitorDidChange:"),
object: self,
userInfo: [:]
)
}
func listMonitorWillRefetch(monitor: ListMonitor<TestEntity1>) {
func listMonitorWillRefetch(_ monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorWillRefetch:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitorWillRefetch:"),
object: self,
userInfo: [:]
)
}
func listMonitorDidRefetch(monitor: ListMonitor<TestEntity1>) {
func listMonitorDidRefetch(_ monitor: ListMonitor<TestEntity1>) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitorDidRefetch:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitorDidRefetch:"),
object: self,
userInfo: [:]
)
@@ -601,10 +601,10 @@ class TestListObserver: ListSectionObserver {
// MARK: ListObjectObserver
func listMonitor(monitor: ListMonitor<TestEntity1>, didInsertObject object: TestEntity1, toIndexPath indexPath: NSIndexPath) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didInsertObject object: TestEntity1, toIndexPath indexPath: IndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didInsertObject:toIndexPath:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitor:didInsertObject:toIndexPath:"),
object: self,
userInfo: [
"object": object,
@@ -613,10 +613,10 @@ class TestListObserver: ListSectionObserver {
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didDeleteObject object: TestEntity1, fromIndexPath indexPath: NSIndexPath) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didDeleteObject object: TestEntity1, fromIndexPath indexPath: IndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didDeleteObject:fromIndexPath:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitor:didDeleteObject:fromIndexPath:"),
object: self,
userInfo: [
"object": object,
@@ -625,10 +625,10 @@ class TestListObserver: ListSectionObserver {
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didUpdateObject object: TestEntity1, atIndexPath indexPath: NSIndexPath) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didUpdateObject object: TestEntity1, atIndexPath indexPath: IndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didUpdateObject:atIndexPath:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitor:didUpdateObject:atIndexPath:"),
object: self,
userInfo: [
"object": object,
@@ -638,10 +638,10 @@ class TestListObserver: ListSectionObserver {
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didMoveObject object: TestEntity1, fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didMoveObject object: TestEntity1, fromIndexPath: IndexPath, toIndexPath: IndexPath) {
NSNotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didMoveObject:fromIndexPath:toIndexPath:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "listMonitor:didMoveObject:fromIndexPath:toIndexPath:"),
object: self,
userInfo: [
"object": object,
@@ -654,9 +654,9 @@ class TestListObserver: ListSectionObserver {
// MARK: ListSectionObserver
func listMonitor(monitor: ListMonitor<TestEntity1>, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int) {
NSNotificationCenter.defaultCenter().postNotificationName(
NotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didInsertSection:toSectionIndex:",
object: self,
userInfo: [
@@ -666,9 +666,9 @@ class TestListObserver: ListSectionObserver {
)
}
func listMonitor(monitor: ListMonitor<TestEntity1>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int) {
func listMonitor(_ monitor: ListMonitor<TestEntity1>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int) {
NSNotificationCenter.defaultCenter().postNotificationName(
NotificationCenter.defaultCenter().postNotificationName(
"listMonitor:didDeleteSection:fromSectionIndex:",
object: self,
userInfo: [
+8 -8
View File
@@ -208,10 +208,10 @@ class TestObjectObserver: ObjectObserver {
typealias ObjectEntityType = TestEntity1
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, willUpdateObject object: TestEntity1) {
func objectMonitor(_ monitor: ObjectMonitor<TestEntity1>, willUpdateObject object: TestEntity1) {
NSNotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:willUpdateObject:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "objectMonitor:willUpdateObject:"),
object: self,
userInfo: [
"object": object
@@ -219,9 +219,9 @@ class TestObjectObserver: ObjectObserver {
)
}
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, didUpdateObject object: TestEntity1, changedPersistentKeys: Set<KeyPath>) {
func objectMonitor(_ monitor: ObjectMonitor<TestEntity1>, didUpdateObject object: TestEntity1, changedPersistentKeys: Set<KeyPath>) {
NSNotificationCenter.defaultCenter().postNotificationName(
NotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:didUpdateObject:changedPersistentKeys:",
object: self,
userInfo: [
@@ -231,10 +231,10 @@ class TestObjectObserver: ObjectObserver {
)
}
func objectMonitor(monitor: ObjectMonitor<TestEntity1>, didDeleteObject object: TestEntity1) {
func objectMonitor(_ monitor: ObjectMonitor<TestEntity1>, didDeleteObject object: TestEntity1) {
NSNotificationCenter.defaultCenter().postNotificationName(
"objectMonitor:didDeleteObject:",
NotificationCenter.default.post(
name: Notification.Name(rawValue: "objectMonitor:didDeleteObject:"),
object: self,
userInfo: [
"object": object
+16 -16
View File
@@ -40,26 +40,26 @@ final class OrderByTests: XCTestCase {
let orderBy = OrderBy()
XCTAssertEqual(orderBy, OrderBy([] as [NSSortDescriptor]))
XCTAssertNotEqual(orderBy, OrderBy(NSSortDescriptor(key: "key", ascending: false)))
XCTAssertNotEqual(orderBy, OrderBy(SortDescriptor(key: "key", ascending: false)))
XCTAssertTrue(orderBy.sortDescriptors.isEmpty)
}
do {
let sortDescriptor = NSSortDescriptor(key: "key1", ascending: true)
let sortDescriptor = SortDescriptor(key: "key1", ascending: true)
let orderBy = OrderBy(sortDescriptor)
XCTAssertEqual(orderBy, OrderBy(sortDescriptor))
XCTAssertEqual(orderBy, OrderBy(.Ascending("key1")))
XCTAssertNotEqual(orderBy, OrderBy(.Ascending("key2")))
XCTAssertNotEqual(orderBy, OrderBy(.Descending("key1")))
XCTAssertNotEqual(orderBy, OrderBy(NSSortDescriptor(key: "key1", ascending: false)))
XCTAssertNotEqual(orderBy, OrderBy(SortDescriptor(key: "key1", ascending: false)))
XCTAssertEqual(orderBy, OrderBy([sortDescriptor]))
XCTAssertEqual(orderBy.sortDescriptors, [sortDescriptor])
}
do {
let sortDescriptors = [
NSSortDescriptor(key: "key1", ascending: true),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: true),
SortDescriptor(key: "key2", ascending: false)
]
let orderBy = OrderBy(sortDescriptors)
XCTAssertEqual(orderBy, OrderBy(sortDescriptors))
@@ -68,8 +68,8 @@ final class OrderByTests: XCTestCase {
orderBy,
OrderBy(
[
NSSortDescriptor(key: "key1", ascending: false),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: false),
SortDescriptor(key: "key2", ascending: false)
]
)
)
@@ -80,7 +80,7 @@ final class OrderByTests: XCTestCase {
do {
let orderBy = OrderBy(.Ascending("key1"))
let sortDescriptor = NSSortDescriptor(key: "key1", ascending: true)
let sortDescriptor = SortDescriptor(key: "key1", ascending: true)
XCTAssertEqual(orderBy, OrderBy(sortDescriptor))
XCTAssertEqual(orderBy, OrderBy(.Ascending("key1")))
XCTAssertNotEqual(orderBy, OrderBy(.Descending("key1")))
@@ -92,8 +92,8 @@ final class OrderByTests: XCTestCase {
let orderBy = OrderBy(.Ascending("key1"), .Descending("key2"))
let sortDescriptors = [
NSSortDescriptor(key: "key1", ascending: true),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: true),
SortDescriptor(key: "key2", ascending: false)
]
XCTAssertEqual(orderBy, OrderBy(sortDescriptors))
XCTAssertEqual(orderBy, OrderBy(.Ascending("key1"), .Descending("key2")))
@@ -101,8 +101,8 @@ final class OrderByTests: XCTestCase {
orderBy,
OrderBy(
[
NSSortDescriptor(key: "key1", ascending: false),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: false),
SortDescriptor(key: "key2", ascending: false)
]
)
)
@@ -115,8 +115,8 @@ final class OrderByTests: XCTestCase {
let sortKeys: [SortKey] = [.Ascending("key1"), .Descending("key2")]
let orderBy = OrderBy(sortKeys)
let sortDescriptors = [
NSSortDescriptor(key: "key1", ascending: true),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: true),
SortDescriptor(key: "key2", ascending: false)
]
XCTAssertEqual(orderBy, OrderBy(sortDescriptors))
XCTAssertEqual(orderBy, OrderBy(.Ascending("key1"), .Descending("key2")))
@@ -124,8 +124,8 @@ final class OrderByTests: XCTestCase {
orderBy,
OrderBy(
[
NSSortDescriptor(key: "key1", ascending: false),
NSSortDescriptor(key: "key2", ascending: false)
SortDescriptor(key: "key1", ascending: false),
SortDescriptor(key: "key2", ascending: false)
]
)
)
+14 -14
View File
@@ -49,7 +49,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Attribute(let key):
case ._attribute(let key):
XCTAssertEqual(key, "attribute")
default:
@@ -68,7 +68,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Attribute(let key):
case ._attribute(let key):
XCTAssertEqual(key, "attribute")
default:
@@ -94,7 +94,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "average:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "average(attribute)")
@@ -118,7 +118,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "average:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "alias")
@@ -147,7 +147,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "count:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "count(attribute)")
@@ -171,7 +171,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "count:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "alias")
@@ -200,7 +200,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "max:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "max(attribute)")
@@ -224,7 +224,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "max:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "alias")
@@ -253,7 +253,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "min:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "min(attribute)")
@@ -277,7 +277,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "min:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "alias")
@@ -306,7 +306,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "sum:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "sum(attribute)")
@@ -330,7 +330,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.ObjectID())
switch term {
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
XCTAssertEqual(function, "sum:")
XCTAssertEqual(keyPath, "attribute")
XCTAssertEqual(alias, "alias")
@@ -358,7 +358,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.Sum("attribute"))
switch term {
case ._Identity(let alias, let nativeType):
case ._identity(let alias, let nativeType):
XCTAssertEqual(alias, "objectID")
XCTAssertTrue(nativeType == .ObjectIDAttributeType)
@@ -380,7 +380,7 @@ final class SelectTests: XCTestCase {
XCTAssertNotEqual(term, SelectTerm.Sum("attribute"))
switch term {
case ._Identity(let alias, let nativeType):
case ._identity(let alias, let nativeType):
XCTAssertEqual(alias, "alias")
XCTAssertTrue(nativeType == .ObjectIDAttributeType)
+9 -9
View File
@@ -36,7 +36,7 @@ class SetupTests: BaseTestCase {
do {
let model = NSManagedObjectModel.mergedModelFromBundles([NSBundle(forClass: self.dynamicType)])!
let model = NSManagedObjectModel.mergedModelFromBundles([Bundle(forClass: self.dynamicType)])!
let stack = DataStack(model: model, migrationChain: nil)
XCTAssertEqual(stack.coordinator.managedObjectModel, model)
@@ -60,7 +60,7 @@ class SetupTests: BaseTestCase {
DataStack(
modelName: "Model",
bundle: NSBundle(forClass: self.dynamicType),
bundle: Bundle(forClass: self.dynamicType),
migrationChain: migrationChain
)
}
@@ -77,7 +77,7 @@ class SetupTests: BaseTestCase {
let stack = DataStack(
modelName: "Model",
bundle: NSBundle(forClass: self.dynamicType)
bundle: Bundle(forClass: self.dynamicType)
)
do {
@@ -132,7 +132,7 @@ class SetupTests: BaseTestCase {
let stack = DataStack(
modelName: "Model",
bundle: NSBundle(forClass: self.dynamicType)
bundle: Bundle(forClass: self.dynamicType)
)
do {
@@ -154,7 +154,7 @@ class SetupTests: BaseTestCase {
let sqliteStore = SQLiteStore(
fileName: "ConfigStore1.sqlite",
configuration: "Config1",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
do {
@@ -173,7 +173,7 @@ class SetupTests: BaseTestCase {
let sqliteStore = SQLiteStore(
fileName: "ConfigStore2.sqlite",
configuration: "Config2",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
do {
@@ -194,7 +194,7 @@ class SetupTests: BaseTestCase {
let stack = DataStack(
modelName: "Model",
bundle: NSBundle(forClass: self.dynamicType)
bundle: Bundle(forClass: self.dynamicType)
)
do {
@@ -216,7 +216,7 @@ class SetupTests: BaseTestCase {
let sqliteStore = SQLiteStore(
fileName: "ConfigStore1.sqlite",
configuration: "Config1",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
do {
@@ -235,7 +235,7 @@ class SetupTests: BaseTestCase {
let sqliteStore = SQLiteStore(
fileName: "ConfigStore2.sqlite",
configuration: "Config2",
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
do {
+34 -35
View File
@@ -57,22 +57,21 @@ final class StorageInterfaceTests: XCTestCase {
#if os(tvOS)
let systemDirectorySearchPath = NSSearchPathDirectory.CachesDirectory
#else
let systemDirectorySearchPath = NSSearchPathDirectory.ApplicationSupportDirectory
let systemDirectorySearchPath = FileManager.SearchPathDirectory.applicationSupportDirectory
#endif
let defaultSystemDirectory = NSFileManager
.defaultManager()
.URLsForDirectory(systemDirectorySearchPath, inDomains: .UserDomainMask).first!
let defaultSystemDirectory = FileManager.default
.urlsForDirectory(systemDirectorySearchPath, inDomains: .userDomainMask).first!
let defaultRootDirectory = defaultSystemDirectory.URLByAppendingPathComponent(
NSBundle.mainBundle().bundleIdentifier ?? "com.CoreStore.DataStack",
let defaultRootDirectory = try! defaultSystemDirectory.appendingPathComponent(
Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack",
isDirectory: true
)
let applicationName = (NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as? String) ?? "CoreData"
let applicationName = (Bundle.main.objectForInfoDictionaryKey("CFBundleName") as? String) ?? "CoreData"
let defaultFileURL = defaultRootDirectory
.URLByAppendingPathComponent(applicationName, isDirectory: false)
.URLByAppendingPathExtension("sqlite")
let defaultFileURL = try! defaultRootDirectory
.appendingPathComponent(applicationName, isDirectory: false)
.appendingPathExtension("sqlite")
XCTAssertEqual(SQLiteStore.defaultRootDirectory, defaultRootDirectory)
XCTAssertEqual(SQLiteStore.defaultFileURL, defaultFileURL)
@@ -87,23 +86,23 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.storeOptions, [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary)
XCTAssertEqual(store.fileURL, SQLiteStore.defaultFileURL)
XCTAssertEqual(store.mappingModelBundles, NSBundle.allBundles())
XCTAssertEqual(store.mappingModelBundles, Bundle.allBundles())
XCTAssertEqual(store.localStorageOptions, [.None])
}
@objc
dynamic func test_ThatFileURLSQLiteStores_ConfigureCorrectly() {
let fileURL = NSURL(fileURLWithPath: NSTemporaryDirectory())
.URLByAppendingPathComponent(NSUUID().UUIDString, isDirectory: false)
.URLByAppendingPathExtension("db")
let bundles = [NSBundle(forClass: self.dynamicType)]
let fileURL = try! URL(fileURLWithPath: NSTemporaryDirectory())
.appendingPathComponent(UUID().uuidString, isDirectory: false)
.appendingPathExtension("db")
let bundles = [Bundle(for: self.dynamicType)]
let store = SQLiteStore(
fileURL: fileURL,
configuration: "config1",
mappingModelBundles: bundles,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
XCTAssertEqual(store.dynamicType.storeType, NSSQLiteStoreType)
XCTAssertEqual(store.configuration, "config1")
@@ -111,20 +110,20 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.fileURL, fileURL)
XCTAssertEqual(store.mappingModelBundles, bundles)
XCTAssertEqual(store.localStorageOptions, [.RecreateStoreOnModelMismatch])
XCTAssertEqual(store.localStorageOptions, [.recreateStoreOnModelMismatch])
}
@objc
dynamic func test_ThatFileNameSQLiteStores_ConfigureCorrectly() {
let fileName = NSUUID().UUIDString + ".db"
let bundles = [NSBundle(forClass: self.dynamicType)]
let fileName = UUID().uuidString + ".db"
let bundles = [Bundle(for: self.dynamicType)]
let store = SQLiteStore(
fileName: fileName,
configuration: "config1",
mappingModelBundles: bundles,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
XCTAssertEqual(store.dynamicType.storeType, NSSQLiteStoreType)
XCTAssertEqual(store.configuration, "config1")
@@ -133,7 +132,7 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.fileURL.URLByDeletingLastPathComponent, SQLiteStore.defaultRootDirectory)
XCTAssertEqual(store.fileURL.lastPathComponent, fileName)
XCTAssertEqual(store.mappingModelBundles, bundles)
XCTAssertEqual(store.localStorageOptions, [.RecreateStoreOnModelMismatch])
XCTAssertEqual(store.localStorageOptions, [.recreateStoreOnModelMismatch])
}
@objc
@@ -142,12 +141,12 @@ final class StorageInterfaceTests: XCTestCase {
#if os(tvOS)
let systemDirectorySearchPath = NSSearchPathDirectory.CachesDirectory
#else
let systemDirectorySearchPath = NSSearchPathDirectory.ApplicationSupportDirectory
let systemDirectorySearchPath = FileManager.SearchPathDirectory.applicationSupportDirectory
#endif
let legacyDefaultRootDirectory = NSFileManager.defaultManager().URLsForDirectory(
let legacyDefaultRootDirectory = FileManager.default.urlsForDirectory(
systemDirectorySearchPath,
inDomains: .UserDomainMask
inDomains: .userDomainMask
).first!
let legacyDefaultFileURL = legacyDefaultRootDirectory
@@ -167,23 +166,23 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.storeOptions, [NSSQLitePragmasOption: ["journal_mode": "WAL"]] as NSDictionary)
XCTAssertEqual(store.fileURL, LegacySQLiteStore.defaultFileURL)
XCTAssertEqual(store.mappingModelBundles, NSBundle.allBundles())
XCTAssertEqual(store.mappingModelBundles, Bundle.allBundles())
XCTAssertEqual(store.localStorageOptions, [.None])
}
@objc
dynamic func test_ThatFileURLLegacySQLiteStores_ConfigureCorrectly() {
let fileURL = NSURL(fileURLWithPath: NSTemporaryDirectory())
.URLByAppendingPathComponent(NSUUID().UUIDString, isDirectory: false)
.URLByAppendingPathExtension("db")
let bundles = [NSBundle(forClass: self.dynamicType)]
let fileURL = try! URL(fileURLWithPath: NSTemporaryDirectory())
.appendingPathComponent(UUID().uuidString, isDirectory: false)
.appendingPathExtension("db")
let bundles = [Bundle(for: self.dynamicType)]
let store = LegacySQLiteStore(
fileURL: fileURL,
configuration: "config1",
mappingModelBundles: bundles,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
XCTAssertEqual(store.dynamicType.storeType, NSSQLiteStoreType)
XCTAssertEqual(store.configuration, "config1")
@@ -191,20 +190,20 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.fileURL, fileURL)
XCTAssertEqual(store.mappingModelBundles, bundles)
XCTAssertEqual(store.localStorageOptions, [.RecreateStoreOnModelMismatch])
XCTAssertEqual(store.localStorageOptions, [.recreateStoreOnModelMismatch])
}
@objc
dynamic func test_ThatFileNameLegacySQLiteStores_ConfigureCorrectly() {
let fileName = NSUUID().UUIDString + ".db"
let bundles = [NSBundle(forClass: self.dynamicType)]
let fileName = UUID().uuidString + ".db"
let bundles = [Bundle(for: self.dynamicType)]
let store = LegacySQLiteStore(
fileName: fileName,
configuration: "config1",
mappingModelBundles: bundles,
localStorageOptions: .RecreateStoreOnModelMismatch
localStorageOptions: .recreateStoreOnModelMismatch
)
XCTAssertEqual(store.dynamicType.storeType, NSSQLiteStoreType)
XCTAssertEqual(store.configuration, "config1")
@@ -213,6 +212,6 @@ final class StorageInterfaceTests: XCTestCase {
XCTAssertEqual(store.fileURL.URLByDeletingLastPathComponent, LegacySQLiteStore.defaultRootDirectory)
XCTAssertEqual(store.fileURL.lastPathComponent, fileName)
XCTAssertEqual(store.mappingModelBundles, bundles)
XCTAssertEqual(store.localStorageOptions, [.RecreateStoreOnModelMismatch])
XCTAssertEqual(store.localStorageOptions, [.recreateStoreOnModelMismatch])
}
}
@@ -31,9 +31,9 @@ class TestEntity1: NSManagedObject {
@NSManaged var testEntityID: NSNumber?
@NSManaged var testString: String?
@NSManaged var testNumber: NSNumber?
@NSManaged var testDate: NSDate?
@NSManaged var testDate: Date?
@NSManaged var testBoolean: NSNumber?
@NSManaged var testDecimal: NSDecimalNumber?
@NSManaged var testData: NSData?
@NSManaged var testData: Data?
@NSManaged var testNil: String?
}
@@ -31,9 +31,9 @@ class TestEntity2: NSManagedObject {
@NSManaged var testEntityID: NSNumber?
@NSManaged var testString: String?
@NSManaged var testNumber: NSNumber?
@NSManaged var testDate: NSDate?
@NSManaged var testDate: Date?
@NSManaged var testBoolean: NSNumber?
@NSManaged var testDecimal: NSDecimalNumber?
@NSManaged var testData: NSData?
@NSManaged var testData: Data?
@NSManaged var testNil: String?
}
+1 -1
View File
@@ -651,7 +651,7 @@ final class TransactionTests: BaseTestCase {
transaction.delete(object)
GCDQueue.Main.async {
GCDQueue.main.async {
XCTAssertEqual(stack.fetchCount(From(TestEntity1)), 1)
+1 -1
View File
@@ -36,7 +36,7 @@ final class TweakTests: XCTestCase {
@objc
dynamic func test_ThatTweakClauses_ApplyToFetchRequestsCorrectly() {
let predicate = NSPredicate(format: "%K == %@", "key", "value")
let predicate = Predicate(format: "%K == %@", "key", "value")
let tweak = Tweak {
$0.fetchOffset = 100
+12 -12
View File
@@ -41,18 +41,18 @@ final class WhereTests: XCTestCase {
let whereClause = Where()
XCTAssertEqual(whereClause, Where(true))
XCTAssertNotEqual(whereClause, Where(false))
XCTAssertEqual(whereClause.predicate, NSPredicate(value: true))
XCTAssertEqual(whereClause.predicate, Predicate(value: true))
}
do {
let whereClause = Where(true)
XCTAssertEqual(whereClause, Where())
XCTAssertNotEqual(whereClause, Where(false))
XCTAssertEqual(whereClause.predicate, NSPredicate(value: true))
XCTAssertEqual(whereClause.predicate, Predicate(value: true))
}
do {
let predicate = NSPredicate(format: "%K == %@", "key", "value")
let predicate = Predicate(format: "%K == %@", "key", "value")
let whereClause = Where(predicate)
XCTAssertEqual(whereClause, Where(predicate))
XCTAssertEqual(whereClause.predicate, predicate)
@@ -60,28 +60,28 @@ final class WhereTests: XCTestCase {
do {
let whereClause = Where("%K == %@", "key", "value")
let predicate = NSPredicate(format: "%K == %@", "key", "value")
let predicate = Predicate(format: "%K == %@", "key", "value")
XCTAssertEqual(whereClause, Where(predicate))
XCTAssertEqual(whereClause.predicate, predicate)
}
do {
let whereClause = Where("%K == %@", argumentArray: ["key", "value"])
let predicate = NSPredicate(format: "%K == %@", "key", "value")
let predicate = Predicate(format: "%K == %@", "key", "value")
XCTAssertEqual(whereClause, Where(predicate))
XCTAssertEqual(whereClause.predicate, predicate)
}
do {
let whereClause = Where("key", isEqualTo: "value")
let predicate = NSPredicate(format: "%K == %@", "key", "value")
let predicate = Predicate(format: "%K == %@", "key", "value")
XCTAssertEqual(whereClause, Where(predicate))
XCTAssertEqual(whereClause.predicate, predicate)
}
do {
let whereClause = Where("key", isMemberOf: ["value1", "value2", "value3"])
let predicate = NSPredicate(format: "%K IN %@", "key", ["value1", "value2", "value3"])
let predicate = Predicate(format: "%K IN %@", "key", ["value1", "value2", "value3"])
XCTAssertEqual(whereClause, Where(predicate))
XCTAssertEqual(whereClause.predicate, predicate)
}
@@ -97,7 +97,7 @@ final class WhereTests: XCTestCase {
do {
let notWhere = !whereClause1
let notPredicate = NSCompoundPredicate(
let notPredicate = CompoundPredicate(
type: .NotPredicateType,
subpredicates: [whereClause1.predicate]
)
@@ -107,10 +107,10 @@ final class WhereTests: XCTestCase {
do {
let andWhere = whereClause1 && whereClause2 && whereClause3
let andPredicate = NSCompoundPredicate(
let andPredicate = CompoundPredicate(
type: .AndPredicateType,
subpredicates: [
NSCompoundPredicate(
CompoundPredicate(
type: .AndPredicateType,
subpredicates: [whereClause1.predicate, whereClause2.predicate]
),
@@ -123,10 +123,10 @@ final class WhereTests: XCTestCase {
do {
let orWhere = whereClause1 || whereClause2 || whereClause3
let orPredicate = NSCompoundPredicate(
let orPredicate = CompoundPredicate(
type: .OrPredicateType,
subpredicates: [
NSCompoundPredicate(
CompoundPredicate(
type: .OrPredicateType,
subpredicates: [whereClause1.predicate, whereClause2.predicate]
),
+8 -8
View File
@@ -206,7 +206,7 @@ let migrationProgress = dataStack.addStorage(
SQLiteStore(
fileURL: sqliteFileURL, // set the target file URL for the sqlite file
configuration: "Config2", // use entities from the "Config2" configuration in the .xcdatamodeld file
localStorageOptions: .RecreateStoreOnModelMismatch // if migration paths cannot be resolved, recreate the sqlite file
localStorageOptions: .recreateStoreOnModelMismatch // if migration paths cannot be resolved, recreate the sqlite file
),
completion: { (result) -> Void in
switch result {
@@ -231,7 +231,7 @@ class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
do {
try self.dataStack.addStorageAndWait(SQLiteStore)
try self.dataStack.addStorageAndWait(SQLiteStore.self)
}
catch { // ...
}
@@ -249,7 +249,7 @@ class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
do {
try CoreStore.addStorageAndWait(SQLiteStore)
try CoreStore.addStorageAndWait(SQLiteStore.self)
}
catch { // ...
}
@@ -274,7 +274,7 @@ try CoreStore.addStorageAndWait(
```
`InMemoryStore`s also implement the `DefaultInitializableStore` sugar protocol which tells CoreStore that this store can initialize without any arguments (`init()`). This lets us provide just the type instead of an instance:
```swift
try CoreStore.addStorageAndWait(InMemoryStore)
try CoreStore.addStorageAndWait(InMemoryStore.self)
```
### Local Store
@@ -285,7 +285,7 @@ let migrationProgress = CoreStore.addStorage(
fileName: "MyStore.sqlite",
configuration: "Config2", // optional. Use entities from the "Config2" configuration in the .xcdatamodeld file
mappingModelBundles: [NSBundle.mainBundle()], // optional. The bundles that contain required .xcmappingmodel files, if any
localStorageOptions: .RecreateStoreOnModelMismatch // optional. Provides settings that tells the DataStack how to setup the persistent store
localStorageOptions: .recreateStoreOnModelMismatch // optional. Provides settings that tells the DataStack how to setup the persistent store
),
completion: { /* ... */ }
)
@@ -294,7 +294,7 @@ Refer to the *SQLiteStore.swift* source documentation for detailed explanations
CoreStore can decide the default values for these properties, so `SQLiteStore`s also implement the `DefaultInitializableStore` sugar protocol which lets us write:
```swift
try CoreStore.addStorageAndWait(SQLiteStore)
try CoreStore.addStorageAndWait(SQLiteStore.self)
```
or
```swift
@@ -324,7 +324,7 @@ guard let storage = ICloudStore(
ubiquitousContainerID: "iCloud.com.mycompany.myapp.containername", // optional. The container if your app has multiple ubiquity container identifiers in its entitlements
ubiquitousPeerToken: "9614d658014f4151a95d8048fb717cf0", // optional. A per-application salt to allow multiple apps on the same device to share a Core Data store integrated with iCloud
configuration: "Config1", // optional. Use entities from the "Config1" configuration in the .xcdatamodeld file
cloudStorageOptions: .RecreateLocalStoreOnModelMismatch // optional. Provides settings that tells the DataStack how to setup the persistent store
cloudStorageOptions: .recreateLocalStoreOnModelMismatch // optional. Provides settings that tells the DataStack how to setup the persistent store
) else {
// The iCloud container could not be located or if iCloud is not available on the device.
// Handle appropriately
@@ -1300,7 +1300,7 @@ With 2.0, all CoreStore types are still written in pure Swift, but they now have
<tr><th>Swift</th><th>Objective-C</th></tr>
<tr>
<td><pre lang=swift>
try CoreStore.addStorageAndWait(SQLiteStore)
try CoreStore.addStorageAndWait(SQLiteStore.self)
</pre></td>
<td><pre lang=objc>
NSError *error
@@ -26,198 +26,199 @@
import Foundation
import CoreData
#if os(iOS) || os(watchOS) || os(tvOS)
// MARK: - NSFetchedResultsController
public extension NSFetchedResultsController {
/**
Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter dataStack: the `DataStack` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes a `DataStack`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(dataStack: DataStack, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
return self.createFromContext(
dataStack.mainContext,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter dataStack: the `DataStack` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes a `DataStack`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(dataStack: DataStack, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return self.createFromContext(
dataStack.mainContext,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter dataStack: the `DataStack` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes a `DataStack`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(dataStack: DataStack, _ from: From<T>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
return self.createFromContext(
dataStack.mainContext,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: nil,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter dataStack: the `DataStack` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes a `DataStack`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(dataStack: DataStack, _ from: From<T>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return self.createFromContext(
dataStack.mainContext,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: nil,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter transaction: the `UnsafeDataTransaction` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(transaction: UnsafeDataTransaction, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
return self.createFromContext(
transaction.context,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter transaction: the `UnsafeDataTransaction` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(transaction: UnsafeDataTransaction, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return self.createFromContext(
transaction.context,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: sectionBy,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter transaction: the `UnsafeDataTransaction` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
*/
@nonobjc
public static func createFor<T: NSManagedObject>(transaction: UnsafeDataTransaction, _ from: From<T>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
return self.createFromContext(
transaction.context,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: nil,
fetchClauses: fetchClauses
)
}
/**
Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
- parameter transaction: the `UnsafeDataTransaction` to observe objects from
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
@nonobjc
public static func createFor<T: NSManagedObject>(transaction: UnsafeDataTransaction, _ from: From<T>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return self.createFromContext(
transaction.context,
fetchRequest: CoreStoreFetchRequest(),
from: from,
sectionBy: nil,
fetchClauses: fetchClauses
)
}
// MARK: Internal
@nonobjc
internal static func createFromContext<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) -> NSFetchedResultsController {
return CoreStoreFetchedResultsController(
context: context,
fetchRequest: fetchRequest,
from: from,
sectionBy: sectionBy,
applyFetchClauses: { fetchRequest in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
CoreStore.assert(
fetchRequest.sortDescriptors?.isEmpty == false,
"An \(cs_typeName(NSFetchedResultsController)) requires a sort information. Specify from a \(cs_typeName(OrderBy)) clause or any custom \(cs_typeName(FetchClause)) that provides a sort descriptor."
)
}
)
}
}
#endif
// TODO: Uncomment
//#if os(iOS) || os(watchOS) || os(tvOS)
//
//// MARK: - NSFetchedResultsController
//
//public extension NSFetchedResultsController {
//
// /**
// Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter dataStack: the `DataStack` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes a `DataStack`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ dataStack: DataStack, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) -> NSFetchedResultsController<NSFetchRequestResult> {
//
// return self.createFromContext(
// dataStack.mainContext,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: sectionBy,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter dataStack: the `DataStack` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes a `DataStack`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ dataStack: DataStack, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
//
// return self.createFromContext(
// dataStack.mainContext,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: sectionBy,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter dataStack: the `DataStack` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes a `DataStack`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ dataStack: DataStack, _ from: From<T>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
//
// return self.createFromContext(
// dataStack.mainContext,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: nil,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from a `DataStack`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter dataStack: the `DataStack` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes a `DataStack`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ dataStack: DataStack, _ from: From<T>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
//
// return self.createFromContext(
// dataStack.mainContext,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: nil,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter transaction: the `UnsafeDataTransaction` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ transaction: UnsafeDataTransaction, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
//
// return self.createFromContext(
// transaction.context,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: sectionBy,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter transaction: the `UnsafeDataTransaction` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ transaction: UnsafeDataTransaction, _ from: From<T>, _ sectionBy: SectionBy, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
//
// return self.createFromContext(
// transaction.context,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: sectionBy,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter transaction: the `UnsafeDataTransaction` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// - returns: an `NSFetchedResultsController` that observes an `UnsafeDataTransaction`
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ transaction: UnsafeDataTransaction, _ from: From<T>, _ fetchClauses: FetchClause...) -> NSFetchedResultsController {
//
// return self.createFromContext(
// transaction.context,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: nil,
// fetchClauses: fetchClauses
// )
// }
//
// /**
// Utility for creating an `NSFetchedResultsController` from an `UnsafeDataTransaction`. This is useful when an `NSFetchedResultsController` is preferred over the overhead of `ListMonitor`s abstraction.
//
// - parameter transaction: the `UnsafeDataTransaction` to observe objects from
// - parameter from: a `From` clause indicating the entity type
// - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
// */
// @nonobjc
// public static func createFor<T: NSManagedObject>(_ transaction: UnsafeDataTransaction, _ from: From<T>, _ fetchClauses: [FetchClause]) -> NSFetchedResultsController {
//
// return self.createFromContext(
// transaction.context,
// fetchRequest: CoreStoreFetchRequest(),
// from: from,
// sectionBy: nil,
// fetchClauses: fetchClauses
// )
// }
//
//
// // MARK: Internal
//
// @nonobjc
// internal static func createFromContext<T: NSManagedObject>(_ context: NSManagedObjectContext, fetchRequest: CoreStoreFetchRequest<T>, from: From<T>? = nil, sectionBy: SectionBy? = nil, fetchClauses: [FetchClause]) -> NSFetchedResultsController<NSFetchRequestResult> {
//
// let controller = CoreStoreFetchedResultsController(
// context: context,
// fetchRequest: fetchRequest,
// from: from,
// sectionBy: sectionBy,
// applyFetchClauses: { fetchRequest in
//
// fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
//
// CoreStore.assert(
// fetchRequest.sortDescriptors?.isEmpty == false,
// "An \(cs_typeName(NSFetchedResultsController<T>.self)) requires a sort information. Specify from a \(cs_typeName(OrderBy.self)) clause or any custom \(cs_typeName(FetchClause.self)) that provides a sort descriptor."
// )
// }
// )
// return controller.upcast()
// }
//}
//
//#endif
@@ -39,11 +39,11 @@ public extension NSManagedObject {
*/
@nonobjc
@warn_unused_result
public func accessValueForKVCKey(KVCKey: KeyPath) -> AnyObject? {
public func accessValueForKVCKey(_ KVCKey: KeyPath) -> AnyObject? {
self.willAccessValueForKey(KVCKey)
let primitiveValue: AnyObject? = self.primitiveValueForKey(KVCKey)
self.didAccessValueForKey(KVCKey)
self.willAccessValue(forKey: KVCKey)
let primitiveValue: AnyObject? = self.primitiveValue(forKey: KVCKey)
self.didAccessValue(forKey: KVCKey)
return primitiveValue
}
@@ -55,11 +55,11 @@ public extension NSManagedObject {
- parameter KVCKey: the KVC key
*/
@nonobjc
public func setValue(value: AnyObject?, forKVCKey KVCKey: KeyPath) {
public func setValue(_ value: AnyObject?, forKVCKey KVCKey: KeyPath) {
self.willChangeValueForKey(KVCKey)
self.willChangeValue(forKey: KVCKey)
self.setPrimitiveValue(value, forKey: KVCKey)
self.didChangeValueForKey(KVCKey)
self.didChangeValue(forKey: KVCKey)
}
/**
@@ -68,7 +68,7 @@ public extension NSManagedObject {
@nonobjc
public func refreshAsFault() {
self.managedObjectContext?.refreshObject(self, mergeChanges: false)
self.managedObjectContext?.refresh(self, mergeChanges: false)
}
/**
@@ -77,6 +77,6 @@ public extension NSManagedObject {
@nonobjc
public func refreshAndMerge() {
self.managedObjectContext?.refreshObject(self, mergeChanges: true)
self.managedObjectContext?.refresh(self, mergeChanges: true)
}
}
@@ -31,7 +31,7 @@ import Foundation
// MARK: - NSProgress
public extension NSProgress {
public extension Progress {
/**
Sets a closure that the `NSProgress` calls whenever its `fractionCompleted` changes. You can use this instead of setting up KVO.
@@ -39,7 +39,7 @@ public extension NSProgress {
- parameter closure: the closure to execute on progress change
*/
@nonobjc
public func setProgressHandler(closure: ((progress: NSProgress) -> Void)?) {
public func setProgressHandler(_ closure: ((progress: Progress) -> Void)?) {
self.progressObserver.progressHandler = closure
}
@@ -81,8 +81,8 @@ public extension NSProgress {
@objc
private final class ProgressObserver: NSObject {
private unowned let progress: NSProgress
private var progressHandler: ((progress: NSProgress) -> Void)? {
private unowned let progress: Progress
private var progressHandler: ((progress: Progress) -> Void)? {
didSet {
@@ -97,7 +97,7 @@ private final class ProgressObserver: NSObject {
self.progress.addObserver(
self,
forKeyPath: "fractionCompleted",
options: [.Initial, .New],
options: [.initial, .new],
context: nil
)
}
@@ -108,7 +108,7 @@ private final class ProgressObserver: NSObject {
}
}
private init(_ progress: NSProgress) {
private init(_ progress: Progress) {
self.progress = progress
super.init()
@@ -123,14 +123,14 @@ private final class ProgressObserver: NSObject {
}
}
override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
override func observeValue(forKeyPath keyPath: String?, of object: AnyObject?, change: [NSKeyValueChangeKey : AnyObject]?, context: UnsafeMutablePointer<Void>?) {
guard let progress = object as? NSProgress where progress == self.progress && keyPath == "fractionCompleted" else {
guard let progress = object as? Progress where progress == self.progress && keyPath == "fractionCompleted" else {
return
}
GCDQueue.Main.async { [weak self] () -> Void in
GCDQueue.main.async { [weak self] () -> Void in
self?.progressHandler?(progress: progress)
}
+33 -50
View File
@@ -32,32 +32,32 @@ import CoreData
/**
All errors thrown from CoreStore are expressed in `CoreStoreError` enum values.
*/
public enum CoreStoreError: ErrorType, Hashable {
public enum CoreStoreError: ErrorProtocol, Hashable {
/**
A failure occured because of an unknown error.
*/
case Unknown
case unknown
/**
The `NSPersistentStore` could not be initialized because another store existed at the specified `NSURL`.
*/
case DifferentStorageExistsAtURL(existingPersistentStoreURL: NSURL)
case differentStorageExistsAtURL(existingPersistentStoreURL: URL)
/**
An `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case MappingModelNotFound(localStoreURL: NSURL, targetModel: NSManagedObjectModel, targetModelVersion: String)
case mappingModelNotFound(localStoreURL: URL, targetModel: NSManagedObjectModel, targetModelVersion: String)
/**
Progressive migrations are disabled for a store, but an `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case ProgressiveMigrationRequired(localStoreURL: NSURL)
case progressiveMigrationRequired(localStoreURL: URL)
/**
An internal SDK call failed with the specified `NSError`.
*/
case InternalError(NSError: NSError)
case internalError(NSError: NSError)
// MARK: ErrorType
@@ -71,20 +71,20 @@ public enum CoreStoreError: ErrorType, Hashable {
switch self {
case .Unknown:
return CoreStoreErrorCode.UnknownError.rawValue
case .unknown:
return CoreStoreErrorCode.unknownError.rawValue
case .DifferentStorageExistsAtURL:
return CoreStoreErrorCode.DifferentPersistentStoreExistsAtURL.rawValue
case .differentStorageExistsAtURL:
return CoreStoreErrorCode.differentPersistentStoreExistsAtURL.rawValue
case .MappingModelNotFound:
return CoreStoreErrorCode.MappingModelNotFound.rawValue
case .mappingModelNotFound:
return CoreStoreErrorCode.mappingModelNotFound.rawValue
case .ProgressiveMigrationRequired:
return CoreStoreErrorCode.ProgressiveMigrationRequired.rawValue
case .progressiveMigrationRequired:
return CoreStoreErrorCode.progressiveMigrationRequired.rawValue
case .InternalError:
return CoreStoreErrorCode.InternalError.rawValue
case .internalError:
return CoreStoreErrorCode.internalError.rawValue
}
}
@@ -96,19 +96,19 @@ public enum CoreStoreError: ErrorType, Hashable {
let code = self._code
switch self {
case .Unknown:
case .unknown:
return code.hashValue
case .DifferentStorageExistsAtURL(let existingPersistentStoreURL):
case .differentStorageExistsAtURL(let existingPersistentStoreURL):
return code.hashValue ^ existingPersistentStoreURL.hashValue
case .MappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
case .mappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
return code.hashValue ^ localStoreURL.hashValue ^ targetModel.hashValue ^ targetModelVersion.hashValue
case .ProgressiveMigrationRequired(let localStoreURL):
case .progressiveMigrationRequired(let localStoreURL):
return code.hashValue ^ localStoreURL.hashValue
case .InternalError(let NSError):
case .internalError(let NSError):
return code.hashValue ^ NSError.hashValue
}
}
@@ -116,33 +116,32 @@ public enum CoreStoreError: ErrorType, Hashable {
// MARK: Internal
internal init(_ error: ErrorType?) {
internal init(_ error: ErrorProtocol?) {
self = error.flatMap { $0.bridgeToSwift } ?? .Unknown
self = error.flatMap { $0.bridgeToSwift } ?? .unknown
}
}
// MARK: - CoreStoreError: Equatable
@warn_unused_result
public func == (lhs: CoreStoreError, rhs: CoreStoreError) -> Bool {
switch (lhs, rhs) {
case (.Unknown, .Unknown):
case (.unknown, .unknown):
return true
case (.DifferentStorageExistsAtURL(let url1), .DifferentStorageExistsAtURL(let url2)):
case (.differentStorageExistsAtURL(let url1), .differentStorageExistsAtURL(let url2)):
return url1 == url2
case (.MappingModelNotFound(let url1, let model1, let version1), .MappingModelNotFound(let url2, let model2, let version2)):
case (.mappingModelNotFound(let url1, let model1, let version1), .mappingModelNotFound(let url2, let model2, let version2)):
return url1 == url2 && model1 == model2 && version1 == version2
case (.ProgressiveMigrationRequired(let url1), .ProgressiveMigrationRequired(let url2)):
case (.progressiveMigrationRequired(let url1), .progressiveMigrationRequired(let url2)):
return url1 == url2
case (.InternalError(let NSError1), .InternalError(let NSError2)):
case (.internalError(let NSError1), .internalError(let NSError2)):
return NSError1 == NSError2
default:
@@ -170,27 +169,27 @@ public enum CoreStoreErrorCode: Int {
/**
A failure occured because of an unknown error.
*/
case UnknownError
case unknownError
/**
The `NSPersistentStore` could note be initialized because another store existed at the specified `NSURL`.
*/
case DifferentPersistentStoreExistsAtURL
case differentPersistentStoreExistsAtURL
/**
An `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case MappingModelNotFound
case mappingModelNotFound
/**
Progressive migrations are disabled for a store, but an `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case ProgressiveMigrationRequired
case progressiveMigrationRequired
/**
An internal SDK call failed with the specified "NSError" userInfo key.
*/
case InternalError
case internalError
}
@@ -208,20 +207,4 @@ public extension NSError {
|| code == NSMigrationError)
&& self.domain == NSCocoaErrorDomain
}
// MARK: Deprecated
/**
Deprecated. Use `CoreStoreError` enum values instead.
If the error's domain is equal to `CoreStoreErrorDomain`, returns the associated `CoreStoreErrorCode`. For other domains, returns `nil`.
*/
@available(*, deprecated=2.0.0, message="Use CoreStoreError enum values instead.")
public var coreStoreErrorCode: CoreStoreErrorCode? {
return (self.domain == CoreStoreErrorDomain
? CoreStoreErrorCode(rawValue: self.code)
: nil)
}
}
@@ -38,11 +38,11 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject>(object: T) -> T? {
public func fetchExisting<T: NSManagedObject>(_ object: T) -> T? {
do {
return (try self.context.existingObjectWithID(object.objectID) as! T)
return (try self.context.existingObject(with: object.objectID) as! T)
}
catch _ {
@@ -57,11 +57,11 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject>(objectID: NSManagedObjectID) -> T? {
public func fetchExisting<T: NSManagedObject>(_ objectID: NSManagedObjectID) -> T? {
do {
return (try self.context.existingObjectWithID(objectID) as! T)
return (try self.context.existingObject(with: objectID) as! T)
}
catch _ {
@@ -76,9 +76,9 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == T>(objects: S) -> [T] {
public func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == T>(_ objects: S) -> [T] {
return objects.flatMap { (try? self.context.existingObjectWithID($0.objectID)) as? T }
return objects.flatMap { (try? self.context.existingObject(with: $0.objectID)) as? T }
}
/**
@@ -88,9 +88,9 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == NSManagedObjectID>(objectIDs: S) -> [T] {
public func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == NSManagedObjectID>(_ objectIDs: S) -> [T] {
return objectIDs.flatMap { (try? self.context.existingObjectWithID($0)) as? T }
return objectIDs.flatMap { (try? self.context.existingObject(with: $0)) as? T }
}
/**
@@ -101,7 +101,7 @@ public extension BaseDataTransaction {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
public func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> T? {
return self.fetchOne(from, fetchClauses)
}
@@ -114,7 +114,7 @@ public extension BaseDataTransaction {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
public func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -131,7 +131,7 @@ public extension BaseDataTransaction {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
public func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
return self.fetchAll(from, fetchClauses)
}
@@ -144,7 +144,7 @@ public extension BaseDataTransaction {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
public func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -161,7 +161,7 @@ public extension BaseDataTransaction {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
public func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
return self.fetchCount(from, fetchClauses)
}
@@ -174,7 +174,7 @@ public extension BaseDataTransaction {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
public func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -192,7 +192,7 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
public func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
return self.fetchObjectID(from, fetchClauses)
}
@@ -205,7 +205,7 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
public func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -222,7 +222,7 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
public func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
return self.fetchObjectIDs(from, fetchClauses)
}
@@ -235,7 +235,7 @@ public extension BaseDataTransaction {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
public func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -251,7 +251,7 @@ public extension BaseDataTransaction {
- parameter deleteClauses: a series of `DeleteClause` instances for the delete request. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: the number of `NSManagedObject`s deleted
*/
public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: DeleteClause...) -> Int? {
public func deleteAll<T: NSManagedObject>(_ from: From<T>, _ deleteClauses: DeleteClause...) -> Int? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -268,7 +268,7 @@ public extension BaseDataTransaction {
- parameter deleteClauses: a series of `DeleteClause` instances for the delete request. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: the number of `NSManagedObject`s deleted
*/
public func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? {
public func deleteAll<T: NSManagedObject>(_ from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -289,7 +289,7 @@ public extension BaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -310,7 +310,7 @@ public extension BaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -331,7 +331,7 @@ public extension BaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
public func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -352,7 +352,7 @@ public extension BaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
CoreStore.assert(
self.isRunningInAllowedQueue(),
@@ -58,7 +58,7 @@ public struct From<T: NSManagedObject> {
let people = transaction.fetchAll(From<MyPersonEntity>())
```
*/
public init(){
public init() {
self.init(entityClass: T.self, configurations: nil)
}
@@ -190,7 +190,7 @@ public struct From<T: NSManagedObject> {
// MARK: Internal
@warn_unused_result
internal func applyToFetchRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext, applyAffectedStores: Bool = true) -> Bool {
internal func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>, context: NSManagedObjectContext, applyAffectedStores: Bool = true) -> Bool {
fetchRequest.entity = context.entityDescriptionForEntityClass(self.entityClass)
guard applyAffectedStores else {
@@ -202,13 +202,13 @@ public struct From<T: NSManagedObject> {
return true
}
CoreStore.log(
.Warning,
.warning,
message: "Attempted to perform a fetch but could not find any persistent store for the entity \(cs_typeName(fetchRequest.entityName))"
)
return false
}
internal func applyAffectedStoresForFetchedRequest(fetchRequest: NSFetchRequest, context: NSManagedObjectContext) -> Bool {
internal func applyAffectedStoresForFetchedRequest<U: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<U>, context: NSManagedObjectContext) -> Bool {
let stores = self.findPersistentStores(context: context)
fetchRequest.affectedStores = stores
@@ -259,115 +259,4 @@ public struct From<T: NSManagedObject> {
self.configurations = configurations
self.findPersistentStores = findPersistentStores
}
// MARK: Obsolete
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ storeURLs: [NSURL]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entity: T.Type, _ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entity: T.Type, _ storeURLs: [NSURL]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entityClass: AnyClass, _ storeURL: NSURL, _ otherStoreURLs: NSURL...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entityClass: AnyClass, _ storeURLs: [NSURL]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ persistentStores: [NSPersistentStore]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entity: T.Type, _ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entity: T.Type, _ persistentStores: [NSPersistentStore]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entityClass: AnyClass, _ persistentStore: NSPersistentStore, _ otherPersistentStores: NSPersistentStore...) {
CoreStore.abort("Use initializers that accept configuration names.")
}
/**
Obsolete. Use initializers that accept configuration names.
*/
@available(*, obsoleted=2.0.0, message="Use initializers that accept configuration names.")
public init(_ entityClass: AnyClass, _ persistentStores: [NSPersistentStore]) {
CoreStore.abort("Use initializers that accept configuration names.")
}
}
@@ -71,13 +71,13 @@ public struct GroupBy: QueryClause, Hashable {
// MARK: QueryClause
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let keyPaths = fetchRequest.propertiesToGroupBy as? [String] where keyPaths != self.keyPaths {
CoreStore.log(
.Warning,
message: "An existing \"propertiesToGroupBy\" for the \(cs_typeName(NSFetchRequest)) was overwritten by \(cs_typeName(self)) query clause."
.warning,
message: "An existing \"propertiesToGroupBy\" for the \(cs_typeName(NSFetchRequest<ResultType>.self)) was overwritten by \(cs_typeName(self)) query clause."
)
}
@@ -32,7 +32,7 @@ public func +(left: OrderBy, right: OrderBy) -> OrderBy {
return OrderBy(left.sortDescriptors + right.sortDescriptors)
}
public func +=(inout left: OrderBy, right: OrderBy) {
public func +=(left: inout OrderBy, right: OrderBy) {
left = left + right
}
@@ -53,12 +53,12 @@ public enum SortKey {
/**
Indicates that the `KeyPath` should be sorted in ascending order
*/
case Ascending(KeyPath)
case ascending(KeyPath)
/**
Indicates that the `KeyPath` should be sorted in descending order
*/
case Descending(KeyPath)
case descending(KeyPath)
}
@@ -72,14 +72,14 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
/**
The list of sort descriptors
*/
public let sortDescriptors: [NSSortDescriptor]
public let sortDescriptors: [SortDescriptor]
/**
Initializes a `OrderBy` clause with an empty list of sort descriptors
*/
public init() {
self.init([NSSortDescriptor]())
self.init([SortDescriptor]())
}
/**
@@ -87,7 +87,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
- parameter sortDescriptor: a `NSSortDescriptor`
*/
public init(_ sortDescriptor: NSSortDescriptor) {
public init(_ sortDescriptor: SortDescriptor) {
self.init([sortDescriptor])
}
@@ -97,7 +97,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
- parameter sortDescriptors: a series of `NSSortDescriptor`s
*/
public init(_ sortDescriptors: [NSSortDescriptor]) {
public init(_ sortDescriptors: [SortDescriptor]) {
self.sortDescriptors = sortDescriptors
}
@@ -110,15 +110,15 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
public init(_ sortKey: [SortKey]) {
self.init(
sortKey.map { sortKey -> NSSortDescriptor in
sortKey.map { sortKey -> SortDescriptor in
switch sortKey {
case .Ascending(let keyPath):
return NSSortDescriptor(key: keyPath, ascending: true)
case .ascending(let keyPath):
return SortDescriptor(key: keyPath, ascending: true)
case .Descending(let keyPath):
return NSSortDescriptor(key: keyPath, ascending: false)
case .descending(let keyPath):
return SortDescriptor(key: keyPath, ascending: false)
}
}
)
@@ -138,13 +138,13 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
// MARK: FetchClause, QueryClause, DeleteClause
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let sortDescriptors = fetchRequest.sortDescriptors where sortDescriptors != self.sortDescriptors {
CoreStore.log(
.Warning,
message: "Existing sortDescriptors for the \(cs_typeName(NSFetchRequest)) was overwritten by \(cs_typeName(self)) query clause."
.warning,
message: "Existing sortDescriptors for the \(cs_typeName(fetchRequest)) was overwritten by \(cs_typeName(self)) query clause."
)
}
@@ -44,7 +44,7 @@ public protocol SelectValueResultType: SelectResultType {
static var attributeType: NSAttributeType { get }
static func fromResultObject(result: AnyObject) -> Self?
static func fromResultObject(_ result: AnyObject) -> Self?
}
@@ -55,7 +55,7 @@ public protocol SelectValueResultType: SelectResultType {
*/
public protocol SelectAttributesResultType: SelectResultType {
static func fromResultObjects(result: [AnyObject]) -> [[NSString: AnyObject]]
static func fromResultObjects(_ result: [AnyObject]) -> [[NSString: AnyObject]]
}
@@ -87,9 +87,9 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter keyPath: the attribute name
- returns: a `SelectTerm` to a `Select` clause for querying an entity attribute
*/
public static func Attribute(keyPath: KeyPath) -> SelectTerm {
public static func attribute(_ keyPath: KeyPath) -> SelectTerm {
return ._Attribute(keyPath)
return ._attribute(keyPath)
}
/**
@@ -105,13 +105,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "average(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the average value of an attribute
*/
public static func Average(keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
public static func average(_ keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
return ._Aggregate(
return ._aggregate(
function: "average:",
keyPath: keyPath,
alias: alias ?? "average(\(keyPath))",
nativeType: .DecimalAttributeType
nativeType: .decimalAttributeType
)
}
@@ -128,13 +128,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "count(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for a count query
*/
public static func Count(keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
public static func count(_ keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
return ._Aggregate(
return ._aggregate(
function: "count:",
keyPath: keyPath,
alias: alias ?? "count(\(keyPath))",
nativeType: .Integer64AttributeType
nativeType: .integer64AttributeType
)
}
@@ -151,13 +151,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "max(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute
*/
public static func Maximum(keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
public static func maximum(_ keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
return ._Aggregate(
return ._aggregate(
function: "max:",
keyPath: keyPath,
alias: alias ?? "max(\(keyPath))",
nativeType: .UndefinedAttributeType
nativeType: .undefinedAttributeType
)
}
@@ -174,13 +174,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "min(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute
*/
public static func Minimum(keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
public static func minimum(_ keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
return ._Aggregate(
return ._aggregate(
function: "min:",
keyPath: keyPath,
alias: alias ?? "min(\(keyPath))",
nativeType: .UndefinedAttributeType
nativeType: .undefinedAttributeType
)
}
@@ -197,13 +197,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "sum(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute
*/
public static func Sum(keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
public static func sum(_ keyPath: KeyPath, As alias: KeyPath? = nil) -> SelectTerm {
return ._Aggregate(
return ._aggregate(
function: "sum:",
keyPath: keyPath,
alias: alias ?? "sum(\(keyPath))",
nativeType: .DecimalAttributeType
nativeType: .decimalAttributeType
)
}
@@ -221,11 +221,11 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
- parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "objecID" is used
- returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute
*/
public static func ObjectID(As alias: KeyPath? = nil) -> SelectTerm {
public static func objectID(As alias: KeyPath? = nil) -> SelectTerm {
return ._Identity(
return ._identity(
alias: alias ?? "objectID",
nativeType: .ObjectIDAttributeType
nativeType: .objectIDAttributeType
)
}
@@ -234,17 +234,17 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
public init(stringLiteral value: KeyPath) {
self = ._Attribute(value)
self = ._attribute(value)
}
public init(unicodeScalarLiteral value: KeyPath) {
self = ._Attribute(value)
self = ._attribute(value)
}
public init(extendedGraphemeClusterLiteral value: KeyPath) {
self = ._Attribute(value)
self = ._attribute(value)
}
@@ -254,13 +254,13 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
switch self {
case ._Attribute(let keyPath):
case ._attribute(let keyPath):
return 0 ^ keyPath.hashValue
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
return 1 ^ function.hashValue ^ keyPath.hashValue ^ alias.hashValue ^ nativeType.hashValue
case ._Identity(let alias, let nativeType):
case ._identity(let alias, let nativeType):
return 3 ^ alias.hashValue ^ nativeType.hashValue
}
}
@@ -268,9 +268,9 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
// MARK: Internal
case _Attribute(KeyPath)
case _Aggregate(function: String, keyPath: KeyPath, alias: String, nativeType: NSAttributeType)
case _Identity(alias: String, nativeType: NSAttributeType)
case _attribute(KeyPath)
case _aggregate(function: String, keyPath: KeyPath, alias: String, nativeType: NSAttributeType)
case _identity(alias: String, nativeType: NSAttributeType)
}
@@ -281,17 +281,17 @@ public func == (lhs: SelectTerm, rhs: SelectTerm) -> Bool {
switch (lhs, rhs) {
case (._Attribute(let keyPath1), ._Attribute(let keyPath2)):
case (._attribute(let keyPath1), ._attribute(let keyPath2)):
return keyPath1 == keyPath2
case (._Aggregate(let function1, let keyPath1, let alias1, let nativeType1),
._Aggregate(let function2, let keyPath2, let alias2, let nativeType2)):
case (._aggregate(let function1, let keyPath1, let alias1, let nativeType1),
._aggregate(let function2, let keyPath2, let alias2, let nativeType2)):
return function1 == function2
&& keyPath1 == keyPath2
&& alias1 == alias2
&& nativeType1 == nativeType2
case (._Identity(let alias1, let nativeType1), ._Identity(let alias2, let nativeType2)):
case (._identity(let alias1, let nativeType1), ._identity(let alias2, let nativeType2)):
return alias1 == alias2 && nativeType1 == nativeType2
default:
@@ -388,7 +388,7 @@ public extension Select where T: NSManagedObjectID {
public init() {
self.init(.ObjectID())
self.init(.objectID())
}
}
@@ -408,16 +408,16 @@ extension Bool: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .BooleanAttributeType
return .booleanAttributeType
}
public static func fromResultObject(result: AnyObject) -> Bool? {
public static func fromResultObject(_ result: AnyObject) -> Bool? {
switch result {
case let decimal as NSDecimalNumber:
// iOS: NSDecimalNumber(string: "0.5").boolValue // true
// OSX: NSDecimalNumber(string: "0.5").boolValue // false
return NSNumber(double: decimal.doubleValue).boolValue
return NSNumber(value: decimal.doubleValue).boolValue
case let number as NSNumber:
return number.boolValue
@@ -435,12 +435,12 @@ extension Int8: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public static func fromResultObject(result: AnyObject) -> Int8? {
public static func fromResultObject(_ result: AnyObject) -> Int8? {
guard let value = (result as? NSNumber)?.longLongValue else {
guard let value = (result as? NSNumber)?.int64Value else {
return nil
}
@@ -455,12 +455,12 @@ extension Int16: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public static func fromResultObject(result: AnyObject) -> Int16? {
public static func fromResultObject(_ result: AnyObject) -> Int16? {
guard let value = (result as? NSNumber)?.longLongValue else {
guard let value = (result as? NSNumber)?.int64Value else {
return nil
}
@@ -475,12 +475,12 @@ extension Int32: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public static func fromResultObject(result: AnyObject) -> Int32? {
public static func fromResultObject(_ result: AnyObject) -> Int32? {
guard let value = (result as? NSNumber)?.longLongValue else {
guard let value = (result as? NSNumber)?.int64Value else {
return nil
}
@@ -495,12 +495,12 @@ extension Int64: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public static func fromResultObject(result: AnyObject) -> Int64? {
public static func fromResultObject(_ result: AnyObject) -> Int64? {
return (result as? NSNumber)?.longLongValue
return (result as? NSNumber)?.int64Value
}
}
@@ -511,12 +511,12 @@ extension Int: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public static func fromResultObject(result: AnyObject) -> Int? {
public static func fromResultObject(_ result: AnyObject) -> Int? {
guard let value = (result as? NSNumber)?.longLongValue else {
guard let value = (result as? NSNumber)?.int64Value else {
return nil
}
@@ -531,10 +531,10 @@ extension Double: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .DoubleAttributeType
return .doubleAttributeType
}
public static func fromResultObject(result: AnyObject) -> Double? {
public static func fromResultObject(_ result: AnyObject) -> Double? {
return (result as? NSNumber)?.doubleValue
}
@@ -547,10 +547,10 @@ extension Float: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .FloatAttributeType
return .floatAttributeType
}
public static func fromResultObject(result: AnyObject) -> Float? {
public static func fromResultObject(_ result: AnyObject) -> Float? {
return (result as? NSNumber)?.floatValue
}
@@ -563,12 +563,12 @@ extension String: SelectValueResultType {
public static var attributeType: NSAttributeType {
return .StringAttributeType
return .stringAttributeType
}
public static func fromResultObject(result: AnyObject) -> String? {
public static func fromResultObject(_ result: AnyObject) -> String? {
return result as? NSString as? String
return result as? String
}
}
@@ -579,12 +579,12 @@ extension NSNumber: SelectValueResultType {
public class var attributeType: NSAttributeType {
return .Integer64AttributeType
return .integer64AttributeType
}
public class func fromResultObject(result: AnyObject) -> Self? {
public class func fromResultObject(_ result: AnyObject) -> Self? {
func forceCast<T: NSNumber>(object: AnyObject) -> T? {
func forceCast<T: NSNumber>(_ object: AnyObject) -> T? {
return (object as? T)
}
@@ -599,12 +599,12 @@ extension NSString: SelectValueResultType {
public class var attributeType: NSAttributeType {
return .StringAttributeType
return .stringAttributeType
}
public class func fromResultObject(result: AnyObject) -> Self? {
public class func fromResultObject(_ result: AnyObject) -> Self? {
func forceCast<T: NSString>(object: AnyObject) -> T? {
func forceCast<T: NSString>(_ object: AnyObject) -> T? {
return (object as? T)
}
@@ -619,12 +619,12 @@ extension NSDecimalNumber {
public override class var attributeType: NSAttributeType {
return .DecimalAttributeType
return .decimalAttributeType
}
public override class func fromResultObject(result: AnyObject) -> Self? {
public override class func fromResultObject(_ result: AnyObject) -> Self? {
func forceCast<T: NSDecimalNumber>(object: AnyObject) -> T? {
func forceCast<T: NSDecimalNumber>(_ object: AnyObject) -> T? {
return (object as? T)
}
@@ -635,40 +635,32 @@ extension NSDecimalNumber {
// MARK: - NSDate: SelectValueResultType
extension NSDate: SelectValueResultType {
extension Date: SelectValueResultType {
public class var attributeType: NSAttributeType {
public static var attributeType: NSAttributeType {
return .DateAttributeType
return .dateAttributeType
}
public class func fromResultObject(result: AnyObject) -> Self? {
public static func fromResultObject(_ result: AnyObject) -> Date? {
func forceCast<T: NSDate>(object: AnyObject) -> T? {
return (object as? T)
}
return forceCast(result)
return result as? Date
}
}
// MARK: - NSData: SelectValueResultType
extension NSData: SelectValueResultType {
extension Data: SelectValueResultType {
public class var attributeType: NSAttributeType {
public static var attributeType: NSAttributeType {
return .BinaryDataAttributeType
return .binaryDataAttributeType
}
public class func fromResultObject(result: AnyObject) -> Self? {
public static func fromResultObject(_ result: AnyObject) -> Data? {
func forceCast<T: NSData>(object: AnyObject) -> T? {
return (object as? T)
}
return forceCast(result)
return result as? Data
}
}
@@ -679,12 +671,12 @@ extension NSManagedObjectID: SelectValueResultType {
public class var attributeType: NSAttributeType {
return .ObjectIDAttributeType
return .objectIDAttributeType
}
public class func fromResultObject(result: AnyObject) -> Self? {
public class func fromResultObject(_ result: AnyObject) -> Self? {
func forceCast<T: NSManagedObjectID>(object: AnyObject) -> T? {
func forceCast<T: NSManagedObjectID>(_ object: AnyObject) -> T? {
return (object as? T)
}
@@ -699,7 +691,7 @@ extension NSDictionary: SelectAttributesResultType {
// MARK: SelectAttributesResultType
public class func fromResultObjects(result: [AnyObject]) -> [[NSString: AnyObject]] {
public class func fromResultObjects(_ result: [AnyObject]) -> [[NSString: AnyObject]] {
return result as! [[NSString: AnyObject]]
}
@@ -708,12 +700,12 @@ extension NSDictionary: SelectAttributesResultType {
// MARK: - Internal
internal extension CollectionType where Generator.Element == SelectTerm {
internal extension Collection where Iterator.Element == SelectTerm {
internal func applyToFetchRequest<T>(fetchRequest: NSFetchRequest, owner: T) {
internal func applyToFetchRequest<T>(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>, owner: T) {
fetchRequest.includesPendingChanges = false
fetchRequest.resultType = .DictionaryResultType
fetchRequest.resultType = .dictionaryResultType
let entityDescription = fetchRequest.entity!
let propertiesByName = entityDescription.propertiesByName
@@ -724,7 +716,7 @@ internal extension CollectionType where Generator.Element == SelectTerm {
switch term {
case ._Attribute(let keyPath):
case ._attribute(let keyPath):
if let propertyDescription = propertiesByName[keyPath] {
propertiesToFetch.append(propertyDescription)
@@ -732,17 +724,17 @@ internal extension CollectionType where Generator.Element == SelectTerm {
else {
CoreStore.log(
.Warning,
.warning,
message: "The property \"\(keyPath)\" does not exist in entity \(cs_typeName(entityDescription.managedObjectClassName)) and will be ignored by \(cs_typeName(owner)) query clause."
)
}
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
if let attributeDescription = attributesByName[keyPath] {
let expressionDescription = NSExpressionDescription()
expressionDescription.name = alias
if nativeType == .UndefinedAttributeType {
if nativeType == .undefinedAttributeType {
expressionDescription.expressionResultType = attributeDescription.attributeType
}
@@ -760,17 +752,17 @@ internal extension CollectionType where Generator.Element == SelectTerm {
else {
CoreStore.log(
.Warning,
.warning,
message: "The attribute \"\(keyPath)\" does not exist in entity \(cs_typeName(entityDescription.managedObjectClassName)) and will be ignored by \(cs_typeName(owner)) query clause."
)
}
case ._Identity(let alias, let nativeType):
case ._identity(let alias, let nativeType):
let expressionDescription = NSExpressionDescription()
expressionDescription.name = alias
if nativeType == .UndefinedAttributeType {
if nativeType == .undefinedAttributeType {
expressionDescription.expressionResultType = .ObjectIDAttributeType
expressionDescription.expressionResultType = .objectIDAttributeType
}
else {
@@ -789,13 +781,13 @@ internal extension CollectionType where Generator.Element == SelectTerm {
switch self.first! {
case ._Attribute(let keyPath):
case ._attribute(let keyPath):
return keyPath
case ._Aggregate(_, _, let alias, _):
case ._aggregate(_, _, let alias, _):
return alias
case ._Identity(let alias, _):
case ._identity(let alias, _):
return alias
}
}
@@ -47,7 +47,7 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
/**
The block to customize the `NSFetchRequest`
*/
public let closure: (fetchRequest: NSFetchRequest) -> Void
public let closure: (fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void
/**
Initializes a `Tweak` clause with a closure where the `NSFetchRequest` may be configured.
@@ -55,7 +55,7 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
- Important: `Tweak`'s closure is executed only just before the fetch occurs, so make sure that any values captured by the closure is not prone to race conditions. Also, some utilities (such as `ListMonitor`s) may keep `FetchClause`s in memory and may thus introduce retain cycles if reference captures are not handled properly.
- parameter closure: the block to customize the `NSFetchRequest`
*/
public init(_ closure: (fetchRequest: NSFetchRequest) -> Void) {
public init(_ closure: (fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
self.closure = closure
}
@@ -63,8 +63,8 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
// MARK: FetchClause, QueryClause, DeleteClause
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
self.closure(fetchRequest: fetchRequest)
self.closure(fetchRequest: unsafeBitCast(fetchRequest, to: NSFetchRequest<NSFetchRequestResult>.self))
}
}
@@ -29,17 +29,17 @@ import CoreData
public func &&(left: Where, right: Where) -> Where {
return Where(NSCompoundPredicate(type: .AndPredicateType, subpredicates: [left.predicate, right.predicate]))
return Where(CompoundPredicate(type: .and, subpredicates: [left.predicate, right.predicate]))
}
public func ||(left: Where, right: Where) -> Where {
return Where(NSCompoundPredicate(type: .OrPredicateType, subpredicates: [left.predicate, right.predicate]))
return Where(CompoundPredicate(type: .or, subpredicates: [left.predicate, right.predicate]))
}
public prefix func !(clause: Where) -> Where {
return Where(NSCompoundPredicate(type: .NotPredicateType, subpredicates: [clause.predicate]))
return Where(CompoundPredicate(type: .not, subpredicates: [clause.predicate]))
}
@@ -53,7 +53,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
/**
The `NSPredicate` for the fetch or query
*/
public let predicate: NSPredicate
public let predicate: Predicate
/**
Initializes a `Where` clause with a predicate that always evaluates to `true`
@@ -70,7 +70,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
*/
public init(_ value: Bool) {
self.init(NSPredicate(value: value))
self.init(Predicate(value: value))
}
/**
@@ -81,7 +81,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
*/
public init(_ format: String, _ args: NSObject...) {
self.init(NSPredicate(format: format, argumentArray: args))
self.init(Predicate(format: format, argumentArray: args))
}
/**
@@ -92,7 +92,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
*/
public init(_ format: String, argumentArray: [NSObject]?) {
self.init(NSPredicate(format: format, argumentArray: argumentArray))
self.init(Predicate(format: format, argumentArray: argumentArray))
}
/**
@@ -104,8 +104,8 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
public init(_ keyPath: KeyPath, isEqualTo value: NSObject?) {
self.init(value == nil
? NSPredicate(format: "\(keyPath) == nil")
: NSPredicate(format: "\(keyPath) == %@", argumentArray: [value!]))
? Predicate(format: "\(keyPath) == nil")
: Predicate(format: "\(keyPath) == %@", argumentArray: [value!]))
}
/**
@@ -116,7 +116,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
*/
public init(_ keyPath: KeyPath, isMemberOf list: [NSObject]) {
self.init(NSPredicate(format: "\(keyPath) IN %@", list))
self.init(Predicate(format: "\(keyPath) IN %@", list))
}
/**
@@ -125,9 +125,9 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
- parameter keyPath: the keyPath to compare with
- parameter list: the sequence to check membership of
*/
public init<S: SequenceType where S.Generator.Element: NSObject>(_ keyPath: KeyPath, isMemberOf list: S) {
public init<S: Sequence where S.Iterator.Element: NSObject>(_ keyPath: KeyPath, isMemberOf list: S) {
self.init(NSPredicate(format: "\(keyPath) IN %@", Array(list) as NSArray))
self.init(Predicate(format: "\(keyPath) IN %@", Array(list) as NSArray))
}
/**
@@ -135,7 +135,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
- parameter predicate: the `NSPredicate` for the fetch or query
*/
public init(_ predicate: NSPredicate) {
public init(_ predicate: Predicate) {
self.predicate = predicate
}
@@ -143,13 +143,13 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
// MARK: FetchClause, QueryClause, DeleteClause
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let predicate = fetchRequest.predicate where predicate != self.predicate {
CoreStore.log(
.Warning,
message: "An existing predicate for the \(cs_typeName(NSFetchRequest)) was overwritten by \(cs_typeName(self)) query clause."
.warning,
message: "An existing predicate for the \(cs_typeName(fetchRequest)) was overwritten by \(cs_typeName(self)) query clause."
)
}
@@ -38,7 +38,7 @@ public extension CoreStore {
- returns: the `NSManagedObject` instance if the object exists in the `DataStack`, or `nil` if not found.
*/
@warn_unused_result
public static func fetchExisting<T: NSManagedObject>(object: T) -> T? {
public static func fetchExisting<T: NSManagedObject>(_ object: T) -> T? {
return self.defaultStack.fetchExisting(object)
}
@@ -50,7 +50,7 @@ public extension CoreStore {
- returns: the `NSManagedObject` instance if the object exists in the `DataStack`, or `nil` if not found.
*/
@warn_unused_result
public static func fetchExisting<T: NSManagedObject>(objectID: NSManagedObjectID) -> T? {
public static func fetchExisting<T: NSManagedObject>(_ objectID: NSManagedObjectID) -> T? {
return self.defaultStack.fetchExisting(objectID)
}
@@ -62,7 +62,7 @@ public extension CoreStore {
- returns: the `NSManagedObject` array for objects that exists in the `DataStack`
*/
@warn_unused_result
public static func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == T>(objects: S) -> [T] {
public static func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == T>(_ objects: S) -> [T] {
return self.defaultStack.fetchExisting(objects)
}
@@ -74,7 +74,7 @@ public extension CoreStore {
- returns: the `NSManagedObject` array for objects that exists in the `DataStack`
*/
@warn_unused_result
public static func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == NSManagedObjectID>(objectIDs: S) -> [T] {
public static func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == NSManagedObjectID>(_ objectIDs: S) -> [T] {
return self.defaultStack.fetchExisting(objectIDs)
}
@@ -87,7 +87,7 @@ public extension CoreStore {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
public static func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> T? {
return self.defaultStack.fetchOne(from, fetchClauses)
}
@@ -100,7 +100,7 @@ public extension CoreStore {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
public static func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
return self.defaultStack.fetchOne(from, fetchClauses)
}
@@ -113,7 +113,7 @@ public extension CoreStore {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
public static func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
return self.defaultStack.fetchAll(from, fetchClauses)
}
@@ -126,7 +126,7 @@ public extension CoreStore {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
public static func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
return self.defaultStack.fetchAll(from, fetchClauses)
}
@@ -139,7 +139,7 @@ public extension CoreStore {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
public static func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
return self.defaultStack.fetchCount(from, fetchClauses)
}
@@ -152,7 +152,7 @@ public extension CoreStore {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
public static func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
return self.defaultStack.fetchCount(from, fetchClauses)
}
@@ -165,7 +165,7 @@ public extension CoreStore {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
public static func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
return self.defaultStack.fetchObjectID(from, fetchClauses)
}
@@ -178,7 +178,7 @@ public extension CoreStore {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
public static func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
return self.defaultStack.fetchObjectID(from, fetchClauses)
}
@@ -191,7 +191,7 @@ public extension CoreStore {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
public static func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
return self.defaultStack.fetchObjectIDs(from, fetchClauses)
}
@@ -204,7 +204,7 @@ public extension CoreStore {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public static func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
public static func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
return self.defaultStack.fetchObjectIDs(from, fetchClauses)
}
@@ -220,7 +220,7 @@ public extension CoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public static func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
public static func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
return self.defaultStack.queryValue(from, selectClause, queryClauses)
}
@@ -236,7 +236,7 @@ public extension CoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public static func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
public static func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
return self.defaultStack.queryValue(from, selectClause, queryClauses)
}
@@ -252,7 +252,7 @@ public extension CoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public static func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
public static func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
return self.defaultStack.queryAttributes(from, selectClause, queryClauses)
}
@@ -268,7 +268,7 @@ public extension CoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public static func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
public static func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
return self.defaultStack.queryAttributes(from, selectClause, queryClauses)
}
@@ -41,11 +41,11 @@ public extension DataStack {
- returns: the `NSManagedObject` instance if the object exists in the `DataStack`, or `nil` if not found.
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject>(object: T) -> T? {
public func fetchExisting<T: NSManagedObject>(_ object: T) -> T? {
do {
return (try self.mainContext.existingObjectWithID(object.objectID) as! T)
return (try self.mainContext.existingObject(with: object.objectID) as! T)
}
catch _ {
@@ -60,11 +60,11 @@ public extension DataStack {
- returns: the `NSManagedObject` instance if the object exists in the `DataStack`, or `nil` if not found.
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject>(objectID: NSManagedObjectID) -> T? {
public func fetchExisting<T: NSManagedObject>(_ objectID: NSManagedObjectID) -> T? {
do {
return (try self.mainContext.existingObjectWithID(objectID) as! T)
return (try self.mainContext.existingObject(with: objectID) as! T)
}
catch _ {
@@ -79,9 +79,9 @@ public extension DataStack {
- returns: the `NSManagedObject` array for objects that exists in the `DataStack`
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == T>(objects: S) -> [T] {
public func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == T>(_ objects: S) -> [T] {
return objects.flatMap { (try? self.mainContext.existingObjectWithID($0.objectID)) as? T }
return objects.flatMap { (try? self.mainContext.existingObject(with: $0.objectID)) as? T }
}
/**
@@ -91,9 +91,9 @@ public extension DataStack {
- returns: the `NSManagedObject` array for objects that exists in the `DataStack`
*/
@warn_unused_result
public func fetchExisting<T: NSManagedObject, S: SequenceType where S.Generator.Element == NSManagedObjectID>(objectIDs: S) -> [T] {
public func fetchExisting<T: NSManagedObject, S: Sequence where S.Iterator.Element == NSManagedObjectID>(_ objectIDs: S) -> [T] {
return objectIDs.flatMap { (try? self.mainContext.existingObjectWithID($0)) as? T }
return objectIDs.flatMap { (try? self.mainContext.existingObject(with: $0)) as? T }
}
/**
@@ -104,10 +104,10 @@ public extension DataStack {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
public func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> T? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchOne(from, fetchClauses)
@@ -121,10 +121,10 @@ public extension DataStack {
- returns: the first `NSManagedObject` instance that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
public func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchOne(from, fetchClauses)
@@ -138,10 +138,10 @@ public extension DataStack {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
public func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchAll(from, fetchClauses)
@@ -155,10 +155,10 @@ public extension DataStack {
- returns: all `NSManagedObject` instances that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
public func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchAll(from, fetchClauses)
@@ -172,10 +172,10 @@ public extension DataStack {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
public func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchCount(from, fetchClauses)
@@ -189,10 +189,10 @@ public extension DataStack {
- returns: the number `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
public func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchCount(from, fetchClauses)
@@ -206,10 +206,10 @@ public extension DataStack {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
public func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchObjectID(from, fetchClauses)
@@ -223,10 +223,10 @@ public extension DataStack {
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
public func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchObjectID(from, fetchClauses)
@@ -240,10 +240,10 @@ public extension DataStack {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
public func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchObjectIDs(from, fetchClauses)
@@ -257,10 +257,10 @@ public extension DataStack {
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `FetchClause`s
*/
@warn_unused_result
public func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
public func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.fetchObjectIDs(from, fetchClauses)
@@ -277,10 +277,10 @@ public extension DataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.queryValue(from, selectClause, queryClauses)
@@ -297,10 +297,10 @@ public extension DataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
public func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.queryValue(from, selectClause, queryClauses)
@@ -317,10 +317,10 @@ public extension DataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
public func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.queryAttributes(from, selectClause, queryClauses)
@@ -337,10 +337,10 @@ public extension DataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `Select<U>` parameter.
*/
@warn_unused_result
public func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.mainContext.queryAttributes(from, selectClause, queryClauses)
@@ -34,7 +34,7 @@ import CoreData
*/
public protocol FetchClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest<T: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<T>)
}
@@ -45,7 +45,7 @@ public protocol FetchClause {
*/
public protocol QueryClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest<T: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<T>)
}
@@ -56,5 +56,5 @@ public protocol QueryClause {
*/
public protocol DeleteClause {
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest<T: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<T>)
}
@@ -40,7 +40,7 @@ public extension BaseDataTransaction {
- returns: the created `ImportableObject` instance, or `nil` if the import was ignored
*/
public func importObject<T where T: NSManagedObject, T: ImportableObject>(
into: Into<T>,
_ into: Into<T>,
source: T.ImportSource) throws -> T? {
CoreStore.assert(
@@ -69,7 +69,7 @@ public extension BaseDataTransaction {
- throws: an `ErrorType` thrown from any of the `ImportableObject` methods
*/
public func importObject<T where T: NSManagedObject, T: ImportableObject>(
object: T,
_ object: T,
source: T.ImportSource) throws {
CoreStore.assert(
@@ -96,8 +96,8 @@ public extension BaseDataTransaction {
- throws: an `ErrorType` thrown from any of the `ImportableObject` methods
- returns: the array of created `ImportableObject` instances
*/
public func importObjects<T, S: SequenceType where T: NSManagedObject, T: ImportableObject, S.Generator.Element == T.ImportSource>(
into: Into<T>,
public func importObjects<T, S: Sequence where T: NSManagedObject, T: ImportableObject, S.Iterator.Element == T.ImportSource>(
_ into: Into<T>,
sourceArray: S) throws -> [T] {
CoreStore.assert(
@@ -133,7 +133,7 @@ public extension BaseDataTransaction {
- returns: the created/updated `ImportableUniqueObject` instance, or `nil` if the import was ignored
*/
public func importUniqueObject<T where T: NSManagedObject, T: ImportableUniqueObject>(
into: Into<T>,
_ into: Into<T>,
source: T.ImportSource) throws -> T? {
CoreStore.assert(
@@ -184,8 +184,8 @@ public extension BaseDataTransaction {
- throws: an `ErrorType` thrown from any of the `ImportableUniqueObject` methods
- returns: the array of created/updated `ImportableUniqueObject` instances
*/
public func importUniqueObjects<T, S: SequenceType where T: NSManagedObject, T: ImportableUniqueObject, S.Generator.Element == T.ImportSource>(
into: Into<T>,
public func importUniqueObjects<T, S: Sequence where T: NSManagedObject, T: ImportableUniqueObject, S.Iterator.Element == T.ImportSource>(
_ into: Into<T>,
sourceArray: S,
@noescape preProcess: (mapping: [T.UniqueIDType: T.ImportSource]) throws -> [T.UniqueIDType: T.ImportSource] = { $0 }) throws -> [T] {
@@ -220,7 +220,7 @@ public extension BaseDataTransaction {
let uniqueIDValue = object.uniqueIDValue
guard let source = mapping.removeValueForKey(uniqueIDValue)
guard let source = mapping.removeValue(forKey: uniqueIDValue)
where T.shouldUpdateFromImportSource(source, inTransaction: self) else {
return
+3 -3
View File
@@ -62,7 +62,7 @@ public protocol ImportableObject: class {
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
- returns: `true` if an object should be created from `source`. Return `false` to ignore.
*/
static func shouldInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> 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.
@@ -70,7 +70,7 @@ public protocol ImportableObject: class {
- 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.
*/
func didInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
}
@@ -78,7 +78,7 @@ public protocol ImportableObject: class {
public extension ImportableObject {
static func shouldInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
return true
}
@@ -78,7 +78,7 @@ public protocol ImportableUniqueObject: ImportableObject {
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
- returns: `true` if an object should be created from `source`. Return `false` to ignore.
*/
static func shouldInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool
/**
Return `true` if an object should be updated from `source`. Return `false` to ignore and skip `source`. The default implementation returns `true`.
@@ -87,7 +87,7 @@ public protocol ImportableUniqueObject: ImportableObject {
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
- returns: `true` if an object should be updated from `source`. Return `false` to ignore.
*/
static func shouldUpdateFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool
static func shouldUpdateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool
/**
Return the unique ID as extracted from `source`. This method is called before `shouldInsertFromImportSource(...)` or `shouldUpdateFromImportSource(...)`. Return `nil` to skip importing from `source`. Note that throwing from this method will cause subsequent imports that are part of the same `importUniqueObjects(:sourceArray:)` call to be cancelled.
@@ -96,7 +96,7 @@ public protocol ImportableUniqueObject: ImportableObject {
- parameter transaction: the transaction that invoked the import. Use the transaction to fetch or create related objects if needed.
- returns: the unique ID as extracted from `source`, or `nil` to skip importing from `source`.
*/
static func uniqueIDFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) throws -> UniqueIDType?
static func uniqueIDFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws -> UniqueIDType?
/**
Implements the actual importing of data from `source`. This method is called just after the object is created and assigned its unique ID as returned from `uniqueIDFromImportSource(...)`. 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 `importUniqueObjects(:sourceArray:)` call to be cancelled. The default implementation simply calls `updateFromImportSource(...)`.
@@ -104,7 +104,7 @@ public protocol ImportableUniqueObject: ImportableObject {
- 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.
*/
func didInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
/**
Implements the actual importing of data from `source`. This method is called just after the existing object is fetched using its unique ID. 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 `importUniqueObjects(:sourceArray:)` call to be cancelled.
@@ -112,7 +112,7 @@ public protocol ImportableUniqueObject: ImportableObject {
- 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.
*/
func updateFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
func updateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws
}
@@ -120,17 +120,17 @@ public protocol ImportableUniqueObject: ImportableObject {
public extension ImportableUniqueObject {
static func shouldInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
return self.shouldUpdateFromImportSource(source, inTransaction: transaction)
}
static func shouldUpdateFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
static func shouldUpdateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
return true
}
func didInsertFromImportSource(source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
try self.updateFromImportSource(source, inTransaction: transaction)
}
+12 -1
View File
@@ -31,7 +31,18 @@ import CoreData
// Bugfix for NSFetchRequest messing up memory management for `affectedStores`
// http://stackoverflow.com/questions/14396375/nsfetchedresultscontroller-crashes-in-ios-6-if-affectedstores-is-specified
internal final class CoreStoreFetchRequest: NSFetchRequest {
internal final class CoreStoreFetchRequest<T: NSFetchRequestResult>: NSFetchRequest<NSFetchRequestResult> {
// MARK: Internal
@nonobjc
internal func dynamicCast<U: NSFetchRequestResult>() -> NSFetchRequest<U> {
return unsafeBitCast(self, to: NSFetchRequest<U>.self)
}
// MARK: NSFetchRequest
@objc
override var affectedStores: [NSPersistentStore]? {
@@ -31,12 +31,12 @@ import CoreData
// MARK: - CoreStoreFetchedResultsController
internal final class CoreStoreFetchedResultsController: NSFetchedResultsController {
internal final class CoreStoreFetchedResultsController: NSFetchedResultsController<NSManagedObject> {
// MARK: Internal
@nonobjc
internal convenience init<T: NSManagedObject>(dataStack: DataStack, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest) -> Void) {
internal convenience init<T: NSManagedObject>(dataStack: DataStack, fetchRequest: NSFetchRequest<NSManagedObject>, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest<NSManagedObject>) -> Void) {
self.init(
context: dataStack.mainContext,
@@ -48,14 +48,14 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
}
@nonobjc
internal init<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest) -> Void) {
internal init<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest<NSManagedObject>, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest<NSManagedObject>) -> Void) {
_ = from?.applyToFetchRequest(
fetchRequest,
context: context,
applyAffectedStores: false
)
applyFetchClauses(fetchRequest: fetchRequest)
applyFetchClauses(fetchRequest: fetchRequest.cs_dynamicCast())
if let from = from {
@@ -68,7 +68,7 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
guard let from = (fetchRequest.entity.flatMap { $0.managedObjectClassName }).flatMap(NSClassFromString).flatMap(From.init) else {
CoreStore.abort("Attempted to create an \(cs_typeName(NSFetchedResultsController)) without a \(cs_typeName(From)) clause or an \(cs_typeName(NSEntityDescription)).")
CoreStore.abort("Attempted to create a \(CoreStoreFetchedResultsController.self) without a \(cs_typeName(From<T>.self)) clause or an \(cs_typeName(NSEntityDescription.self)).")
}
self.reapplyAffectedStores = { fetchRequest, context in
@@ -91,13 +91,19 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
if !self.reapplyAffectedStores(fetchRequest: self.fetchRequest, context: self.managedObjectContext) {
CoreStore.log(
.Warning,
message: "Attempted to perform a fetch on an \(cs_typeName(NSFetchedResultsController)) but could not find any persistent store for the entity \(cs_typeName(self.fetchRequest.entityName))"
.warning,
message: "Attempted to perform a fetch on an \(cs_typeName(self)) but could not find any persistent store for the entity \(cs_typeName(self.fetchRequest.entityName))"
)
}
try self.performFetch()
}
@nonobjc
internal func dynamicCast<U: NSFetchRequestResult>() -> NSFetchedResultsController<U> {
return unsafeBitCast(self, to: NSFetchedResultsController<U>.self)
}
deinit {
self.delegate = nil
@@ -107,7 +113,7 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
// MARK: Private
@nonobjc
private let reapplyAffectedStores: (fetchRequest: NSFetchRequest, context: NSManagedObjectContext) -> Bool
private let reapplyAffectedStores: (fetchRequest: NSFetchRequest<NSManagedObject>, context: NSManagedObjectContext) -> Bool
}
#endif
@@ -33,21 +33,21 @@ import CoreData
internal protocol FetchedResultsControllerHandler: class {
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?)
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChangeObject anObject: AnyObject, atIndexPath indexPath: IndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath?)
func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType)
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType)
func controllerWillChangeContent(controller: NSFetchedResultsController)
func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>)
func controllerDidChangeContent(controller: NSFetchedResultsController)
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>)
func controller(controller: NSFetchedResultsController, sectionIndexTitleForSectionName sectionName: String?) -> String?
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, sectionIndexTitleForSectionName sectionName: String?) -> String?
}
// MARK: - FetchedResultsControllerDelegate
internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResultsControllerDelegate {
internal final class FetchedResultsControllerDelegate<EntityType: NSManagedObject>: NSObject, NSFetchedResultsControllerDelegate {
// MARK: Internal
@@ -58,7 +58,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
internal weak var handler: FetchedResultsControllerHandler?
@nonobjc
internal weak var fetchedResultsController: NSFetchedResultsController? {
internal weak var fetchedResultsController: CoreStoreFetchedResultsController? {
didSet {
@@ -76,7 +76,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
// MARK: NSFetchedResultsControllerDelegate
@objc
dynamic func controllerWillChangeContent(controller: NSFetchedResultsController) {
dynamic func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
guard self.enabled else {
@@ -90,7 +90,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
}
@objc
dynamic func controllerDidChangeContent(controller: NSFetchedResultsController) {
dynamic func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
guard self.enabled else {
@@ -101,7 +101,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
}
@objc
dynamic func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
dynamic func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: AnyObject, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
guard self.enabled else {
@@ -123,8 +123,8 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
switch actualType {
case .Update:
guard let section = indexPath?.indexAtPosition(0) else {
case .update:
guard let section = indexPath?[0] else {
return
}
@@ -134,7 +134,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
return
}
case .Move:
case .move:
guard let indexPath = indexPath, let newIndexPath = newIndexPath else {
return
@@ -143,25 +143,25 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
break
}
if self.insertedSections.contains(indexPath.indexAtPosition(0)) {
if self.insertedSections.contains(indexPath[0]) {
// Observers that handle the .Move change are advised to delete then reinsert the object instead of just moving. This is especially true when indexPath and newIndexPath are equal. For example, calling tableView.moveRowAtIndexPath(_:toIndexPath) when both indexPaths are the same will crash the tableView.
self.handler?.controller(
controller,
didChangeObject: anObject,
atIndexPath: indexPath,
forChangeType: .Move,
forChangeType: .move,
newIndexPath: newIndexPath
)
return
}
if self.deletedSections.contains(indexPath.indexAtPosition(0)) {
if self.deletedSections.contains(indexPath[0]) {
self.handler?.controller(
controller,
didChangeObject: anObject,
atIndexPath: nil,
forChangeType: .Insert,
forChangeType: .insert,
newIndexPath: indexPath
)
return
@@ -170,7 +170,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
controller,
didChangeObject: anObject,
atIndexPath: indexPath,
forChangeType: .Update,
forChangeType: .update,
newIndexPath: nil
)
return
@@ -189,7 +189,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
}
@objc
dynamic func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) {
dynamic func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange sectionInfo: NSFetchedResultsSectionInfo, atSectionIndex sectionIndex: Int, for type: NSFetchedResultsChangeType) {
guard self.enabled else {
@@ -198,8 +198,8 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
switch type {
case .Delete: self.deletedSections.insert(sectionIndex)
case .Insert: self.insertedSections.insert(sectionIndex)
case .delete: self.deletedSections.insert(sectionIndex)
case .insert: self.insertedSections.insert(sectionIndex)
default: break
}
@@ -212,7 +212,7 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult
}
@objc
dynamic func controller(controller: NSFetchedResultsController, sectionIndexTitleForSectionName sectionName: String) -> String? {
dynamic func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, sectionIndexTitleForSectionName sectionName: String) -> String? {
return self.handler?.controller(
controller,
+14 -14
View File
@@ -28,12 +28,12 @@ import Foundation
// MARK: - Custom AutoreleasePool
internal func cs_autoreleasepool(@noescape closure: () -> Void) {
internal func cs_autoreleasepool(@noescape _ closure: () -> Void) {
autoreleasepool(closure)
}
internal func cs_autoreleasepool<T>(@noescape closure: () -> T) -> T {
internal func cs_autoreleasepool<T>(@noescape _ closure: () -> T) -> T {
var closureValue: T!
autoreleasepool {
@@ -44,10 +44,10 @@ internal func cs_autoreleasepool<T>(@noescape closure: () -> T) -> T {
return closureValue
}
internal func cs_autoreleasepool<T>(@noescape closure: () throws -> T) throws -> T {
internal func cs_autoreleasepool<T>(@noescape _ closure: () throws -> T) throws -> T {
var closureValue: T!
var closureError: ErrorType?
var closureError: ErrorProtocol?
autoreleasepool {
do {
@@ -67,9 +67,9 @@ internal func cs_autoreleasepool<T>(@noescape closure: () throws -> T) throws ->
return closureValue
}
internal func cs_autoreleasepool(@noescape closure: () throws -> Void) throws {
internal func cs_autoreleasepool(@noescape _ closure: () throws -> Void) throws {
var closureError: ErrorType?
var closureError: ErrorProtocol?
autoreleasepool {
do {
@@ -88,7 +88,7 @@ internal func cs_autoreleasepool(@noescape closure: () throws -> Void) throws {
}
}
internal func cs_getAssociatedObjectForKey<T: AnyObject>(key: UnsafePointer<Void>, inObject object: AnyObject) -> T? {
internal func cs_getAssociatedObjectForKey<T: AnyObject>(_ key: UnsafePointer<Void>, inObject object: AnyObject) -> T? {
switch objc_getAssociatedObject(object, key) {
@@ -103,17 +103,17 @@ internal func cs_getAssociatedObjectForKey<T: AnyObject>(key: UnsafePointer<Void
}
}
internal func cs_setAssociatedRetainedObject<T: AnyObject>(associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
internal func cs_setAssociatedRetainedObject<T: AnyObject>(_ associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
objc_setAssociatedObject(object, key, associatedObject, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
internal func cs_setAssociatedCopiedObject<T: AnyObject>(associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
internal func cs_setAssociatedCopiedObject<T: AnyObject>(_ associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
objc_setAssociatedObject(object, key, associatedObject, .OBJC_ASSOCIATION_COPY_NONATOMIC)
}
internal func cs_setAssociatedWeakObject<T: AnyObject>(associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
internal func cs_setAssociatedWeakObject<T: AnyObject>(_ associatedObject: T?, forKey key: UnsafePointer<Void>, inObject object: AnyObject) {
if let associatedObject = associatedObject {
@@ -128,22 +128,22 @@ internal func cs_setAssociatedWeakObject<T: AnyObject>(associatedObject: T?, for
// MARK: Printing Utilities
internal func cs_typeName<T>(value: T) -> String {
internal func cs_typeName<T>(_ value: T) -> String {
return "'\(String(reflecting: value.dynamicType))'"
}
internal func cs_typeName<T>(value: T.Type) -> String {
internal func cs_typeName<T>(_ value: T.Type) -> String {
return "'\(value)'"
}
internal func cs_typeName(value: AnyClass) -> String {
internal func cs_typeName(_ value: AnyClass) -> String {
return "'\(value)'"
}
internal func cs_typeName(name: String?) -> String {
internal func cs_typeName(_ name: String?) -> String {
return "<\(name ?? "unknown")>"
}
+5 -5
View File
@@ -29,13 +29,13 @@ import CoreData
// MARK: - MigrationManager
internal final class MigrationManager: NSMigrationManager, NSProgressReporting {
internal final class MigrationManager: NSMigrationManager, ProgressReporting {
// MARK: NSObject
override func didChangeValueForKey(key: String) {
override func didChangeValue(forKey key: String) {
super.didChangeValueForKey(key)
super.didChangeValue(forKey: key)
guard key == "migrationProgress" else {
@@ -48,7 +48,7 @@ internal final class MigrationManager: NSMigrationManager, NSProgressReporting {
// MARK: NSMigrationManager
init(sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, progress: NSProgress) {
init(sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, progress: Progress) {
self.progress = progress
@@ -58,5 +58,5 @@ internal final class MigrationManager: NSMigrationManager, NSProgressReporting {
// MARK: NSProgressReporting
let progress: NSProgress
let progress: Progress
}
@@ -0,0 +1,20 @@
//
// NSFetchRequest+CoreStore.swift
// CoreStore
//
// Created by John Rommel Estropia on 2016/07/20.
// Copyright © 2016 John Rommel Estropia. All rights reserved.
//
import CoreData
internal extension NSFetchRequest {
// MARK: Internal
@nonobjc
internal func cs_dynamicCast<U: NSFetchRequestResult>() -> NSFetchRequest<U> {
return unsafeBitCast(self, to: NSFetchRequest<U>.self)
}
}
@@ -50,7 +50,7 @@ internal extension NSManagedObjectContext {
set {
cs_setAssociatedCopiedObject(
NSNumber(bool: newValue),
NSNumber(value: newValue),
forKey: &PropertyKeys.shouldCascadeSavesToParent,
inObject: self
)
@@ -58,26 +58,26 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func entityDescriptionForEntityType(entity: NSManagedObject.Type) -> NSEntityDescription? {
internal func entityDescriptionForEntityType(_ entity: NSManagedObject.Type) -> NSEntityDescription? {
return self.entityDescriptionForEntityClass(entity)
}
@nonobjc
internal func entityDescriptionForEntityClass(entity: AnyClass) -> NSEntityDescription? {
internal func entityDescriptionForEntityClass(_ entity: AnyClass) -> NSEntityDescription? {
guard let entityName = self.parentStack?.entityNameForEntityClass(entity) else {
return nil
}
return NSEntityDescription.entityForName(
entityName,
inManagedObjectContext: self
return NSEntityDescription.entity(
forEntityName: entityName,
in: self
)
}
@nonobjc
internal func setupForCoreStoreWithContextName(contextName: String) {
internal func setupForCoreStoreWithContextName(_ contextName: String) {
#if USE_FRAMEWORKS
@@ -91,7 +91,7 @@ internal extension NSManagedObjectContext {
#endif
self.observerForWillSaveNotification = NotificationObserver(
notificationName: NSManagedObjectContextWillSaveNotification,
notificationName: NSNotification.Name.NSManagedObjectContextWillSave.rawValue,
object: self,
closure: { (note) -> Void in
@@ -105,7 +105,7 @@ internal extension NSManagedObjectContext {
do {
try context.obtainPermanentIDsForObjects(Array(insertedObjects))
try context.obtainPermanentIDs(for: Array(insertedObjects))
}
catch {
@@ -34,15 +34,15 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Fetch Existing
@nonobjc
internal func fetchExisting<T: NSManagedObject>(object: T) -> T? {
internal func fetchExisting<T: NSManagedObject>(_ object: T) -> T? {
if object.objectID.temporaryID {
if object.objectID.isTemporaryID {
do {
try withExtendedLifetime(self) { (context: NSManagedObjectContext) -> Void in
try context.obtainPermanentIDsForObjects([object])
try context.obtainPermanentIDs(for: [object])
}
}
catch {
@@ -54,10 +54,9 @@ internal extension NSManagedObjectContext {
return nil
}
}
do {
let existingObject = try self.existingObjectWithID(object.objectID)
let existingObject = try self.existingObject(with: object.objectID)
return (existingObject as! T)
}
catch {
@@ -74,38 +73,38 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Fetch One
@nonobjc
internal func fetchOne<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> T? {
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? {
internal func fetchOne<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> T? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<T>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 1
fetchRequest.resultType = .ManagedObjectResultType
fetchRequest.resultType = .managedObjectResultType
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
guard storeFound else {
return nil
}
return self.fetchOne(fetchRequest)
return self.fetchOne(fetchRequest.dynamicCast())
}
@nonobjc
internal func fetchOne<T: NSManagedObject>(fetchRequest: NSFetchRequest) -> T? {
internal func fetchOne<T: NSManagedObject>(_ fetchRequest: NSFetchRequest<T>) -> T? {
var fetchResults: [T]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest) as? [T]
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -120,7 +119,6 @@ internal extension NSManagedObjectContext {
)
return nil
}
return fetchResults?.first
}
@@ -128,38 +126,38 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Fetch All
@nonobjc
internal func fetchAll<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [T]? {
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]? {
internal func fetchAll<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [T]? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<T>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 0
fetchRequest.resultType = .ManagedObjectResultType
fetchRequest.resultType = .managedObjectResultType
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
guard storeFound else {
return nil
}
return self.fetchAll(fetchRequest)
return self.fetchAll(fetchRequest.dynamicCast())
}
@nonobjc
internal func fetchAll<T: NSManagedObject>(fetchRequest: NSFetchRequest) -> [T]? {
internal func fetchAll<T: NSManagedObject>(_ fetchRequest: NSFetchRequest<T>) -> [T]? {
var fetchResults: [T]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest) as? [T]
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -174,7 +172,6 @@ internal extension NSManagedObjectContext {
)
return nil
}
return fetchResults
}
@@ -182,15 +179,15 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Count
@nonobjc
internal func fetchCount<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> Int? {
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? {
internal func fetchCount<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> Int? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<T>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
@@ -198,27 +195,33 @@ internal extension NSManagedObjectContext {
return nil
}
return self.fetchCount(fetchRequest)
return self.fetchCount(fetchRequest.dynamicCast())
}
@nonobjc
internal func fetchCount(fetchRequest: NSFetchRequest) -> Int? {
internal func fetchCount<T: NSManagedObject>(_ fetchRequest: NSFetchRequest<T>) -> Int? {
var count = 0
var error: NSError?
self.performBlockAndWait {
var countError: ErrorProtocol?
self.performAndWait {
count = self.countForFetchRequest(fetchRequest, error: &error)
do {
count = try self.count(for: fetchRequest)
}
catch {
countError = error
}
}
if count == NSNotFound {
CoreStore.log(
CoreStoreError(error),
"Failed executing fetch request."
CoreStoreError(countError),
"Failed executing count request."
)
return nil
}
return count
}
@@ -226,38 +229,38 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Object ID
@nonobjc
internal func fetchObjectID<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> NSManagedObjectID? {
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? {
internal func fetchObjectID<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> NSManagedObjectID? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<NSManagedObjectID>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 1
fetchRequest.resultType = .ManagedObjectIDResultType
fetchRequest.resultType = .managedObjectIDResultType
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
guard storeFound else {
return nil
}
return self.fetchObjectID(fetchRequest)
return self.fetchObjectID(fetchRequest.dynamicCast())
}
@nonobjc
internal func fetchObjectID(fetchRequest: NSFetchRequest) -> NSManagedObjectID? {
internal func fetchObjectID(_ fetchRequest: NSFetchRequest<NSManagedObjectID>) -> NSManagedObjectID? {
var fetchResults: [NSManagedObjectID]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest) as? [NSManagedObjectID]
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -272,7 +275,6 @@ internal extension NSManagedObjectContext {
)
return nil
}
return fetchResults?.first
}
@@ -280,38 +282,38 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Object IDs
@nonobjc
internal func fetchObjectIDs<T: NSManagedObject>(from: From<T>, _ fetchClauses: FetchClause...) -> [NSManagedObjectID]? {
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]? {
internal func fetchObjectIDs<T: NSManagedObject>(_ from: From<T>, _ fetchClauses: [FetchClause]) -> [NSManagedObjectID]? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<NSManagedObjectID>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 0
fetchRequest.resultType = .ManagedObjectIDResultType
fetchRequest.resultType = .managedObjectIDResultType
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
guard storeFound else {
return nil
}
return self.fetchObjectIDs(fetchRequest)
return self.fetchObjectIDs(fetchRequest.dynamicCast())
}
@nonobjc
internal func fetchObjectIDs(fetchRequest: NSFetchRequest) -> [NSManagedObjectID]? {
internal func fetchObjectIDs(_ fetchRequest: NSFetchRequest<NSManagedObjectID>) -> [NSManagedObjectID]? {
var fetchResults: [NSManagedObjectID]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest) as? [NSManagedObjectID]
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -326,7 +328,6 @@ internal extension NSManagedObjectContext {
)
return nil
}
return fetchResults
}
@@ -334,19 +335,19 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Delete All
@nonobjc
internal func deleteAll<T: NSManagedObject>(from: From<T>, _ deleteClauses: DeleteClause...) -> Int? {
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? {
internal func deleteAll<T: NSManagedObject>(_ from: From<T>, _ deleteClauses: [DeleteClause]) -> Int? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<T>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 0
fetchRequest.resultType = .ManagedObjectResultType
fetchRequest.resultType = .managedObjectResultType
fetchRequest.returnsObjectsAsFaults = true
fetchRequest.includesPropertyValues = false
deleteClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
@@ -355,24 +356,24 @@ internal extension NSManagedObjectContext {
return nil
}
return self.deleteAll(fetchRequest)
return self.deleteAll(fetchRequest.dynamicCast())
}
@nonobjc
internal func deleteAll(fetchRequest: NSFetchRequest) -> Int? {
internal func deleteAll<T: NSManagedObject>(_ fetchRequest: NSFetchRequest<T>) -> Int? {
var numberOfDeletedObjects: Int?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
cs_autoreleasepool {
do {
let fetchResults = try self.executeFetchRequest(fetchRequest) as? [NSManagedObject] ?? []
let fetchResults = try self.fetch(fetchRequest)
for object in fetchResults {
self.deleteObject(object)
self.delete(object)
}
numberOfDeletedObjects = fetchResults.count
}
@@ -390,7 +391,6 @@ internal extension NSManagedObjectContext {
)
return nil
}
return numberOfDeletedObjects
}
@@ -398,15 +398,15 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Value
@nonobjc
internal func queryValue<T: NSManagedObject, U: SelectValueResultType>(from: From<T>, _ selectClause: Select<U>, _ queryClauses: QueryClause...) -> U? {
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? {
internal func queryValue<T: NSManagedObject, U: SelectValueResultType>(_ from: From<T>, _ selectClause: Select<U>, _ queryClauses: [QueryClause]) -> U? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<NSFetchRequestResult>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 0
@@ -423,15 +423,15 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func queryValue<U: SelectValueResultType>(selectTerms: [SelectTerm], fetchRequest: NSFetchRequest) -> U? {
internal func queryValue<U: SelectValueResultType>(_ selectTerms: [SelectTerm], fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> U? {
var fetchResults: [AnyObject]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest)
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -456,15 +456,15 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func queryValue(selectTerms: [SelectTerm], fetchRequest: NSFetchRequest) -> AnyObject? {
internal func queryValue(_ selectTerms: [SelectTerm], fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> AnyObject? {
var fetchResults: [AnyObject]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest)
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -492,15 +492,15 @@ internal extension NSManagedObjectContext {
// MARK: Internal: Attributes
@nonobjc
internal func queryAttributes<T: NSManagedObject>(from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: QueryClause...) -> [[NSString: AnyObject]]? {
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]]? {
internal func queryAttributes<T: NSManagedObject>(_ from: From<T>, _ selectClause: Select<NSDictionary>, _ queryClauses: [QueryClause]) -> [[NSString: AnyObject]]? {
let fetchRequest = CoreStoreFetchRequest()
let fetchRequest = CoreStoreFetchRequest<NSFetchRequestResult>()
let storeFound = from.applyToFetchRequest(fetchRequest, context: self)
fetchRequest.fetchLimit = 0
@@ -516,15 +516,15 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func queryAttributes(fetchRequest: NSFetchRequest) -> [[NSString: AnyObject]]? {
internal func queryAttributes(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> [[NSString: AnyObject]]? {
var fetchResults: [AnyObject]?
var fetchError: ErrorType?
self.performBlockAndWait {
var fetchError: ErrorProtocol?
self.performAndWait {
do {
fetchResults = try self.executeFetchRequest(fetchRequest)
fetchResults = try self.fetch(fetchRequest)
}
catch {
@@ -38,7 +38,7 @@ internal extension NSManagedObjectContext {
get {
if let parentContext = self.parentContext {
if let parentContext = self.parent {
return parentContext.parentStack
}
@@ -47,7 +47,7 @@ internal extension NSManagedObjectContext {
}
set {
guard self.parentContext == nil else {
guard self.parent == nil else {
return
}
@@ -61,9 +61,9 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal static func rootSavingContextForCoordinator(coordinator: NSPersistentStoreCoordinator) -> NSManagedObjectContext {
internal static func rootSavingContextForCoordinator(_ coordinator: NSPersistentStoreCoordinator) -> NSManagedObjectContext {
let context = NSManagedObjectContext(concurrencyType: .PrivateQueueConcurrencyType)
let context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
context.persistentStoreCoordinator = coordinator
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
context.undoManager = nil
@@ -72,18 +72,18 @@ internal extension NSManagedObjectContext {
#if os(iOS) || os(OSX)
context.observerForDidImportUbiquitousContentChangesNotification = NotificationObserver(
notificationName: NSPersistentStoreDidImportUbiquitousContentChangesNotification,
notificationName: NSNotification.Name.NSPersistentStoreDidImportUbiquitousContentChanges.rawValue,
object: coordinator,
closure: { [weak context] (note) -> Void in
context?.performBlock { () -> Void in
context?.perform { () -> Void in
let updatedObjectIDs = (note.userInfo?[NSUpdatedObjectsKey] as? Set<NSManagedObjectID>) ?? []
let updatedObjectIDs = ((note as NSNotification).userInfo?[NSUpdatedObjectsKey] as? Set<NSManagedObjectID>) ?? []
for objectID in updatedObjectIDs {
context?.objectWithID(objectID).willAccessValueForKey(nil)
context?.object(with: objectID).willAccessValue(forKey: nil)
}
context?.mergeChangesFromContextDidSaveNotification(note)
context?.mergeChanges(fromContextDidSave: note)
}
}
)
@@ -94,15 +94,15 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal static func mainContextForRootContext(rootContext: NSManagedObjectContext) -> NSManagedObjectContext {
internal static func mainContextForRootContext(_ rootContext: NSManagedObjectContext) -> NSManagedObjectContext {
let context = NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType)
context.parentContext = rootContext
let context = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
context.parent = rootContext
context.mergePolicy = NSRollbackMergePolicy
context.undoManager = nil
context.setupForCoreStoreWithContextName("com.corestore.maincontext")
context.observerForDidSaveNotification = NotificationObserver(
notificationName: NSManagedObjectContextDidSaveNotification,
notificationName: NSNotification.Name.NSManagedObjectContextDidSave.rawValue,
object: rootContext,
closure: { [weak context] (note) -> Void in
@@ -113,21 +113,21 @@ internal extension NSManagedObjectContext {
}
let mergeChanges = { () -> Void in
let updatedObjects = (note.userInfo?[NSUpdatedObjectsKey] as? Set<NSManagedObject>) ?? []
let updatedObjects = ((note as NSNotification).userInfo?[NSUpdatedObjectsKey] as? Set<NSManagedObject>) ?? []
for object in updatedObjects {
context.objectWithID(object.objectID).willAccessValueForKey(nil)
context.object(with: object.objectID).willAccessValue(forKey: nil)
}
context.mergeChangesFromContextDidSaveNotification(note)
context.mergeChanges(fromContextDidSave: note)
}
if rootContext.isSavingSynchronously == true {
context.performBlockAndWait(mergeChanges)
context.performAndWait(mergeChanges)
}
else {
context.performBlock(mergeChanges)
context.perform(mergeChanges)
}
}
)
@@ -70,7 +70,7 @@ internal extension NSManagedObjectContext {
set {
cs_setAssociatedWeakObject(
newValue.flatMap { NSNumber(bool: $0) },
newValue.flatMap { NSNumber(value: $0) },
forKey: &PropertyKeys.isSavingSynchronously,
inObject: self
)
@@ -88,10 +88,10 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func temporaryContextInTransactionWithConcurrencyType(concurrencyType: NSManagedObjectContextConcurrencyType) -> NSManagedObjectContext {
internal func temporaryContextInTransactionWithConcurrencyType(_ concurrencyType: NSManagedObjectContextConcurrencyType) -> NSManagedObjectContext {
let context = NSManagedObjectContext(concurrencyType: concurrencyType)
context.parentContext = self
context.parent = self
context.parentStack = self.parentStack
context.setupForCoreStoreWithContextName("com.corestore.temporarycontext")
context.shouldCascadeSavesToParent = (self.parentStack?.rootSavingContext == self)
@@ -105,7 +105,7 @@ internal extension NSManagedObjectContext {
var result = SaveResult(hasChanges: false)
self.performBlockAndWait {
self.performAndWait {
guard self.hasChanges else {
@@ -123,20 +123,20 @@ internal extension NSManagedObjectContext {
let saveError = CoreStoreError(error)
CoreStore.log(
saveError,
"Failed to save \(cs_typeName(NSManagedObjectContext))."
"Failed to save \(cs_typeName(NSManagedObjectContext.self))."
)
result = SaveResult(saveError)
return
}
if let parentContext = self.parentContext where self.shouldCascadeSavesToParent {
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
switch parentContext.saveSynchronously() {
case .Success:
case .success:
result = SaveResult(hasChanges: true)
case .Failure(let error):
case .failure(let error):
result = SaveResult(error)
}
}
@@ -150,13 +150,13 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func saveAsynchronouslyWithCompletion(completion: ((result: SaveResult) -> Void) = { _ in }) {
internal func saveAsynchronouslyWithCompletion(_ completion: ((result: SaveResult) -> Void) = { _ in }) {
self.performBlock {
self.perform {
guard self.hasChanges else {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(result: SaveResult(hasChanges: false))
}
@@ -174,22 +174,22 @@ internal extension NSManagedObjectContext {
let saveError = CoreStoreError(error)
CoreStore.log(
saveError,
"Failed to save \(cs_typeName(NSManagedObjectContext))."
"Failed to save \(cs_typeName(NSManagedObjectContext.self))."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(result: SaveResult(saveError))
}
return
}
if let parentContext = self.parentContext where self.shouldCascadeSavesToParent {
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
parentContext.saveAsynchronouslyWithCompletion(completion)
}
else {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(result: SaveResult(hasChanges: true))
}
@@ -206,7 +206,7 @@ internal extension NSManagedObjectContext {
}
else {
self.registeredObjects.forEach { self.refreshObject($0, mergeChanges: true) }
self.registeredObjects.forEach { self.refresh($0, mergeChanges: true) }
}
}
@@ -34,17 +34,17 @@ internal extension NSManagedObjectModel {
// MARK: Internal
@nonobjc
internal static func fromBundle(bundle: NSBundle, modelName: String, modelVersionHints: Set<String> = []) -> NSManagedObjectModel {
internal static func fromBundle(_ bundle: Bundle, modelName: String, modelVersionHints: Set<String> = []) -> NSManagedObjectModel {
guard let modelFilePath = bundle.pathForResource(modelName, ofType: "momd") else {
CoreStore.abort("Could not find \"\(modelName).momd\" from the bundle. \(bundle)")
}
let modelFileURL = NSURL(fileURLWithPath: modelFilePath)
let versionInfoPlistURL = modelFileURL.URLByAppendingPathComponent("VersionInfo.plist", isDirectory: false)
let modelFileURL = URL(fileURLWithPath: modelFilePath)
let versionInfoPlistURL = try! modelFileURL.appendingPathComponent("VersionInfo.plist", isDirectory: false)
guard let versionInfo = NSDictionary(contentsOfURL: versionInfoPlistURL),
guard let versionInfo = NSDictionary(contentsOf: versionInfoPlistURL),
let versionHashes = versionInfo["NSManagedObjectModel_VersionHashes"] as? [String: AnyObject] else {
CoreStore.abort("Could not load \(cs_typeName(NSManagedObjectModel)) metadata from path \"\(versionInfoPlistURL)\".")
@@ -56,10 +56,10 @@ internal extension NSManagedObjectModel {
currentModelVersion = plistModelVersion
}
else if let resolvedVersion = modelVersions.intersect(modelVersionHints).first {
else if let resolvedVersion = modelVersions.intersection(modelVersionHints).first {
CoreStore.log(
.Warning,
.warning,
message: "The MigrationChain leaf versions do not include the model file's current version. Resolving to version \"\(resolvedVersion)\"."
)
currentModelVersion = resolvedVersion
@@ -69,7 +69,7 @@ internal extension NSManagedObjectModel {
if !modelVersionHints.isEmpty {
CoreStore.log(
.Warning,
.warning,
message: "The MigrationChain leaf versions do not include any of the model file's embedded versions. Resolving to version \"\(resolvedVersion)\"."
)
}
@@ -80,10 +80,10 @@ internal extension NSManagedObjectModel {
CoreStore.abort("No model files were found in URL \"\(modelFileURL)\".")
}
var modelVersionFileURL: NSURL?
var modelVersionFileURL: URL?
for modelVersion in modelVersions {
let fileURL = modelFileURL.URLByAppendingPathComponent("\(modelVersion).mom", isDirectory: false)
let fileURL = try! modelFileURL.appendingPathComponent("\(modelVersion).mom", isDirectory: false)
if modelVersion == currentModelVersion {
@@ -92,13 +92,13 @@ internal extension NSManagedObjectModel {
}
precondition(
NSManagedObjectModel(contentsOfURL: fileURL) != nil,
NSManagedObjectModel(contentsOf: fileURL) != nil,
"Could not find the \"\(modelVersion).mom\" version file for the model at URL \"\(modelFileURL)\"."
)
}
if let modelVersionFileURL = modelVersionFileURL,
let rootModel = NSManagedObjectModel(contentsOfURL: modelVersionFileURL) {
let rootModel = NSManagedObjectModel(contentsOf: modelVersionFileURL) {
rootModel.modelVersionFileURL = modelVersionFileURL
rootModel.modelVersions = modelVersions
@@ -152,7 +152,7 @@ internal extension NSManagedObjectModel {
}
@nonobjc
internal func entityNameForClass(entityClass: AnyClass) -> String {
internal func entityNameForClass(_ entityClass: AnyClass) -> String {
return self.entityNameMapping[NSStringFromClass(entityClass)]!
}
@@ -189,8 +189,8 @@ internal extension NSManagedObjectModel {
return nil
}
let versionModelFileURL = modelFileURL.URLByAppendingPathComponent("\(modelVersion).mom", isDirectory: false)
guard let model = NSManagedObjectModel(contentsOfURL: versionModelFileURL) else {
let versionModelFileURL = try! modelFileURL.appendingPathComponent("\(modelVersion).mom", isDirectory: false)
guard let model = NSManagedObjectModel(contentsOf: versionModelFileURL) else {
return nil
}
@@ -204,7 +204,7 @@ internal extension NSManagedObjectModel {
@nonobjc
internal subscript(metadata: [String: AnyObject]) -> NSManagedObjectModel? {
guard let modelHashes = metadata[NSStoreModelVersionHashesKey] as? [String : NSData] else {
guard let modelHashes = metadata[NSStoreModelVersionHashesKey] as? [String : Data] else {
return nil
}
@@ -222,16 +222,16 @@ internal extension NSManagedObjectModel {
// MARK: Private
@nonobjc
private var modelFileURL: NSURL? {
private var modelFileURL: URL? {
get {
return self.modelVersionFileURL?.URLByDeletingLastPathComponent
return try! self.modelVersionFileURL?.deletingLastPathComponent()
}
}
@nonobjc
private var modelVersionFileURL: NSURL? {
private var modelVersionFileURL: URL? {
get {
@@ -239,12 +239,12 @@ internal extension NSManagedObjectModel {
&PropertyKeys.modelVersionFileURL,
inObject: self
)
return value
return value as URL?
}
set {
cs_setAssociatedCopiedObject(
newValue,
newValue as NSURL?,
forKey: &PropertyKeys.modelVersionFileURL,
inObject: self
)
@@ -270,7 +270,7 @@ internal extension NSManagedObjectModel {
}
let className = $0.managedObjectClassName
mapping[className] = entityName
mapping[className!] = entityName
}
cs_setAssociatedCopiedObject(
mapping as NSDictionary,
@@ -36,124 +36,47 @@ import CoreData
internal extension NSPersistentStoreCoordinator {
@nonobjc
internal func performAsynchronously(closure: () -> Void) {
internal func performAsynchronously(_ closure: () -> Void) {
#if USE_FRAMEWORKS
self.performBlock(closure)
#else
if #available(iOS 8.0, *) {
self.performBlock(closure)
}
else {
self.lock()
GCDQueue.Default.async {
closure()
self.unlock()
}
}
#endif
self.perform(closure)
}
@nonobjc
internal func performSynchronously<T>(closure: () -> T) -> T {
internal func performSynchronously<T>(_ closure: () -> T) -> T {
var result: T?
#if USE_FRAMEWORKS
self.performAndWait {
self.performBlockAndWait {
result = closure()
}
#else
if #available(iOS 8.0, *) {
self.performBlockAndWait {
result = closure()
}
}
else {
self.lock()
cs_autoreleasepool {
result = closure()
}
self.unlock()
}
#endif
result = closure()
}
return result!
}
@nonobjc
internal func performSynchronously<T>(closure: () throws -> T) throws -> T {
internal func performSynchronously<T>(_ closure: () throws -> T) throws -> T {
var closureError: ErrorType?
var closureError: ErrorProtocol?
var result: T?
#if USE_FRAMEWORKS
self.performAndWait {
self.performBlockAndWait {
do {
do {
result = try closure()
}
catch {
closureError = error
}
result = try closure()
}
#else
if #available(iOS 8.0, *) {
catch {
self.performBlockAndWait {
do {
result = try closure()
}
catch {
closureError = error
}
}
closureError = error
}
else {
self.lock()
cs_autoreleasepool {
do {
result = try closure()
}
catch {
closureError = error
}
}
self.unlock()
}
#endif
}
if let closureError = closureError {
throw closureError
}
return result!
}
@nonobjc
internal func addPersistentStoreSynchronously(storeType: String, configuration: String?, URL storeURL: NSURL?, options: [NSObject : AnyObject]?) throws -> NSPersistentStore {
internal func addPersistentStoreSynchronously(_ storeType: String, configuration: String?, URL storeURL: URL?, options: [NSObject : AnyObject]?) throws -> NSPersistentStore {
var store: NSPersistentStore?
var storeError: NSError?
@@ -161,10 +84,10 @@ internal extension NSPersistentStoreCoordinator {
do {
store = try self.addPersistentStoreWithType(
storeType,
configuration: configuration,
URL: storeURL,
store = try self.addPersistentStore(
ofType: storeType,
configurationName: configuration,
at: storeURL,
options: options
)
}
@@ -173,12 +96,10 @@ internal extension NSPersistentStoreCoordinator {
storeError = error as NSError
}
}
if let store = store {
return store
}
throw CoreStoreError(storeError)
}
}
}
+6 -6
View File
@@ -36,23 +36,23 @@ internal final class NotificationObserver {
let object: AnyObject?
let observer: NSObjectProtocol
init(notificationName: String, object: AnyObject?, queue: NSOperationQueue? = nil, closure: (note: NSNotification) -> Void) {
init(notificationName: String, object: AnyObject?, queue: OperationQueue? = nil, closure: (note: Notification) -> Void) {
self.notificationName = notificationName
self.object = object
self.observer = NSNotificationCenter.defaultCenter().addObserverForName(
notificationName,
self.observer = NotificationCenter.default.addObserver(
forName: NSNotification.Name(rawValue: notificationName),
object: object,
queue: queue,
usingBlock: closure
using: closure
)
}
deinit {
NSNotificationCenter.defaultCenter().removeObserver(
NotificationCenter.default.removeObserver(
self.observer,
name: self.notificationName,
name: NSNotification.Name(rawValue: self.notificationName),
object: self.object
)
}
@@ -72,27 +72,27 @@ extension CloudStorageOptions: CustomDebugStringConvertible, CoreStoreDebugStrin
public var coreStoreDumpString: String {
var flags = [String]()
if self.contains(.RecreateLocalStoreOnModelMismatch) {
if self.contains(.recreateLocalStoreOnModelMismatch) {
flags.append(".RecreateLocalStoreOnModelMismatch")
flags.append(".recreateLocalStoreOnModelMismatch")
}
if self.contains(.AllowSynchronousLightweightMigration) {
if self.contains(.allowSynchronousLightweightMigration) {
flags.append(".AllowSynchronousLightweightMigration")
flags.append(".allowSynchronousLightweightMigration")
}
switch flags.count {
case 0:
return "[.None]"
return "[.none]"
case 1:
return "[.\(flags[0])]"
default:
var string = "[\n"
string.appendContentsOf(flags.joinWithSeparator(",\n"))
string.append(flags.joined(separator: ",\n"))
string.indent(1)
string.appendContentsOf("\n]")
string.append("\n]")
return string
}
}
@@ -122,25 +122,25 @@ extension CoreStoreError: CustomDebugStringConvertible, CoreStoreDebugStringConv
]
switch self {
case .Unknown:
firstLine = ".Unknown"
case .unknown:
firstLine = ".unknown"
case .DifferentStorageExistsAtURL(let existingPersistentStoreURL):
firstLine = ".DifferentStorageExistsAtURL"
case .differentStorageExistsAtURL(let existingPersistentStoreURL):
firstLine = ".differentStorageExistsAtURL"
info.append(("existingPersistentStoreURL", existingPersistentStoreURL))
case .MappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
firstLine = ".MappingModelNotFound"
case .mappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
firstLine = ".mappingModelNotFound"
info.append(("localStoreURL", localStoreURL))
info.append(("targetModel", targetModel))
info.append(("targetModelVersion", targetModelVersion))
case .ProgressiveMigrationRequired(let localStoreURL):
firstLine = ".ProgressiveMigrationRequired"
case .progressiveMigrationRequired(let localStoreURL):
firstLine = ".progressiveMigrationRequired"
info.append(("localStoreURL", localStoreURL))
case .InternalError(let NSError):
firstLine = ".InternalError"
case .internalError(let NSError):
firstLine = ".internalError"
info.append(("NSError", NSError))
}
@@ -404,31 +404,31 @@ extension LocalStorageOptions: CustomDebugStringConvertible, CoreStoreDebugStrin
public var coreStoreDumpString: String {
var flags = [String]()
if self.contains(.RecreateStoreOnModelMismatch) {
if self.contains(.recreateStoreOnModelMismatch) {
flags.append(".RecreateStoreOnModelMismatch")
flags.append(".recreateStoreOnModelMismatch")
}
if self.contains(.PreventProgressiveMigration) {
if self.contains(.preventProgressiveMigration) {
flags.append(".PreventProgressiveMigration")
flags.append(".preventProgressiveMigration")
}
if self.contains(.AllowSynchronousLightweightMigration) {
if self.contains(.allowSynchronousLightweightMigration) {
flags.append(".AllowSynchronousLightweightMigration")
flags.append(".allowSynchronousLightweightMigration")
}
switch flags.count {
case 0:
return "[.None]"
return "[.none]"
case 1:
return "[.\(flags[0])]"
default:
var string = "[\n"
string.appendContentsOf(flags.joinWithSeparator(",\n"))
string.append(flags.joined(separator: ",\n"))
string.indent(1)
string.appendContentsOf("\n]")
string.append("\n]")
return string
}
}
@@ -465,7 +465,7 @@ extension MigrationChain: CustomDebugStringConvertible, CoreStoreDebugStringConv
steps.append(nextVersion)
version = nextVersion
}
paths.append(steps.joinWithSeparator(""))
paths.append(steps.joined(separator: ""))
}
switch paths.count {
@@ -479,10 +479,10 @@ extension MigrationChain: CustomDebugStringConvertible, CoreStoreDebugStringConv
var string = "["
paths.forEach {
string.appendContentsOf("\n\($0);")
string.append("\n\($0);")
}
string.indent(1)
string.appendContentsOf("\n]")
string.append("\n]")
return string
}
}
@@ -507,15 +507,15 @@ extension MigrationResult: CustomDebugStringConvertible, CoreStoreDebugStringCon
switch self {
case .Success(let migrationTypes):
case .success(let migrationTypes):
return createFormattedString(
".Success (", ")",
".success (", ")",
("migrationTypes", migrationTypes)
)
case .Failure(let error):
case .failure(let error):
return createFormattedString(
".Failure (", ")",
".failure (", ")",
("error", error)
)
}
@@ -541,14 +541,14 @@ extension MigrationType: CustomDebugStringConvertible, CoreStoreDebugStringConve
switch self {
case .None(let version):
return ".None (\"\(version)\")"
case .none(let version):
return ".none (\"\(version)\")"
case .Lightweight(let sourceVersion, let destinationVersion):
return ".Lightweight (\"\(sourceVersion)\"\"\(destinationVersion)\")"
case .lightweight(let sourceVersion, let destinationVersion):
return ".lightweight (\"\(sourceVersion)\"\"\(destinationVersion)\")"
case .Heavyweight(let sourceVersion, let destinationVersion):
return ".Heavyweight (\"\(sourceVersion)\"\"\(destinationVersion)\")"
case .heavyweight(let sourceVersion, let destinationVersion):
return ".heavyweight (\"\(sourceVersion)\"\"\(destinationVersion)\")"
}
}
}
@@ -623,15 +623,15 @@ extension SaveResult: CustomDebugStringConvertible, CoreStoreDebugStringConverti
switch self {
case .Success(let hasChanges):
case .success(let hasChanges):
return createFormattedString(
".Success (", ")",
".success (", ")",
("hasChanges", hasChanges)
)
case .Failure(let error):
case .failure(let error):
return createFormattedString(
".Failure (", ")",
".failure (", ")",
("error", error)
)
}
@@ -708,24 +708,24 @@ extension SelectTerm: CustomDebugStringConvertible, CoreStoreDebugStringConverti
switch self {
case ._Attribute(let keyPath):
case ._attribute(let keyPath):
return createFormattedString(
".Attribute (", ")",
("keyPath", keyPath)
)
case ._Aggregate(let function, let keyPath, let alias, let nativeType):
case ._aggregate(let function, let keyPath, let alias, let nativeType):
return createFormattedString(
".Aggregate (", ")",
".aggregate (", ")",
("function", function),
("keyPath", keyPath),
("alias", alias),
("nativeType", nativeType)
)
case ._Identity(let alias, let nativeType):
case ._identity(let alias, let nativeType):
return createFormattedString(
".Identity (", ")",
".identity (", ")",
("alias", alias),
("nativeType", nativeType)
)
@@ -752,15 +752,15 @@ extension SetupResult: CustomDebugStringConvertible, CoreStoreDebugStringConvert
switch self {
case .Success(let storage):
case .success(let storage):
return createFormattedString(
".Success (", ")",
".success (", ")",
("storage", storage)
)
case .Failure(let error):
case .failure(let error):
return createFormattedString(
".Failure (", ")",
".failure (", ")",
("error", error)
)
}
@@ -898,7 +898,7 @@ extension Where: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
private typealias DumpInfo = [(key: String, value: Any)]
private func formattedValue(any: Any) -> String {
private func formattedValue(_ any: Any) -> String {
switch any {
@@ -910,19 +910,19 @@ private func formattedValue(any: Any) -> String {
}
}
private func formattedDebugDescription(any: Any) -> String {
private func formattedDebugDescription(_ any: Any) -> String {
var string = "(\(String(reflecting: any.dynamicType))) "
string.appendContentsOf(formattedValue(any))
string.append(formattedValue(any))
return string
}
private func createFormattedString(firstLine: String, _ lastLine: String, _ info: (key: String, value: Any)...) -> String {
private func createFormattedString(_ firstLine: String, _ lastLine: String, _ info: (key: String, value: Any)...) -> String {
return createFormattedString(firstLine, lastLine, info)
}
private func createFormattedString(firstLine: String, _ lastLine: String, _ info: [(key: String, value: Any)]) -> String {
private func createFormattedString(_ firstLine: String, _ lastLine: String, _ info: [(key: String, value: Any)]) -> String {
var string = firstLine
for (key, value) in info {
@@ -930,34 +930,34 @@ private func createFormattedString(firstLine: String, _ lastLine: String, _ info
string.appendDumpInfo(key, value)
}
string.indent(1)
string.appendContentsOf("\n\(lastLine)")
string.append("\n\(lastLine)")
return string
}
private extension String {
private static func indention(level: Int = 1) -> String {
private static func indention(_ level: Int = 1) -> String {
return String(count: level * 4, repeatedValue: Character(" "))
return String(repeating: Character(" "), count: level * 4)
}
private func trimSwiftModuleName() -> String {
if self.hasPrefix("Swift.") {
return self.substringFromIndex("Swift.".endIndex)
return self.substring(from: "Swift.".endIndex)
}
return self
}
private mutating func indent(level: Int) {
private mutating func indent(_ level: Int) {
self = self.stringByReplacingOccurrencesOfString("\n", withString: "\n\(String.indention(level))")
self = self.replacingOccurrences(of: "\n", with: "\n\(String.indention(level))")
}
private mutating func appendDumpInfo(key: String, _ value: Any) {
private mutating func appendDumpInfo(_ key: String, _ value: Any) {
self.appendContentsOf("\n.\(key) = \(formattedValue(value));")
self.append("\n.\(key) = \(formattedValue(value));")
}
}
@@ -979,17 +979,17 @@ extension Array: CoreStoreDebugStringConvertible {
var string = "\(self.count) item(s) ["
if self.isEmpty {
string.appendContentsOf("]")
string.append("]")
return string
}
else {
for (index, item) in self.enumerate() {
for (index, item) in self.enumerated() {
string.appendContentsOf("\n\(index) = \(formattedValue(item));")
string.append("\n\(index) = \(formattedValue(item));")
}
string.indent(1)
string.appendContentsOf("\n]")
string.append("\n]")
return string
}
}
@@ -1002,17 +1002,17 @@ extension Dictionary: CoreStoreDebugStringConvertible {
var string = "\(self.count) key-value(s) ["
if self.isEmpty {
string.appendContentsOf("]")
string.append("]")
return string
}
else {
for (key, value) in self {
string.appendContentsOf("\n\(formattedValue(key)) = \(formattedValue(value));")
string.append("\n\(formattedValue(key)) = \(formattedValue(value));")
}
string.indent(1)
string.appendContentsOf("\n]")
string.append("\n]")
return string
}
}
@@ -1031,14 +1031,14 @@ extension NSAttributeDescription: CoreStoreDebugStringConvertible {
("allowsExternalBinaryDataStorage", self.allowsExternalBinaryDataStorage),
("entity.name", self.entity.name),
("name", self.name),
("optional", self.optional),
("transient", self.transient),
("isOptional", self.isOptional),
("isTransient", self.isTransient),
("userInfo", self.userInfo),
("indexed", self.indexed),
("isIndexed", self.isIndexed),
("versionHash", self.versionHash),
("versionHashModifier", self.versionHashModifier),
("indexedBySpotlight", self.indexedBySpotlight),
("storedInExternalRecord", self.storedInExternalRecord),
("isIndexedBySpotlight", self.isIndexedBySpotlight),
("isStoredInExternalRecord", self.isStoredInExternalRecord),
("renamingIdentifier", self.renamingIdentifier)
)
}
@@ -1050,24 +1050,24 @@ extension NSAttributeType: CoreStoreDebugStringConvertible {
switch self {
case .UndefinedAttributeType: return ".UndefinedAttributeType"
case .Integer16AttributeType: return ".Integer16AttributeType"
case .Integer32AttributeType: return ".Integer32AttributeType"
case .Integer64AttributeType: return ".Integer64AttributeType"
case .DecimalAttributeType: return ".DecimalAttributeType"
case .DoubleAttributeType: return ".DoubleAttributeType"
case .FloatAttributeType: return ".FloatAttributeType"
case .StringAttributeType: return ".StringAttributeType"
case .BooleanAttributeType: return ".BooleanAttributeType"
case .DateAttributeType: return ".DateAttributeType"
case .BinaryDataAttributeType: return ".BinaryDataAttributeType"
case .TransformableAttributeType: return ".TransformableAttributeType"
case .ObjectIDAttributeType: return ".ObjectIDAttributeType"
case .undefinedAttributeType: return ".undefinedAttributeType"
case .integer16AttributeType: return ".integer16AttributeType"
case .integer32AttributeType: return ".integer32AttributeType"
case .integer64AttributeType: return ".integer64AttributeType"
case .decimalAttributeType: return ".decimalAttributeType"
case .doubleAttributeType: return ".doubleAttributeType"
case .floatAttributeType: return ".floatAttributeType"
case .stringAttributeType: return ".stringAttributeType"
case .booleanAttributeType: return ".booleanAttributeType"
case .dateAttributeType: return ".dateAttributeType"
case .binaryDataAttributeType: return ".binaryDataAttributeType"
case .transformableAttributeType: return ".transformableAttributeType"
case .objectIDAttributeType: return ".objectIDAttributeType"
}
}
}
extension NSBundle: CoreStoreDebugStringConvertible {
extension Bundle: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
@@ -1081,10 +1081,10 @@ extension NSDeleteRule: CoreStoreDebugStringConvertible {
switch self {
case .NoActionDeleteRule: return ".NoActionDeleteRule"
case .NullifyDeleteRule: return ".NullifyDeleteRule"
case .CascadeDeleteRule: return ".CascadeDeleteRule"
case .DenyDeleteRule: return ".DenyDeleteRule"
case .noActionDeleteRule: return ".noActionDeleteRule"
case .nullifyDeleteRule: return ".nullifyDeleteRule"
case .cascadeDeleteRule: return ".cascadeDeleteRule"
case .denyDeleteRule: return ".denyDeleteRule"
}
}
}
@@ -1096,7 +1096,7 @@ extension NSEntityDescription: CoreStoreDebugStringConvertible {
var info: DumpInfo = [
("managedObjectClassName", self.managedObjectClassName!),
("name", self.name),
("abstract", self.abstract),
("isAbstract", self.isAbstract),
("superentity?.name", self.superentity?.name),
("subentities", self.subentities.map({ $0.name })),
("properties", self.properties),
@@ -1147,10 +1147,10 @@ extension NSManagedObjectID: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
return createFormattedString(
"\(self.URIRepresentation().coreStoreDumpString) (", ")",
"\(self.uriRepresentation().coreStoreDumpString) (", ")",
("entity.name", self.entity.name),
("temporaryID", self.temporaryID),
("persistentStore?.URL", self.persistentStore?.URL)
("isTemporaryID", self.isTemporaryID),
("persistentStore?.url", self.persistentStore?.url)
)
}
}
@@ -1163,7 +1163,7 @@ extension NSMappingModel: CoreStoreDebugStringConvertible {
}
}
extension NSPredicate: CoreStoreDebugStringConvertible {
extension Predicate: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
@@ -1182,24 +1182,24 @@ extension NSRelationshipDescription: CoreStoreDebugStringConvertible {
("minCount", self.minCount),
("maxCount", self.maxCount),
("deleteRule", self.deleteRule),
("toMany", self.toMany),
("ordered", self.ordered),
("isToMany", self.isToMany),
("isOrdered", self.isOrdered),
("entity.name", self.entity.name),
("name", self.name),
("optional", self.optional),
("transient", self.transient),
("isOptional", self.isOptional),
("isTransient", self.isTransient),
("userInfo", self.userInfo),
("indexed", self.indexed),
("isIndexed", self.isIndexed),
("versionHash", self.versionHash),
("versionHashModifier", self.versionHashModifier),
("indexedBySpotlight", self.indexedBySpotlight),
("storedInExternalRecord", self.storedInExternalRecord),
("isIndexedBySpotlight", self.isIndexedBySpotlight),
("isStoredInExternalRecord", self.isStoredInExternalRecord),
("renamingIdentifier", self.renamingIdentifier)
)
}
}
extension NSSortDescriptor: CoreStoreDebugStringConvertible {
extension SortDescriptor: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
@@ -1212,7 +1212,7 @@ extension NSSortDescriptor: CoreStoreDebugStringConvertible {
}
}
extension NSURL: CoreStoreDebugStringConvertible {
extension URL: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
@@ -1236,7 +1236,7 @@ extension Selector: CoreStoreDebugStringConvertible {
public var coreStoreDumpString: String {
return self == nil ? "nil" : "\"\(self)\""
return "\"\(self)\""
}
}
+4 -4
View File
@@ -38,7 +38,7 @@ public extension CoreStore {
// MARK: Internal
internal static func log(level: LogLevel, message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
internal static func log(_ level: LogLevel, message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.log(
level: level,
@@ -49,7 +49,7 @@ public extension CoreStore {
)
}
internal static func log(error: CoreStoreError, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
internal static func log(_ error: CoreStoreError, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.log(
error: error,
@@ -60,7 +60,7 @@ public extension CoreStore {
)
}
internal static func assert(@autoclosure condition: () -> Bool, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
internal static func assert( _ condition: @autoclosure () -> Bool, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.assert(
condition,
@@ -72,7 +72,7 @@ public extension CoreStore {
}
@noreturn
internal static func abort(message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
internal static func abort(_ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.abort(
message,
+9 -27
View File
@@ -33,10 +33,10 @@ import Foundation
*/
public enum LogLevel {
case Trace
case Notice
case Warning
case Fatal
case trace
case notice
case warning
case fatal
}
@@ -56,7 +56,7 @@ public protocol CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
func log(level level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
func log(level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
/**
Handles errors sent by the `CoreStore` framework.
@@ -67,7 +67,7 @@ public protocol CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
func log(error error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
func log(error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
/**
Handles assertions made throughout the `CoreStore` framework.
@@ -78,7 +78,7 @@ public protocol CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
func assert(@autoclosure condition: () -> Bool, @autoclosure message: () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
func assert(_ condition: @autoclosure () -> Bool, message: @autoclosure () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
/**
Handles fatal errors made throughout the `CoreStore` framework. The app wil terminate after this method is called.
@@ -89,30 +89,12 @@ public protocol CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
func abort(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
// MARK: Deprecated
/**
Deprecated. Use `log(error:message:fileName:lineNumber:functionName:)` instead.
*/
@available(*, deprecated=2.0.0, message="Use log(error:message:fileName:lineNumber:functionName:) instead.")
func handleError(error error: NSError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)
}
extension CoreStoreLogger {
/**
Deprecated. Use `log(error:message:fileName:lineNumber:functionName:)` instead.
*/
@available(*, deprecated=2.0.0, message="Use log(error:message:fileName:lineNumber:functionName:) instead.")
public func handleError(error error: NSError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
self.log(error: error.bridgeToSwift, message: message, fileName: fileName, lineNumber: lineNumber, functionName: functionName)
}
public func abort(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
public func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
Swift.fatalError(message, file: fileName, line: UInt(lineNumber))
}
+12 -12
View File
@@ -51,30 +51,30 @@ public final class DefaultLogger: CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
public func log(level level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
public func log(level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
#if DEBUG
let icon: String
let levelString: String
switch level {
case .Trace:
case .trace:
icon = "🔹"
levelString = "Trace"
case .Notice:
case .notice:
icon = "🔸"
levelString = "Notice"
case .Warning:
case .warning:
icon = "⚠️"
levelString = "Warning"
case .Fatal:
case .fatal:
icon = ""
levelString = "Fatal"
}
Swift.print("\(icon) [CoreStore: \(levelString)] \((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
Swift.print("\(icon) [CoreStore: \(levelString)] \((String(fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
#endif
}
@@ -87,10 +87,10 @@ public final class DefaultLogger: CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
public func log(error error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
public func log(error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
#if DEBUG
Swift.print("⚠️ [CoreStore: Error] \((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n \(error)\n")
Swift.print("⚠️ [CoreStore: Error] \((String(fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n \(error)\n")
#endif
}
@@ -103,14 +103,14 @@ public final class DefaultLogger: CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
public func assert(@autoclosure condition: () -> Bool, @autoclosure message: () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
public func assert(_ condition: @autoclosure () -> Bool, message: @autoclosure () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
#if DEBUG
if condition() {
return
}
Swift.print("❗ [CoreStore: Assertion Failure] \((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message())\n")
Swift.print("❗ [CoreStore: Assertion Failure] \((String(fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message())\n")
Swift.fatalError(file: fileName, line: UInt(lineNumber))
#endif
}
@@ -124,9 +124,9 @@ public final class DefaultLogger: CoreStoreLogger {
- parameter lineNumber: the source line number
- parameter functionName: the source function name
*/
public func abort(message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
public func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
Swift.print("❗ [CoreStore: Fatal Error] \((fileName.stringValue as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
Swift.print("❗ [CoreStore: Fatal Error] \((String(fileName) as NSString).lastPathComponent):\(lineNumber) \(functionName)\n ↪︎ \(message)\n")
Swift.fatalError(file: fileName, line: UInt(lineNumber))
}
}
+8 -109
View File
@@ -51,7 +51,7 @@ public extension CoreStore {
- parameter storeType: the storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
public static func addStorage<T: StorageInterface where T: DefaultInitializableStore>(storeType: T.Type, completion: (SetupResult<T>) -> Void) {
public static func addStorage<T: StorageInterface where T: DefaultInitializableStore>(_ storeType: T.Type, completion: (SetupResult<T>) -> Void) {
self.defaultStack.addStorage(storeType.init(), completion: completion)
}
@@ -73,7 +73,7 @@ public extension CoreStore {
- parameter storage: the storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
public static func addStorage<T: StorageInterface>(storage: T, completion: (SetupResult<T>) -> Void) {
public static func addStorage<T: StorageInterface>(_ storage: T, completion: (SetupResult<T>) -> Void) {
self.defaultStack.addStorage(storage, completion: completion)
}
@@ -96,7 +96,7 @@ public extension CoreStore {
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
*/
public static func addStorage<T: LocalStorage where T: DefaultInitializableStore>(storeType: T.Type, completion: (SetupResult<T>) -> Void) -> NSProgress? {
public static func addStorage<T: LocalStorage where T: DefaultInitializableStore>(_ storeType: T.Type, completion: (SetupResult<T>) -> Void) -> Progress? {
return self.defaultStack.addStorage(storeType.init(), completion: completion)
}
@@ -119,7 +119,7 @@ public extension CoreStore {
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
*/
public static func addStorage<T: LocalStorage>(storage: T, completion: (SetupResult<T>) -> Void) -> NSProgress? {
public static func addStorage<T: LocalStorage>(_ storage: T, completion: (SetupResult<T>) -> Void) -> Progress? {
return self.defaultStack.addStorage(storage, completion: completion)
}
@@ -133,7 +133,7 @@ public extension CoreStore {
ubiquitousContainerID: "iCloud.com.mycompany.myapp.containername",
ubiquitousPeerToken: "9614d658014f4151a95d8048fb717cf0",
configuration: "Config1",
cloudStorageOptions: .RecreateLocalStoreOnModelMismatch
cloudStorageOptions: .recreateLocalStoreOnModelMismatch
) else {
// iCloud is not available on the device
return
@@ -152,7 +152,7 @@ public extension CoreStore {
- parameter storage: the cloud storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `CloudStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `CloudStorage` was already added at the same URL and with the same configuration.
*/
public static func addStorage<T: CloudStorage>(storage: T, completion: (SetupResult<T>) -> Void) {
public static func addStorage<T: CloudStorage>(_ storage: T, completion: (SetupResult<T>) -> Void) {
self.defaultStack.addStorage(storage, completion: completion)
}
@@ -165,7 +165,7 @@ public extension CoreStore {
- throws: a `CoreStoreError` value indicating the failure
- returns: an `NSProgress` instance if a migration has started, or `nil` is no migrations are required
*/
public static func upgradeStorageIfNeeded<T: LocalStorage>(storage: T, completion: (MigrationResult) -> Void) throws -> NSProgress? {
public static func upgradeStorageIfNeeded<T: LocalStorage>(_ storage: T, completion: (MigrationResult) -> Void) throws -> Progress? {
return try self.defaultStack.upgradeStorageIfNeeded(storage, completion: completion)
}
@@ -178,109 +178,8 @@ public extension CoreStore {
- returns: a `MigrationType` array indicating the migration steps required for the store, or an empty array if the file does not exist yet. Otherwise, an error is thrown if either inspection of the store failed, or if no mapping model was found/inferred.
*/
@warn_unused_result
public static func requiredMigrationsForStorage<T: LocalStorage>(storage: T) throws -> [MigrationType] {
public static func requiredMigrationsForStorage<T: LocalStorage>(_ storage: T) throws -> [MigrationType] {
return try self.defaultStack.requiredMigrationsForStorage(storage)
}
// MARK: Deprecated
/**
Deprecated. Use `addSQLiteStore(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use addSQLiteStore(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public static func addSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
return try self.defaultStack.addSQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles,
resetStoreOnModelMismatch: resetStoreOnModelMismatch,
completion: completion
)
}
/**
Deprecated. Use `addSQLiteStore(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use addSQLiteStore(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public static func addSQLiteStore(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle]? = NSBundle.allBundles(), resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
return try self.defaultStack.addSQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles,
resetStoreOnModelMismatch: resetStoreOnModelMismatch,
completion: completion
)
}
/**
Deprecated. Use `upgradeStorageIfNeeded(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use upgradeStorageIfNeeded(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public static func upgradeSQLiteStoreIfNeeded(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, completion: (MigrationResult) -> Void) throws -> NSProgress? {
return try self.defaultStack.upgradeSQLiteStoreIfNeeded(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
completion: completion
)
}
/**
Deprecated. Use `upgradeStorageIfNeeded(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use upgradeStorageIfNeeded(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public static func upgradeSQLiteStoreIfNeeded(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, completion: (MigrationResult) -> Void) throws -> NSProgress? {
return try self.defaultStack.upgradeSQLiteStoreIfNeeded(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
completion: completion
)
}
/**
Deprecated. Use `requiredMigrationsForStorage(_:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use requiredMigrationsForStorage(_:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
@warn_unused_result
public static func requiredMigrationsForSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] {
return try self.defaultStack.requiredMigrationsForSQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles
)
}
/**
Deprecated. Use `requiredMigrationsForStorage(_:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use requiredMigrationsForStorage(_:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
@warn_unused_result
public static func requiredMigrationsForSQLiteStore(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] {
return try self.defaultStack.requiredMigrationsForSQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles
)
}
}
+106 -262
View File
@@ -51,7 +51,7 @@ public extension DataStack {
- parameter storeType: the storage type
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
public func addStorage<T: StorageInterface where T: DefaultInitializableStore>(storeType: T.Type, completion: (SetupResult<T>) -> Void) {
public func addStorage<T: StorageInterface where T: DefaultInitializableStore>(_ storeType: T.Type, completion: (SetupResult<T>) -> Void) {
self.addStorage(storeType.init(), completion: completion)
}
@@ -73,13 +73,13 @@ public extension DataStack {
- parameter storage: the storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `StorageInterface` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `StorageInterface` was already added at the same URL and with the same configuration.
*/
public func addStorage<T: StorageInterface>(storage: T, completion: (SetupResult<T>) -> Void) {
public func addStorage<T: StorageInterface>(_ storage: T, completion: (SetupResult<T>) -> Void) {
self.coordinator.performAsynchronously {
if let _ = self.persistentStoreForStorage(storage) {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
@@ -94,7 +94,7 @@ public extension DataStack {
finalStoreOptions: storage.storeOptions
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
@@ -106,7 +106,7 @@ public extension DataStack {
storeError,
"Failed to add \(cs_typeName(storage)) to the stack."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storeError))
}
@@ -132,7 +132,7 @@ public extension DataStack {
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
*/
public func addStorage<T: LocalStorage where T: DefaultInitializableStore>(storeType: T.Type, completion: (SetupResult<T>) -> Void) -> NSProgress? {
public func addStorage<T: LocalStorage where T: DefaultInitializableStore>(_ storeType: T.Type, completion: (SetupResult<T>) -> Void) -> Progress? {
return self.addStorage(storeType.init(), completion: completion)
}
@@ -155,11 +155,11 @@ public extension DataStack {
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `LocalStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `LocalStorage` was already added at the same URL and with the same configuration.
- returns: an `NSProgress` instance if a migration has started, or `nil` if either no migrations are required or if a failure occured.
*/
public func addStorage<T: LocalStorage>(storage: T, completion: (SetupResult<T>) -> Void) -> NSProgress? {
public func addStorage<T: LocalStorage>(_ storage: T, completion: (SetupResult<T>) -> Void) -> Progress? {
let fileURL = storage.fileURL
CoreStore.assert(
fileURL.fileURL,
fileURL.isFileURL,
"The specified URL for the \(cs_typeName(storage)) is invalid: \"\(fileURL)\""
)
@@ -167,31 +167,31 @@ public extension DataStack {
if let _ = self.persistentStoreForStorage(storage) {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
return nil
}
if let persistentStore = self.coordinator.persistentStoreForURL(fileURL) {
if let persistentStore = self.coordinator.persistentStore(for: fileURL as URL) {
if let existingStorage = persistentStore.storageInterface as? T
where storage.matchesPersistentStore(persistentStore) {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(existingStorage))
}
return nil
}
let error = CoreStoreError.DifferentStorageExistsAtURL(existingPersistentStoreURL: fileURL)
let error = CoreStoreError.differentStorageExistsAtURL(existingPersistentStoreURL: fileURL)
CoreStore.log(
error,
"Failed to add \(cs_typeName(storage)) at \"\(fileURL)\" because a different \(cs_typeName(NSPersistentStore)) at that URL already exists."
"Failed to add \(cs_typeName(storage)) at \"\(fileURL)\" because a different \(cs_typeName(NSPersistentStore.self)) at that URL already exists."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(error))
}
@@ -200,15 +200,15 @@ public extension DataStack {
do {
try NSFileManager.defaultManager().createDirectoryAtURL(
fileURL.URLByDeletingLastPathComponent!,
try FileManager.default.createDirectory(
at: try fileURL.deletingLastPathComponent(),
withIntermediateDirectories: true,
attributes: nil
)
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(
storage.dynamicType.storeType,
URL: fileURL,
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStore(
ofType: storage.dynamicType.storeType,
at: fileURL as URL,
options: storage.storeOptions
)
@@ -217,16 +217,16 @@ public extension DataStack {
metadata: metadata,
completion: { (result) -> Void in
if case .Failure(.InternalError(let error)) = result {
if case .failure(.internalError(let error)) = result {
if storage.localStorageOptions.contains(.RecreateStoreOnModelMismatch) && error.isCoreDataMigrationError {
if storage.localStorageOptions.contains(.recreateStoreOnModelMismatch) && error.isCoreDataMigrationError {
do {
try _ = self.model[metadata].flatMap(storage.eraseStorageAndWait)
try self.addStorageAndWait(storage)
_ = try self.model[metadata].flatMap(storage.eraseStorageAndWait)
_ = try self.addStorageAndWait(storage)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
@@ -244,7 +244,7 @@ public extension DataStack {
do {
try self.addStorageAndWait(storage)
_ = try self.addStorageAndWait(storage)
completion(SetupResult(storage))
}
@@ -260,16 +260,16 @@ public extension DataStack {
do {
try self.addStorageAndWait(storage)
_ = try self.addStorageAndWait(storage)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
}
catch {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(error))
}
@@ -281,9 +281,9 @@ public extension DataStack {
let storeError = CoreStoreError(error)
CoreStore.log(
storeError,
"Failed to load SQLite \(cs_typeName(NSPersistentStore)) metadata."
"Failed to load SQLite \(cs_typeName(NSPersistentStore.self)) metadata."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storeError))
}
@@ -301,7 +301,7 @@ public extension DataStack {
ubiquitousContainerID: "iCloud.com.mycompany.myapp.containername",
ubiquitousPeerToken: "9614d658014f4151a95d8048fb717cf0",
configuration: "Config1",
cloudStorageOptions: .RecreateLocalStoreOnModelMismatch
cloudStorageOptions: .recreateLocalStoreOnModelMismatch
) else {
// iCloud is not available on the device
return
@@ -320,38 +320,38 @@ public extension DataStack {
- parameter storage: the cloud storage
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `SetupResult` argument indicates the result. Note that the `CloudStorage` associated to the `SetupResult.Success` may not always be the same instance as the parameter argument if a previous `CloudStorage` was already added at the same URL and with the same configuration.
*/
public func addStorage<T: CloudStorage>(storage: T, completion: (SetupResult<T>) -> Void) {
public func addStorage<T: CloudStorage>(_ storage: T, completion: (SetupResult<T>) -> Void) {
let cacheFileURL = storage.cacheFileURL
self.coordinator.performSynchronously {
if let _ = self.persistentStoreForStorage(storage) {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
return
}
if let persistentStore = self.coordinator.persistentStoreForURL(cacheFileURL) {
if let persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) {
if let existingStorage = persistentStore.storageInterface as? T
where storage.matchesPersistentStore(persistentStore) {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(existingStorage))
}
return
}
let error = CoreStoreError.DifferentStorageExistsAtURL(existingPersistentStoreURL: cacheFileURL)
let error = CoreStoreError.differentStorageExistsAtURL(existingPersistentStoreURL: cacheFileURL)
CoreStore.log(
error,
"Failed to add \(cs_typeName(storage)) at \"\(cacheFileURL)\" because a different \(cs_typeName(NSPersistentStore)) at that URL already exists."
"Failed to add \(cs_typeName(storage)) at \"\(cacheFileURL)\" because a different \(cs_typeName(NSPersistentStore.self)) at that URL already exists."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(error))
}
@@ -361,36 +361,35 @@ public extension DataStack {
do {
var cloudStorageOptions = storage.cloudStorageOptions
cloudStorageOptions.remove(.RecreateLocalStoreOnModelMismatch)
cloudStorageOptions.remove(.recreateLocalStoreOnModelMismatch)
let storeOptions = storage.storeOptionsForOptions(cloudStorageOptions)
do {
try NSFileManager.defaultManager().createDirectoryAtURL(
cacheFileURL.URLByDeletingLastPathComponent!,
try FileManager.default.createDirectory(
at: try cacheFileURL.deletingLastPathComponent(),
withIntermediateDirectories: true,
attributes: nil
)
try self.createPersistentStoreFromStorage(
_ = try self.createPersistentStoreFromStorage(
storage,
finalURL: cacheFileURL,
finalStoreOptions: storeOptions
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
}
catch let error as NSError where storage.cloudStorageOptions.contains(.RecreateLocalStoreOnModelMismatch) && error.isCoreDataMigrationError {
catch let error as NSError where storage.cloudStorageOptions.contains(.recreateLocalStoreOnModelMismatch) && error.isCoreDataMigrationError {
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(
storage.dynamicType.storeType,
URL: cacheFileURL,
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStore(
ofType: storage.dynamicType.storeType,
at: cacheFileURL,
options: storeOptions
)
try _ = self.model[metadata].flatMap(storage.eraseStorageAndWait)
try self.createPersistentStoreFromStorage(
_ = try self.model[metadata].flatMap(storage.eraseStorageAndWait)
_ = try self.createPersistentStoreFromStorage(
storage,
finalURL: cacheFileURL,
finalStoreOptions: storeOptions
@@ -402,16 +401,16 @@ public extension DataStack {
do {
try self.addStorageAndWait(storage)
_ = try self.addStorageAndWait(storage)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storage))
}
}
catch {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(error))
}
@@ -424,7 +423,7 @@ public extension DataStack {
storeError,
"Failed to load \(cs_typeName(NSPersistentStore)) metadata."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(SetupResult(storeError))
}
@@ -440,7 +439,7 @@ public extension DataStack {
- throws: a `CoreStoreError` value indicating the failure
- returns: an `NSProgress` instance if a migration has started, or `nil` is no migrations are required
*/
public func upgradeStorageIfNeeded<T: LocalStorage>(storage: T, completion: (MigrationResult) -> Void) throws -> NSProgress? {
public func upgradeStorageIfNeeded<T: LocalStorage>(_ storage: T, completion: (MigrationResult) -> Void) throws -> Progress? {
return try self.coordinator.performSynchronously {
@@ -452,9 +451,9 @@ public extension DataStack {
"Attempted to migrate an already added \(cs_typeName(storage)) at URL \"\(fileURL)\""
)
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(
storage.dynamicType.storeType,
URL: fileURL,
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStore(
ofType: storage.dynamicType.storeType,
at: fileURL as URL,
options: storage.storeOptions
)
return self.upgradeStorageIfNeeded(
@@ -483,7 +482,7 @@ public extension DataStack {
- returns: a `MigrationType` array indicating the migration steps required for the store, or an empty array if the file does not exist yet. Otherwise, an error is thrown if either inspection of the store failed, or if no mapping model was found/inferred.
*/
@warn_unused_result
public func requiredMigrationsForStorage<T: LocalStorage>(storage: T) throws -> [MigrationType] {
public func requiredMigrationsForStorage<T: LocalStorage>(_ storage: T) throws -> [MigrationType] {
return try self.coordinator.performSynchronously {
@@ -495,15 +494,15 @@ public extension DataStack {
)
do {
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(
storage.dynamicType.storeType,
URL: fileURL,
let metadata = try NSPersistentStoreCoordinator.metadataForPersistentStore(
ofType: storage.dynamicType.storeType,
at: fileURL as URL,
options: storage.storeOptions
)
guard let migrationSteps = self.computeMigrationFromStorage(storage, metadata: metadata) else {
let error = CoreStoreError.MappingModelNotFound(
let error = CoreStoreError.mappingModelNotFound(
localStoreURL: fileURL,
targetModel: self.model,
targetModelVersion: self.modelVersion
@@ -515,9 +514,9 @@ public extension DataStack {
throw error
}
if migrationSteps.count > 1 && storage.localStorageOptions.contains(.PreventProgressiveMigration) {
if migrationSteps.count > 1 && storage.localStorageOptions.contains(.preventProgressiveMigration) {
let error = CoreStoreError.ProgressiveMigrationRequired(localStoreURL: fileURL)
let error = CoreStoreError.progressiveMigrationRequired(localStoreURL: fileURL)
CoreStore.log(
error,
"Failed to find migration mapping from the \(cs_typeName(storage)) at URL \"\(fileURL)\" to version model \"\(self.modelVersion)\" without requiring progessive migrations."
@@ -547,11 +546,11 @@ public extension DataStack {
// MARK: Private
private func upgradeStorageIfNeeded<T: LocalStorage>(storage: T, metadata: [String: AnyObject], completion: (MigrationResult) -> Void) -> NSProgress? {
private func upgradeStorageIfNeeded<T: LocalStorage>(_ storage: T, metadata: [String: AnyObject], completion: (MigrationResult) -> Void) -> Progress? {
guard let migrationSteps = self.computeMigrationFromStorage(storage, metadata: metadata) else {
let error = CoreStoreError.MappingModelNotFound(
let error = CoreStoreError.mappingModelNotFound(
localStoreURL: storage.fileURL,
targetModel: self.model,
targetModelVersion: self.modelVersion
@@ -561,7 +560,7 @@ public extension DataStack {
"Failed to find migration steps from \(cs_typeName(storage)) at URL \"\(storage.fileURL)\" to version model \"\(self.model)\"."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(MigrationResult(error))
}
@@ -571,21 +570,21 @@ public extension DataStack {
let numberOfMigrations: Int64 = Int64(migrationSteps.count)
if numberOfMigrations == 0 {
GCDQueue.Main.async {
GCDQueue.main.async {
completion(MigrationResult([]))
return
}
return nil
}
else if numberOfMigrations > 1 && storage.localStorageOptions.contains(.PreventProgressiveMigration) {
else if numberOfMigrations > 1 && storage.localStorageOptions.contains(.preventProgressiveMigration) {
let error = CoreStoreError.ProgressiveMigrationRequired(localStoreURL: storage.fileURL)
let error = CoreStoreError.progressiveMigrationRequired(localStoreURL: storage.fileURL)
CoreStore.log(
error,
"Failed to find migration mapping from the \(cs_typeName(storage)) at URL \"\(storage.fileURL)\" to version model \"\(self.modelVersion)\" without requiring progessive migrations."
)
GCDQueue.Main.async {
GCDQueue.main.async {
completion(MigrationResult(error))
}
@@ -594,21 +593,21 @@ public extension DataStack {
let migrationTypes = migrationSteps.map { $0.migrationType }
var migrationResult: MigrationResult?
var operations = [NSOperation]()
var operations = [Operation]()
var cancelled = false
let progress = NSProgress(parent: nil, userInfo: nil)
let progress = Progress(parent: nil, userInfo: nil)
progress.totalUnitCount = numberOfMigrations
for (sourceModel, destinationModel, mappingModel, _) in migrationSteps {
progress.becomeCurrentWithPendingUnitCount(1)
progress.becomeCurrent(withPendingUnitCount: 1)
let childProgress = NSProgress(parent: progress, userInfo: nil)
let childProgress = Progress(parent: progress, userInfo: nil)
childProgress.totalUnitCount = 100
operations.append(
NSBlockOperation { [weak self] in
BlockOperation { [weak self] in
guard let `self` = self where !cancelled else {
@@ -634,9 +633,9 @@ public extension DataStack {
}
}
GCDQueue.Main.async {
GCDQueue.main.async {
_ = withExtendedLifetime(childProgress) { (_: NSProgress) -> Void in }
_ = withExtendedLifetime(childProgress) { (_: Progress) -> Void in }
}
}
)
@@ -644,21 +643,21 @@ public extension DataStack {
progress.resignCurrent()
}
let migrationOperation = NSBlockOperation()
let migrationOperation = BlockOperation()
#if USE_FRAMEWORKS
migrationOperation.qualityOfService = .Utility
migrationOperation.qualityOfService = .utility
#else
if #available(iOS 8.0, *) {
migrationOperation.qualityOfService = .Utility
migrationOperation.qualityOfService = .utility
}
#endif
operations.forEach { migrationOperation.addDependency($0) }
migrationOperation.addExecutionBlock { () -> Void in
GCDQueue.Main.async {
GCDQueue.main.async {
progress.setProgressHandler(nil)
completion(migrationResult ?? MigrationResult(migrationTypes))
@@ -673,10 +672,10 @@ public extension DataStack {
return progress
}
private func computeMigrationFromStorage<T: LocalStorage>(storage: T, metadata: [String: AnyObject]) -> [(sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, migrationType: MigrationType)]? {
private func computeMigrationFromStorage<T: LocalStorage>(_ storage: T, metadata: [String: AnyObject]) -> [(sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, migrationType: MigrationType)]? {
let model = self.model
if model.isConfiguration(storage.configuration, compatibleWithStoreMetadata: metadata) {
if model.isConfiguration(withName: storage.configuration, compatibleWithStoreMetadata: metadata) {
return []
}
@@ -698,7 +697,7 @@ public extension DataStack {
let destinationModel = model[nextVersion] where sourceModel != model {
if let mappingModel = NSMappingModel(
fromBundles: storage.mappingModelBundles,
from: storage.mappingModelBundles,
forSourceModel: sourceModel,
destinationModel: destinationModel) {
@@ -707,7 +706,7 @@ public extension DataStack {
sourceModel: sourceModel,
destinationModel: destinationModel,
mappingModel: mappingModel,
migrationType: .Heavyweight(
migrationType: .heavyweight(
sourceVersion: currentVersion,
destinationVersion: nextVersion
)
@@ -718,8 +717,8 @@ public extension DataStack {
do {
let mappingModel = try NSMappingModel.inferredMappingModelForSourceModel(
sourceModel,
let mappingModel = try NSMappingModel.inferredMappingModel(
forSourceModel: sourceModel,
destinationModel: destinationModel
)
@@ -728,7 +727,7 @@ public extension DataStack {
sourceModel: sourceModel,
destinationModel: destinationModel,
mappingModel: mappingModel,
migrationType: .Lightweight(
migrationType: .lightweight(
sourceVersion: currentVersion,
destinationVersion: nextVersion
)
@@ -751,22 +750,22 @@ public extension DataStack {
return nil
}
private func startMigrationForStorage<T: LocalStorage>(storage: T, sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, progress: NSProgress) throws {
private func startMigrationForStorage<T: LocalStorage>(_ storage: T, sourceModel: NSManagedObjectModel, destinationModel: NSManagedObjectModel, mappingModel: NSMappingModel, progress: Progress) throws {
let fileURL = storage.fileURL
let temporaryDirectoryURL = NSURL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.URLByAppendingPathComponent(NSBundle.mainBundle().bundleIdentifier ?? "com.CoreStore.DataStack")
.URLByAppendingPathComponent(NSProcessInfo().globallyUniqueString)
let temporaryDirectoryURL = try! URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack")
.appendingPathComponent(ProcessInfo().globallyUniqueString)
let fileManager = NSFileManager.defaultManager()
try! fileManager.createDirectoryAtURL(
temporaryDirectoryURL,
let fileManager = FileManager.default
try! fileManager.createDirectory(
at: temporaryDirectoryURL,
withIntermediateDirectories: true,
attributes: nil
)
let temporaryFileURL = temporaryDirectoryURL.URLByAppendingPathComponent(
let temporaryFileURL = try! temporaryDirectoryURL.appendingPathComponent(
fileURL.lastPathComponent!,
isDirectory: false
)
@@ -779,11 +778,11 @@ public extension DataStack {
do {
try migrationManager.migrateStoreFromURL(
fileURL,
type: storage.dynamicType.storeType,
try migrationManager.migrateStore(
from: fileURL,
sourceType: storage.dynamicType.storeType,
options: nil,
withMappingModel: mappingModel,
with: mappingModel,
toDestinationURL: temporaryFileURL,
destinationType: storage.dynamicType.storeType,
destinationOptions: nil
@@ -793,7 +792,7 @@ public extension DataStack {
do {
try fileManager.removeItemAtURL(temporaryFileURL)
try fileManager.removeItem(at: temporaryFileURL)
}
catch _ { }
@@ -810,9 +809,9 @@ public extension DataStack {
do {
try fileManager.replaceItemAtURL(
fileURL,
withItemAtURL: temporaryFileURL,
try fileManager.replaceItem(
at: fileURL as URL,
withItemAt: temporaryFileURL,
backupItemName: nil,
options: [],
resultingItemURL: nil
@@ -824,7 +823,7 @@ public extension DataStack {
do {
try fileManager.removeItemAtURL(temporaryFileURL)
try fileManager.removeItem(at: temporaryFileURL)
}
catch _ { }
@@ -839,159 +838,4 @@ public extension DataStack {
throw fileError
}
}
// MARK: Deprecated
/**
Deprecated. Use `addStorage(_:completion:)` by passing a `InMemoryStore` instance.
*/
@available(*, deprecated=2.0.0, message="Use addStorage(_:completion:) by passing a InMemoryStore instance.")
public func addInMemoryStore(configuration configuration: String? = nil, completion: (PersistentStoreResult) -> Void) {
self.addStorage(
InMemoryStore(configuration: configuration),
completion: { result in
switch result {
case .Success(let storage):
completion(PersistentStoreResult(self.persistentStoreForStorage(storage)!))
case .Failure(let error):
completion(PersistentStoreResult(error as NSError))
}
}
)
}
/**
Deprecated. Use `addStorage(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use addStorage(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public func addSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle]? = nil, resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
return self.addStorage(
LegacySQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
localStorageOptions: resetStoreOnModelMismatch ? .RecreateStoreOnModelMismatch : .None
),
completion: { result in
switch result {
case .Success(let storage):
completion(PersistentStoreResult(self.persistentStoreForStorage(storage)!))
case .Failure(let error):
completion(PersistentStoreResult(error as NSError))
}
}
)
}
/**
Deprecated. Use `addSQLiteStore(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use addSQLiteStore(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public func addSQLiteStore(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle]? = NSBundle.allBundles(), resetStoreOnModelMismatch: Bool = false, completion: (PersistentStoreResult) -> Void) throws -> NSProgress? {
return self.addStorage(
LegacySQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
localStorageOptions: resetStoreOnModelMismatch ? .RecreateStoreOnModelMismatch : .None
),
completion: { result in
switch result {
case .Success(let storage):
completion(PersistentStoreResult(self.persistentStoreForStorage(storage)!))
case .Failure(let error):
completion(PersistentStoreResult(error as NSError))
}
}
)
}
/**
Deprecated. Use `upgradeStorageIfNeeded(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use upgradeStorageIfNeeded(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public func upgradeSQLiteStoreIfNeeded(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles(), completion: (MigrationResult) -> Void) throws -> NSProgress? {
return try self.upgradeStorageIfNeeded(
LegacySQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles
),
completion: completion
)
}
/**
Deprecated. Use `upgradeStorageIfNeeded(_:completion:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use upgradeStorageIfNeeded(_:completion:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
public func upgradeSQLiteStoreIfNeeded(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles(), completion: (MigrationResult) -> Void) throws -> NSProgress? {
return try self.upgradeStorageIfNeeded(
LegacySQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles
),
completion: completion
)
}
/**
Deprecated. Use `requiredMigrationsForStorage(_:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use requiredMigrationsForStorage(_:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
@warn_unused_result
public func requiredMigrationsForSQLiteStore(fileName fileName: String, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] {
return try self.requiredMigrationsForStorage(
LegacySQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles
)
)
}
/**
Deprecated. Use `requiredMigrationsForStorage(_:)` by passing a `LegacySQLiteStore` instance.
- Warning: The default SQLite file location for the `LegacySQLiteStore` and `SQLiteStore` are different. If the app was using this method prior to 2.0.0, make sure to use `LegacySQLiteStore`.
*/
@available(*, deprecated=2.0.0, message="Use requiredMigrationsForStorage(_:) by passing a LegacySQLiteStore instance. Warning: The default SQLite file location for the LegacySQLiteStore and SQLiteStore are different. If the app was using this method prior to 2.0.0, make sure to use LegacySQLiteStore.")
@warn_unused_result
public func requiredMigrationsForSQLiteStore(fileURL fileURL: NSURL = LegacySQLiteStore.defaultFileURL, configuration: String? = nil, mappingModelBundles: [NSBundle] = NSBundle.allBundles() as [NSBundle]) throws -> [MigrationType] {
return try self.requiredMigrationsForStorage(
LegacySQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles
)
)
}
}
+9 -9
View File
@@ -87,9 +87,9 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
/**
Initializes the `MigrationChain` with a linear order of versions, which becomes the order of the `DataStack`'s progressive migrations.
*/
public init<T: CollectionType where T.Generator.Element == String, T.Index: BidirectionalIndexType>(_ elements: T) {
public init<T: Collection where T.Iterator.Element == String, T.SubSequence.Iterator.Element == String, T.Index: Comparable>(_ elements: T) {
CoreStore.assert(Set(elements).count == Array(elements).count, "\(cs_typeName(MigrationChain))'s migration chain could not be created due to duplicate version strings.")
CoreStore.assert(Set(elements).count == Array(elements).count, "\(cs_typeName(MigrationChain.self))'s migration chain could not be created due to duplicate version strings.")
var lastVersion: String?
var versionTree = [String: String]()
@@ -105,8 +105,8 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
}
self.versionTree = versionTree
self.rootVersions = Set([elements.first].flatMap { $0 == nil ? [] : [$0!] })
self.leafVersions = Set([elements.last].flatMap { $0 == nil ? [] : [$0!] })
self.rootVersions = Set(elements.prefix(1))
self.leafVersions = Set(elements.suffix(1))
self.valid = valid
}
@@ -124,7 +124,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
return
}
CoreStore.assert(false, "\(cs_typeName(MigrationChain))'s migration chain could not be created due to ambiguous version paths.")
CoreStore.assert(false, "\(cs_typeName(MigrationChain.self))'s migration chain could not be created due to ambiguous version paths.")
valid = false
}
@@ -142,7 +142,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
if checklist.contains(nextVersion) {
CoreStore.assert(false, "\(cs_typeName(MigrationChain))'s migration chain could not be created due to looping version paths.")
CoreStore.assert(false, "\(cs_typeName(MigrationChain.self))'s migration chain could not be created due to looping version paths.")
return true
}
@@ -154,7 +154,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
}
self.versionTree = versionTree
self.rootVersions = Set(versionTree.keys).subtract(versionTree.values)
self.rootVersions = Set(versionTree.keys).subtracting(versionTree.values)
self.leafVersions = leafVersions
self.valid = valid && Set(versionTree.keys).union(versionTree.values).filter { isVersionAmbiguous($0) }.count <= 0
}
@@ -227,14 +227,14 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
return self.versionTree.count <= 0
}
internal func contains(version: String) -> Bool {
internal func contains(_ version: String) -> Bool {
return self.rootVersions.contains(version)
|| self.leafVersions.contains(version)
|| self.versionTree[version] != nil
}
internal func nextVersionFrom(version: String) -> String? {
internal func nextVersionFrom(_ version: String) -> String? {
guard let nextVersion = self.versionTree[version] where nextVersion != version else {
+13 -13
View File
@@ -57,17 +57,17 @@ import Foundation
}
```
*/
public enum MigrationResult: BooleanType, Hashable {
public enum MigrationResult: Boolean, Hashable {
/**
`MigrationResult.Success` indicates either the migration succeeded, or there were no migrations needed. The associated value is an array of `MigrationType`s reflecting the migration steps completed.
*/
case Success([MigrationType])
case success([MigrationType])
/**
`SaveResult.Failure` indicates that the migration failed. The associated object for this value is the a `CoreStoreError` enum value.
*/
case Failure(CoreStoreError)
case failure(CoreStoreError)
// MARK: BooleanType
@@ -76,8 +76,8 @@ public enum MigrationResult: BooleanType, Hashable {
switch self {
case .Success: return true
case .Failure: return false
case .success: return true
case .failure: return false
}
}
@@ -88,11 +88,11 @@ public enum MigrationResult: BooleanType, Hashable {
switch self {
case .Success(let migrationTypes):
case .success(let migrationTypes):
return self.boolValue.hashValue
^ migrationTypes.map { $0.hashValue }.reduce(0, combine: ^).hashValue
case .Failure(let error):
case .failure(let error):
return self.boolValue.hashValue ^ error.hashValue
}
}
@@ -102,17 +102,17 @@ public enum MigrationResult: BooleanType, Hashable {
internal init(_ migrationTypes: [MigrationType]) {
self = .Success(migrationTypes)
self = .success(migrationTypes)
}
internal init(_ error: CoreStoreError) {
self = .Failure(error)
self = .failure(error)
}
internal init(_ error: ErrorType) {
internal init(_ error: ErrorProtocol) {
self = .Failure(CoreStoreError(error))
self = .failure(CoreStoreError(error))
}
}
@@ -124,10 +124,10 @@ public func == (lhs: MigrationResult, rhs: MigrationResult) -> Bool {
switch (lhs, rhs) {
case (.Success(let migrationTypes1), .Success(let migrationTypes2)):
case (.success(let migrationTypes1), .success(let migrationTypes2)):
return migrationTypes1 == migrationTypes2
case (.Failure(let error1), .Failure(let error2)):
case (.failure(let error1), .failure(let error2)):
return error1 == error2
default:
+21 -21
View File
@@ -31,22 +31,22 @@ import Foundation
/**
The `MigrationType` specifies the type of migration required for a store.
*/
public enum MigrationType: BooleanType, Hashable {
public enum MigrationType: Boolean, Hashable {
/**
Indicates that the persistent store matches the latest model version and no migration is needed
*/
case None(version: String)
case none(version: String)
/**
Indicates that the persistent store does not match the latest model version but Core Data can infer the mapping model, so a lightweight migration is needed
*/
case Lightweight(sourceVersion: String, destinationVersion: String)
case lightweight(sourceVersion: String, destinationVersion: String)
/**
Indicates that the persistent store does not match the latest model version and Core Data could not infer a mapping model, so a custom migration is needed
*/
case Heavyweight(sourceVersion: String, destinationVersion: String)
case heavyweight(sourceVersion: String, destinationVersion: String)
/**
Returns the source model version for the migration type. If no migration is required, `sourceVersion` will be equal to the `destinationVersion`.
@@ -55,13 +55,13 @@ public enum MigrationType: BooleanType, Hashable {
switch self {
case .None(let version):
case .none(let version):
return version
case .Lightweight(let sourceVersion, _):
case .lightweight(let sourceVersion, _):
return sourceVersion
case .Heavyweight(let sourceVersion, _):
case .heavyweight(let sourceVersion, _):
return sourceVersion
}
}
@@ -73,13 +73,13 @@ public enum MigrationType: BooleanType, Hashable {
switch self {
case .None(let version):
case .none(let version):
return version
case .Lightweight(_, let destinationVersion):
case .lightweight(_, let destinationVersion):
return destinationVersion
case .Heavyweight(_, let destinationVersion):
case .heavyweight(_, let destinationVersion):
return destinationVersion
}
}
@@ -89,7 +89,7 @@ public enum MigrationType: BooleanType, Hashable {
*/
public var isLightweightMigration: Bool {
if case .Lightweight = self {
if case .lightweight = self {
return true
}
@@ -101,7 +101,7 @@ public enum MigrationType: BooleanType, Hashable {
*/
public var isHeavyweightMigration: Bool {
if case .Heavyweight = self {
if case .heavyweight = self {
return true
}
@@ -115,9 +115,9 @@ public enum MigrationType: BooleanType, Hashable {
switch self {
case .None: return false
case .Lightweight: return true
case .Heavyweight: return true
case .none: return false
case .lightweight: return true
case .heavyweight: return true
}
}
@@ -129,13 +129,13 @@ public enum MigrationType: BooleanType, Hashable {
let preHash = self.boolValue.hashValue ^ self.isHeavyweightMigration.hashValue
switch self {
case .None(let version):
case .none(let version):
return preHash ^ version.hashValue
case .Lightweight(let sourceVersion, let destinationVersion):
case .lightweight(let sourceVersion, let destinationVersion):
return preHash ^ sourceVersion.hashValue ^ destinationVersion.hashValue
case .Heavyweight(let sourceVersion, let destinationVersion):
case .heavyweight(let sourceVersion, let destinationVersion):
return preHash ^ sourceVersion.hashValue ^ destinationVersion.hashValue
}
}
@@ -149,13 +149,13 @@ public func == (lhs: MigrationType, rhs: MigrationType) -> Bool {
switch (lhs, rhs) {
case (.None(let version1), .None(let version2)):
case (.none(let version1), .none(let version2)):
return version1 == version2
case (.Lightweight(let source1, let destination1), .Lightweight(let source2, let destination2)):
case (.lightweight(let source1, let destination1), .lightweight(let source2, let destination2)):
return source1 == source2 && destination1 == destination2
case (.Heavyweight(let source1, let destination1), .Heavyweight(let source2, let destination2)):
case (.heavyweight(let source1, let destination1), .heavyweight(let source2, let destination2)):
return source1 == source2 && destination1 == destination2
default:
+21 -21
View File
@@ -60,17 +60,17 @@ import CoreData
)
```
*/
public enum SetupResult<T: StorageInterface>: BooleanType, Hashable {
public enum SetupResult<T: StorageInterface>: Boolean, Hashable {
/**
`SetupResult.Success` indicates that the storage setup succeeded. The associated object for this `enum` value is the related `StorageInterface` instance.
*/
case Success(T)
case success(T)
/**
`SetupResult.Failure` indicates that the storage setup failed. The associated object for this value is the related `CoreStoreError` enum value.
*/
case Failure(CoreStoreError)
case failure(CoreStoreError)
// MARK: BooleanType
@@ -79,8 +79,8 @@ public enum SetupResult<T: StorageInterface>: BooleanType, Hashable {
switch self {
case .Success: return true
case .Failure: return false
case .success: return true
case .failure: return false
}
}
@@ -91,10 +91,10 @@ public enum SetupResult<T: StorageInterface>: BooleanType, Hashable {
switch self {
case .Success(let storage):
case .success(let storage):
return self.boolValue.hashValue ^ ObjectIdentifier(storage).hashValue
case .Failure(let error):
case .failure(let error):
return self.boolValue.hashValue ^ error.hashValue
}
}
@@ -104,17 +104,17 @@ public enum SetupResult<T: StorageInterface>: BooleanType, Hashable {
internal init(_ storage: T) {
self = .Success(storage)
self = .success(storage)
}
internal init(_ error: CoreStoreError) {
self = .Failure(error)
self = .failure(error)
}
internal init(_ error: ErrorType) {
internal init(_ error: ErrorProtocol) {
self = .Failure(CoreStoreError(error))
self = .failure(CoreStoreError(error))
}
}
@@ -126,10 +126,10 @@ public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, r
switch (lhs, rhs) {
case (.Success(let storage1), .Success(let storage2)):
case (.success(let storage1), .success(let storage2)):
return storage1 === storage2
case (.Failure(let error1), .Failure(let error2)):
case (.failure(let error1), .failure(let error2)):
return error1 == error2
default:
@@ -143,18 +143,18 @@ public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, r
/**
Deprecated. Replaced by `SetupResult<T>` when using the new `addStorage(_:completion:)` method variants.
*/
@available(*, deprecated=2.0.0, message="Replaced by SetupResult by using the new addStorage(_:completion:) method variants.")
public enum PersistentStoreResult: BooleanType {
@available(*, deprecated: 2.0.0, message: "Replaced by SetupResult by using the new addStorage(_:completion:) method variants.")
public enum PersistentStoreResult: Boolean {
/**
Deprecated. Replaced by `SetupResult.Success` when using the new `addStorage(_:completion:)` method variants.
*/
case Success(NSPersistentStore)
case success(NSPersistentStore)
/**
Deprecated. Replaced by `SetupResult.Failure` when using the new `addStorage(_:completion:)` method variants.
*/
case Failure(NSError)
case failure(NSError)
// MARK: BooleanType
@@ -163,8 +163,8 @@ public enum PersistentStoreResult: BooleanType {
switch self {
case .Success: return true
case .Failure: return false
case .success: return true
case .failure: return false
}
}
@@ -173,11 +173,11 @@ public enum PersistentStoreResult: BooleanType {
internal init(_ store: NSPersistentStore) {
self = .Success(store)
self = .success(store)
}
internal init(_ error: NSError) {
self = .Failure(error)
self = .failure(error)
}
}
@@ -43,7 +43,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
*/
@objc
public func commitWithCompletion(completion: ((result: CSSaveResult) -> Void)?) {
public func commitWithCompletion(_ completion: ((result: CSSaveResult) -> Void)?) {
self.bridgeToSwift.commit { (result) in
@@ -58,7 +58,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- 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? {
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
return bridge {
@@ -87,7 +87,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public override func createInto(into: CSInto) -> AnyObject {
public override func createInto(_ into: CSInto) -> AnyObject {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -100,7 +100,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public override func editObject(object: NSManagedObject?) -> AnyObject? {
public override func editObject(_ object: NSManagedObject?) -> AnyObject? {
return self.bridgeToSwift.edit(object)
}
@@ -114,7 +114,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}
@@ -125,7 +125,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- parameter object: the `NSManagedObject` type to be deleted
*/
@objc
public override func deleteObject(object: NSManagedObject?) {
public override func deleteObject(_ object: NSManagedObject?) {
self.bridgeToSwift.delete(object)
}
@@ -136,7 +136,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- parameter objects: the `NSManagedObject`s type to be deleted
*/
@objc
public override func deleteObjects(objects: [NSManagedObject]) {
public override func deleteObjects(_ objects: [NSManagedObject]) {
self.bridgeToSwift.delete(objects)
}
@@ -39,11 +39,11 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
do {
return try self.bridgeToSwift.context.existingObjectWithID(object.objectID)
return try self.bridgeToSwift.context.existingObject(with: object.objectID)
}
catch _ {
@@ -59,11 +59,11 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
do {
return try self.bridgeToSwift.context.existingObjectWithID(objectID)
return try self.bridgeToSwift.context.existingObject(with: objectID)
}
catch _ {
@@ -79,9 +79,9 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchExistingObjects(objects: [NSManagedObject]) -> [AnyObject] {
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
return objects.flatMap { try? self.bridgeToSwift.context.existingObjectWithID($0.objectID) }
return objects.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0.objectID) }
}
/**
@@ -92,9 +92,9 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
return objectIDs.flatMap { try? self.bridgeToSwift.context.existingObjectWithID($0) }
return objectIDs.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0) }
}
/**
@@ -106,7 +106,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -124,7 +124,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -142,7 +142,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -160,7 +160,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -181,7 +181,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func queryValueFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -202,7 +202,7 @@ public extension CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func queryAttributesFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
+12 -12
View File
@@ -55,7 +55,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public func createInto(into: CSInto) -> AnyObject {
public func createInto(_ into: CSInto) -> AnyObject {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -68,7 +68,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func editObject(object: NSManagedObject?) -> AnyObject? {
public func editObject(_ object: NSManagedObject?) -> AnyObject? {
return self.bridgeToSwift.edit(object)
}
@@ -82,7 +82,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}
@@ -93,7 +93,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- parameter object: the `NSManagedObject` to be deleted
*/
@objc
public func deleteObject(object: NSManagedObject?) {
public func deleteObject(_ object: NSManagedObject?) {
self.bridgeToSwift.delete(object)
}
@@ -104,7 +104,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- parameter objects: the `NSManagedObject`s to be deleted
*/
@objc
public func deleteObjects(objects: [NSManagedObject]) {
public func deleteObjects(_ objects: [NSManagedObject]) {
self.bridgeToSwift.delete(objects)
}
@@ -141,7 +141,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func insertedObjectsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObject> {
public func insertedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject> {
return self.bridgeToSwift.insertedObjects(entity)
}
@@ -166,7 +166,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func insertedObjectIDsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
public func insertedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
return self.bridgeToSwift.insertedObjectIDs(entity)
}
@@ -191,7 +191,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func updatedObjectsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObject> {
public func updatedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject> {
return self.bridgeToSwift.updatedObjects(entity)
}
@@ -216,7 +216,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func updatedObjectIDsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
public func updatedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
return self.bridgeToSwift.updatedObjectIDs(entity)
}
@@ -241,7 +241,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func deletedObjectsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObject> {
public func deletedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject> {
return self.bridgeToSwift.deletedObjects(entity)
}
@@ -267,7 +267,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func deletedObjectIDsOfType(entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
public func deletedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID> {
return self.bridgeToSwift.deletedObjectIDs(entity)
}
@@ -280,7 +280,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
return ObjectIdentifier(self.bridgeToSwift).hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSBaseDataTransaction else {
+3 -3
View File
@@ -38,7 +38,7 @@ import CoreData
public protocol CSFetchClause {
@objc
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>)
}
@@ -53,7 +53,7 @@ public protocol CSFetchClause {
public protocol CSQueryClause {
@objc
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>)
}
@@ -68,5 +68,5 @@ public protocol CSQueryClause {
public protocol CSDeleteClause {
@objc
func applyToFetchRequest(fetchRequest: NSFetchRequest)
func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>)
}
@@ -48,7 +48,7 @@ public extension CSCoreStore {
- parameter storage: the `CSInMemoryStore` instance
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `CSSetupResult` argument indicates the result. This closure is NOT executed if an error is thrown, but will be executed with a failure `CSSetupResult` result if an error occurs asynchronously.
*/
public static func addInMemoryStorage(storage: CSInMemoryStore, completion: (CSSetupResult) -> Void) {
public static func addInMemoryStorage(_ storage: CSInMemoryStore, completion: (CSSetupResult) -> Void) {
self.defaultStack.addInMemoryStorage(storage, completion: completion)
}
@@ -74,7 +74,7 @@ public extension CSCoreStore {
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
- returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
*/
public static func addSQLiteStorage(storage: CSSQLiteStore, completion: (CSSetupResult) -> Void, error: NSErrorPointer) -> NSProgress? {
public static func addSQLiteStorage(_ storage: CSSQLiteStore, completion: (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
return self.defaultStack.addSQLiteStorage(storage, completion: completion, error: error)
}
@@ -88,7 +88,7 @@ public extension CSCoreStore {
- returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
*/
@objc
public static func upgradeStorageIfNeeded(storage: CSSQLiteStore, completion: (CSMigrationResult) -> Void, error: NSErrorPointer) -> NSProgress? {
public static func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
return self.defaultStack.upgradeStorageIfNeeded(storage, completion: completion, error: error)
}
@@ -102,7 +102,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func requiredMigrationsForSQLiteStore(storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
public static func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
return self.defaultStack.requiredMigrationsForSQLiteStore(storage, error: error)
}
@@ -41,7 +41,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func monitorObject(object: NSManagedObject) -> CSObjectMonitor {
public static func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
return self.defaultStack.monitorObject(object)
}
@@ -55,7 +55,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func monitorListFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
public static func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
return self.defaultStack.monitorListFrom(from, fetchClauses: fetchClauses)
}
@@ -68,7 +68,7 @@ public extension CSCoreStore {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public static func monitorListByCreatingAsynchronously(createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
public static func monitorListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
return self.defaultStack.monitorListByCreatingAsynchronously(
createAsynchronously,
@@ -87,7 +87,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func monitorSectionedListFrom(from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
public static func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
return self.defaultStack.monitorSectionedListFrom(
from,
@@ -105,7 +105,7 @@ public extension CSCoreStore {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public static func monitorSectionedListByCreatingAsynchronously(createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
public static func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
self.defaultStack.monitorSectionedListByCreatingAsynchronously(
createAsynchronously,
+11 -11
View File
@@ -39,7 +39,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
public static func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
return self.defaultStack.fetchExistingObject(object)
}
@@ -52,7 +52,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
return self.defaultStack.fetchExistingObjectWithID(objectID)
}
@@ -65,7 +65,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchExistingObjects(objects: [NSManagedObject]) -> [AnyObject] {
public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
return self.defaultStack.fetchExistingObjects(objects)
}
@@ -78,7 +78,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs)
}
@@ -92,7 +92,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
}
@@ -106,7 +106,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
return self.defaultStack.fetchAllFrom(from, fetchClauses: fetchClauses)
}
@@ -120,7 +120,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
public static func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
return self.defaultStack.fetchCountFrom(from, fetchClauses: fetchClauses)
}
@@ -134,7 +134,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
public static func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
return self.defaultStack.fetchObjectIDFrom(from, fetchClauses: fetchClauses)
}
@@ -148,7 +148,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func fetchObjectIDsFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
public static func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
return self.defaultStack.fetchObjectIDsFrom(from, fetchClauses: fetchClauses)
}
@@ -165,7 +165,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func queryValueFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
return self.defaultStack.queryValueFrom(from, selectClause: selectClause, queryClauses: queryClauses)
}
@@ -182,7 +182,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func queryAttributesFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
return self.defaultStack.queryAttributesFrom(from, selectClause: selectClause, queryClauses: queryClauses)
}
+7 -7
View File
@@ -56,7 +56,7 @@ public extension CSCoreStore {
- returns: the `NSManagedObject` class for the given entity name, or `nil` if not found
*/
@objc
public static func entityClassWithName(name: String) -> NSManagedObject.Type? {
public static func entityClassWithName(_ name: String) -> NSManagedObject.Type? {
return CoreStore.entityTypesByName[name]
}
@@ -65,7 +65,7 @@ public extension CSCoreStore {
Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from `defaultStack`'s model.
*/
@objc
public static func entityDescriptionForClass(type: NSManagedObject.Type) -> NSEntityDescription? {
public static func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? {
return CoreStore.entityDescriptionForType(type)
}
@@ -80,7 +80,7 @@ public extension CSCoreStore {
- returns: the `CSInMemoryStore` added to the `defaultStack`
*/
@objc
public static func addInMemoryStorageAndWaitAndReturnError(error: NSErrorPointer) -> CSInMemoryStore? {
public static func addInMemoryStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSInMemoryStore? {
return self.defaultStack.addInMemoryStorageAndWaitAndReturnError(error)
}
@@ -95,7 +95,7 @@ public extension CSCoreStore {
- returns: the `CSSQLiteStore` added to the `defaultStack`
*/
@objc
public static func addSQLiteStorageAndWaitAndReturnError(error: NSErrorPointer) -> CSSQLiteStore? {
public static func addSQLiteStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSSQLiteStore? {
return self.defaultStack.addSQLiteStorageAndWaitAndReturnError(error)
}
@@ -114,7 +114,7 @@ public extension CSCoreStore {
- returns: the `CSInMemoryStore` added to the `defaultStack`
*/
@objc
public static func addInMemoryStorageAndWait(storage: CSInMemoryStore, error: NSErrorPointer) -> CSInMemoryStore? {
public static func addInMemoryStorageAndWait(_ storage: CSInMemoryStore, error: NSErrorPointer) -> CSInMemoryStore? {
return self.defaultStack.addInMemoryStorageAndWait(storage, error: error)
}
@@ -133,8 +133,8 @@ public extension CSCoreStore {
- returns: the `CSSQLiteStore` added to the `defaultStack`
*/
@objc
public static func addSQLiteStorageAndWait(storage: CSSQLiteStore, error: NSErrorPointer) -> CSSQLiteStore? {
public static func addSQLiteStorageAndWait(_ storage: CSSQLiteStore, error: NSErrorPointer) -> CSSQLiteStore? {
return self.defaultStack.addSQLiteStorageAndWait(storage, error: error)
}
}
}
@@ -36,7 +36,7 @@ public extension CSCoreStore {
- 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) {
public static func beginAsynchronous(_ closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
return CoreStore.beginAsynchronous { (transaction) in
@@ -51,7 +51,7 @@ public extension CSCoreStore {
- 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? {
public static func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
return bridge {
@@ -86,7 +86,7 @@ public extension CSCoreStore {
*/
@objc
@warn_unused_result
public static func beginUnsafeWithSupportsUndo(supportsUndo: Bool) -> CSUnsafeDataTransaction {
public static func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
return bridge {
@@ -49,7 +49,7 @@ public extension CSDataStack {
- parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `CSSetupResult` argument indicates the result. This closure is NOT executed if an error is thrown, but will be executed with a failure `CSSetupResult` result if an error occurs asynchronously.
*/
@objc
public func addInMemoryStorage(storage: CSInMemoryStore, completion: (CSSetupResult) -> Void) {
public func addInMemoryStorage(_ storage: CSInMemoryStore, completion: (CSSetupResult) -> Void) {
self.bridgeToSwift.addStorage(
storage.bridgeToSwift,
@@ -79,7 +79,7 @@ public extension CSDataStack {
- returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
*/
@objc
public func addSQLiteStorage(storage: CSSQLiteStore, completion: (CSSetupResult) -> Void, error: NSErrorPointer) -> NSProgress? {
public func addSQLiteStorage(_ storage: CSSQLiteStore, completion: (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
return bridge(error) {
@@ -99,7 +99,7 @@ public extension CSDataStack {
- returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
*/
@objc
public func upgradeStorageIfNeeded(storage: CSSQLiteStore, completion: (CSMigrationResult) -> Void, error: NSErrorPointer) -> NSProgress? {
public func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
return bridge(error) {
@@ -119,11 +119,11 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func requiredMigrationsForSQLiteStore(storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
public func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
return bridge(error) {
try self.bridgeToSwift.requiredMigrationsForStorage(storage.bridgeToSwift)
}
}
}
}
+13 -13
View File
@@ -41,7 +41,7 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func monitorObject(object: NSManagedObject) -> CSObjectMonitor {
public func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
return bridge {
@@ -58,10 +58,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func monitorListFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
public func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to observe objects from \(cs_typeName(self)) outside the main thread."
)
CoreStore.assert(
@@ -76,7 +76,7 @@ public extension CSDataStack {
sectionBy: nil,
applyFetchClauses: { fetchRequest in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest.cs_dynamicCast()) }
}
)
}
@@ -90,10 +90,10 @@ public extension CSDataStack {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public func monitorListByCreatingAsynchronously(createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
public func monitorListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to observe objects from \(cs_typeName(self)) outside the main thread."
)
CoreStore.assert(
@@ -106,7 +106,7 @@ public extension CSDataStack {
sectionBy: nil,
applyFetchClauses: { fetchRequest in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest.cs_dynamicCast()) }
},
createAsynchronously: {
@@ -125,10 +125,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func monitorSectionedListFrom(from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
public func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to observe objects from \(cs_typeName(self)) outside the main thread."
)
CoreStore.assert(
@@ -143,7 +143,7 @@ public extension CSDataStack {
sectionBy: sectionBy.bridgeToSwift,
applyFetchClauses: { fetchRequest in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest.cs_dynamicCast()) }
}
)
}
@@ -157,10 +157,10 @@ public extension CSDataStack {
- parameter sectionBy: a `CSSectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
public func monitorSectionedListByCreatingAsynchronously(createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
public func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to observe objects from \(cs_typeName(self)) outside the main thread."
)
CoreStore.assert(
@@ -173,7 +173,7 @@ public extension CSDataStack {
sectionBy: sectionBy.bridgeToSwift,
applyFetchClauses: { fetchRequest in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest.cs_dynamicCast()) }
},
createAsynchronously: {
+22 -22
View File
@@ -39,11 +39,11 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
do {
return try self.bridgeToSwift.mainContext.existingObjectWithID(object.objectID)
return try self.bridgeToSwift.mainContext.existingObject(with: object.objectID)
}
catch _ {
@@ -59,11 +59,11 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
do {
return try self.bridgeToSwift.mainContext.existingObjectWithID(objectID)
return try self.bridgeToSwift.mainContext.existingObject(with: objectID)
}
catch _ {
@@ -79,9 +79,9 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchExistingObjects(objects: [NSManagedObject]) -> [AnyObject] {
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
return objects.flatMap { try? self.bridgeToSwift.mainContext.existingObjectWithID($0.objectID) }
return objects.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0.objectID) }
}
/**
@@ -92,9 +92,9 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchExistingObjectsWithIDs(objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
return objectIDs.flatMap { try? self.bridgeToSwift.mainContext.existingObjectWithID($0) }
return objectIDs.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0) }
}
/**
@@ -106,10 +106,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchOne(from, fetchClauses)
@@ -124,10 +124,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchAllFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchAll(from, fetchClauses)
@@ -142,10 +142,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchCountFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchCount(from, fetchClauses)
@@ -160,10 +160,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchObjectIDFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchObjectID(from, fetchClauses)
@@ -178,10 +178,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func fetchObjectIDsFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
public func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchObjectIDs(from, fetchClauses)
@@ -199,10 +199,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func queryValueFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.queryValue(from, selectClause, queryClauses)
@@ -220,10 +220,10 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func queryAttributesFrom(from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
CoreStore.assert(
NSThread.isMainThread(),
Thread.isMainThread,
"Attempted to query from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.queryAttributes(from, selectClause, queryClauses)
@@ -36,7 +36,7 @@ public extension CSDataStack {
- 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) {
public func beginAsynchronous(_ closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
return self.bridgeToSwift.beginAsynchronous { (transaction) in
@@ -51,7 +51,7 @@ public extension CSDataStack {
- 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? {
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
return bridge {
@@ -86,7 +86,7 @@ public extension CSDataStack {
*/
@objc
@warn_unused_result
public func beginUnsafeWithSupportsUndo(supportsUndo: Bool) -> CSUnsafeDataTransaction {
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
return bridge {
+13 -13
View File
@@ -54,12 +54,12 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- parameter versionChain: the version strings that indicate the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
*/
@objc
public convenience init(modelName: String?, bundle: NSBundle?, versionChain: [String]?) {
public convenience init(modelName: String?, bundle: Bundle?, versionChain: [String]?) {
self.init(
DataStack(
modelName: modelName ?? DataStack.applicationName,
bundle: bundle ?? NSBundle.mainBundle(),
bundle: bundle ?? Bundle.main,
migrationChain: versionChain.flatMap { MigrationChain($0) } ?? nil
)
)
@@ -73,12 +73,12 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- parameter versionTree: the version strings that indicate the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
*/
@objc
public convenience init(modelName: String?, bundle: NSBundle?, versionTree: [String: String]?) {
public convenience init(modelName: String?, bundle: Bundle?, versionTree: [String: String]?) {
self.init(
DataStack(
modelName: modelName ?? DataStack.applicationName,
bundle: bundle ?? NSBundle.mainBundle(),
bundle: bundle ?? Bundle.main,
migrationChain: versionTree.flatMap { MigrationChain($0) } ?? nil
)
)
@@ -142,7 +142,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` class for the given entity name, or `nil` if not found
*/
@objc
public func entityClassWithName(name: String) -> NSManagedObject.Type? {
public func entityClassWithName(_ name: String) -> NSManagedObject.Type? {
return self.bridgeToSwift.entityTypesByName[name]
}
@@ -151,7 +151,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from stack's model.
*/
@objc
public func entityDescriptionForClass(type: NSManagedObject.Type) -> NSEntityDescription? {
public func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? {
return self.bridgeToSwift.entityDescriptionForType(type)
}
@@ -166,11 +166,11 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- returns: the `CSInMemoryStore` added to the stack
*/
@objc
public func addInMemoryStorageAndWaitAndReturnError(error: NSErrorPointer) -> CSInMemoryStore? {
public func addInMemoryStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSInMemoryStore? {
return bridge(error) {
try self.bridgeToSwift.addStorageAndWait(InMemoryStore)
try self.bridgeToSwift.addStorageAndWait(InMemoryStore.self)
}
}
@@ -184,11 +184,11 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- returns: the `CSSQLiteStore` added to the stack
*/
@objc
public func addSQLiteStorageAndWaitAndReturnError(error: NSErrorPointer) -> CSSQLiteStore? {
public func addSQLiteStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSSQLiteStore? {
return bridge(error) {
try self.bridgeToSwift.addStorageAndWait(SQLiteStore)
try self.bridgeToSwift.addStorageAndWait(SQLiteStore.self)
}
}
@@ -206,7 +206,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- returns: the `CSInMemoryStore` added to the stack
*/
@objc
public func addInMemoryStorageAndWait(storage: CSInMemoryStore, error: NSErrorPointer) -> CSInMemoryStore? {
public func addInMemoryStorageAndWait(_ storage: CSInMemoryStore, error: NSErrorPointer) -> CSInMemoryStore? {
return bridge(error) {
@@ -228,7 +228,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
- returns: the `CSSQLiteStore` added to the stack
*/
@objc
public func addSQLiteStorageAndWait(storage: CSSQLiteStore, error: NSErrorPointer) -> CSSQLiteStore? {
public func addSQLiteStorageAndWait(_ storage: CSSQLiteStore, error: NSErrorPointer) -> CSSQLiteStore? {
return bridge(error) {
@@ -244,7 +244,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
return ObjectIdentifier(self.bridgeToSwift).hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSDataStack else {
+38 -38
View File
@@ -53,7 +53,7 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSError else {
@@ -77,53 +77,53 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
return swift
}
func createSwiftObject(error: CSError) -> CoreStoreError {
func createSwiftObject(_ error: CSError) -> CoreStoreError {
guard error.domain == CoreStoreErrorDomain else {
return .InternalError(NSError: self)
return .internalError(NSError: self)
}
guard let code = CoreStoreErrorCode(rawValue: error.code) else {
return .Unknown
return .unknown
}
let info = error.userInfo
switch code {
case .UnknownError:
return .Unknown
case .unknownError:
return .unknown
case .DifferentPersistentStoreExistsAtURL:
guard case let existingPersistentStoreURL as NSURL = info["existingPersistentStoreURL"] else {
case .differentPersistentStoreExistsAtURL:
guard case let existingPersistentStoreURL as URL = info["existingPersistentStoreURL"] else {
return .Unknown
return .unknown
}
return .DifferentStorageExistsAtURL(existingPersistentStoreURL: existingPersistentStoreURL)
return .differentStorageExistsAtURL(existingPersistentStoreURL: existingPersistentStoreURL)
case .MappingModelNotFound:
guard let localStoreURL = info["localStoreURL"] as? NSURL,
case .mappingModelNotFound:
guard let localStoreURL = info["localStoreURL"] as? URL,
let targetModel = info["targetModel"] as? NSManagedObjectModel,
let targetModelVersion = info["targetModelVersion"] as? String else {
return .Unknown
return .unknown
}
return .MappingModelNotFound(localStoreURL: localStoreURL, targetModel: targetModel, targetModelVersion: targetModelVersion)
return .mappingModelNotFound(localStoreURL: localStoreURL, targetModel: targetModel, targetModelVersion: targetModelVersion)
case .ProgressiveMigrationRequired:
guard let localStoreURL = info["localStoreURL"] as? NSURL else {
case .progressiveMigrationRequired:
guard let localStoreURL = info["localStoreURL"] as? URL else {
return .Unknown
return .unknown
}
return .ProgressiveMigrationRequired(localStoreURL: localStoreURL)
return .progressiveMigrationRequired(localStoreURL: localStoreURL)
case .InternalError:
case .internalError:
guard case let NSError as NSError = info["NSError"] else {
return .Unknown
return .unknown
}
return .InternalError(NSError: NSError)
return .internalError(NSError: NSError)
}
}
@@ -143,32 +143,32 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
let info: [NSObject: AnyObject]
switch swiftValue {
case .Unknown:
code = .UnknownError
case .unknown:
code = .unknownError
info = [:]
case .DifferentStorageExistsAtURL(let existingPersistentStoreURL):
code = .DifferentPersistentStoreExistsAtURL
case .differentStorageExistsAtURL(let existingPersistentStoreURL):
code = .differentPersistentStoreExistsAtURL
info = [
"existingPersistentStoreURL": existingPersistentStoreURL
]
case .MappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
code = .MappingModelNotFound
case .mappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
code = .mappingModelNotFound
info = [
"localStoreURL": localStoreURL,
"targetModel": targetModel,
"targetModelVersion": targetModelVersion
]
case .ProgressiveMigrationRequired(let localStoreURL):
code = .ProgressiveMigrationRequired
case .progressiveMigrationRequired(let localStoreURL):
code = .progressiveMigrationRequired
info = [
"localStoreURL": localStoreURL
]
case .InternalError(let NSError):
code = .InternalError
case .internalError(let NSError):
code = .internalError
info = [
"NSError": NSError
]
@@ -203,27 +203,27 @@ public enum CSErrorCode: Int {
/**
A failure occured because of an unknown error.
*/
case UnknownError
case unknownError
/**
The `NSPersistentStore` could note be initialized because another store existed at the specified `NSURL`.
*/
case DifferentPersistentStoreExistsAtURL
case differentPersistentStoreExistsAtURL
/**
An `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case MappingModelNotFound
case mappingModelNotFound
/**
Progressive migrations are disabled for a store, but an `NSMappingModel` could not be found for a specific source and destination model versions.
*/
case ProgressiveMigrationRequired
case progressiveMigrationRequired
/**
An internal SDK call failed with the specified "NSError" userInfo key.
*/
case InternalError
case internalError
}
@@ -242,7 +242,7 @@ extension CoreStoreError: CoreStoreSwiftType {
// MARK: Internal
internal extension ErrorType {
internal extension ErrorProtocol {
internal var bridgeToSwift: CoreStoreError {
@@ -250,7 +250,7 @@ internal extension ErrorType {
case let error as CoreStoreError: return error
case let error as CSError: return error.bridgeToSwift
default: return .Unknown
default: return .unknown
}
}
+2 -2
View File
@@ -76,7 +76,7 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSGroupBy else {
@@ -94,7 +94,7 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
// MARK: CSQueryClause
@objc
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) {
self.bridgeToSwift.applyToFetchRequest(fetchRequest)
}
+1 -1
View File
@@ -92,7 +92,7 @@ public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjec
return ObjectIdentifier(self.bridgeToSwift).hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSInMemoryStore else {
+1 -1
View File
@@ -95,7 +95,7 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSInto else {
+20 -20
View File
@@ -60,7 +60,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index, or `nil` if out of bounds
*/
@objc
public func objectAtSafeIndex(index: Int) -> AnyObject? {
public func objectAtSafeIndex(_ index: Int) -> AnyObject? {
return self.bridgeToSwift[safeIndex: index]
}
@@ -73,7 +73,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified section and item index
*/
@objc
public func objectAtSectionIndex(sectionIndex: Int, itemIndex: Int) -> AnyObject {
public func objectAtSectionIndex(_ sectionIndex: Int, itemIndex: Int) -> AnyObject {
return self.bridgeToSwift[sectionIndex, itemIndex]
}
@@ -86,7 +86,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified section and item index, or `nil` if out of bounds
*/
@objc
public func objectAtSafeSectionIndex(sectionIndex: Int, safeItemIndex itemIndex: Int) -> AnyObject? {
public func objectAtSafeSectionIndex(_ sectionIndex: Int, safeItemIndex itemIndex: Int) -> AnyObject? {
return self.bridgeToSwift[safeSectionIndex: sectionIndex, safeItemIndex: itemIndex]
}
@@ -98,7 +98,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index path
*/
@objc
public func objectAtIndexPath(indexPath: NSIndexPath) -> AnyObject {
public func objectAtIndexPath(_ indexPath: IndexPath) -> AnyObject {
return self.bridgeToSwift[indexPath]
}
@@ -110,7 +110,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index path, or `nil` if out of bounds
*/
@objc
public func objectAtSafeIndexPath(indexPath: NSIndexPath) -> AnyObject? {
public func objectAtSafeIndexPath(_ indexPath: IndexPath) -> AnyObject? {
return self.bridgeToSwift[safeIndexPath: indexPath]
}
@@ -135,7 +135,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func hasObjectsInSection(section: Int) -> Bool {
public func hasObjectsInSection(_ section: Int) -> Bool {
return self.bridgeToSwift.hasObjectsInSection(section)
}
@@ -160,7 +160,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func objectsInSection(section: Int) -> [NSManagedObject] {
public func objectsInSection(_ section: Int) -> [NSManagedObject] {
return self.bridgeToSwift.objectsInSection(section)
}
@@ -210,7 +210,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func numberOfObjectsInSection(section: Int) -> Int {
public func numberOfObjectsInSection(_ section: Int) -> Int {
return self.bridgeToSwift.numberOfObjectsInSection(section)
}
@@ -236,7 +236,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func sectionInfoAtIndex(section: Int) -> NSFetchedResultsSectionInfo {
public func sectionInfoAtIndex(_ section: Int) -> NSFetchedResultsSectionInfo {
return self.bridgeToSwift.sectionInfoAtIndex(section)
}
@@ -275,7 +275,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func targetSectionForSectionIndexTitle(title title: String, index: Int) -> Int {
public func targetSectionForSectionIndexTitle(title: String, index: Int) -> Int {
return self.bridgeToSwift.targetSectionForSectionIndex(title: title, index: index)
}
@@ -300,7 +300,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func indexOf(object: NSManagedObject) -> NSNumber? {
public func indexOf(_ object: NSManagedObject) -> NSNumber? {
return self.bridgeToSwift.indexOf(object)
}
@@ -313,7 +313,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
*/
@objc
@warn_unused_result
public func indexPathOf(object: NSManagedObject) -> NSIndexPath? {
public func indexPathOf(_ object: NSManagedObject) -> IndexPath? {
return self.bridgeToSwift.indexPathOf(object)
}
@@ -333,7 +333,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: a `CSListObserver` to send change notifications to
*/
@objc
public func addListObserver(observer: CSListObserver) {
public func addListObserver(_ observer: CSListObserver) {
let swift = self.bridgeToSwift
swift.unregisterObserver(observer)
@@ -369,7 +369,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: a `CSListObjectObserver` to send change notifications to
*/
public func addListObjectObserver(observer: CSListObjectObserver) {
public func addListObjectObserver(_ observer: CSListObjectObserver) {
let swift = self.bridgeToSwift
swift.unregisterObserver(observer)
@@ -425,7 +425,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: a `CSListSectionObserver` to send change notifications to
*/
@objc
public func addListSectionObserver(observer: CSListSectionObserver) {
public func addListSectionObserver(_ observer: CSListSectionObserver) {
let swift = self.bridgeToSwift
swift.unregisterObserver(observer)
@@ -488,7 +488,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: a `CSListObserver` to unregister notifications to
*/
@objc
public func removeListObserver(observer: CSListObserver) {
public func removeListObserver(_ observer: CSListObserver) {
self.bridgeToSwift.unregisterObserver(observer)
}
@@ -513,11 +513,11 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses. Note that only specified clauses will be changed; unspecified clauses will use previous values.
*/
@objc
public func refetch(fetchClauses: [CSFetchClause]) {
public func refetch(_ fetchClauses: [CSFetchClause]) {
self.bridgeToSwift.refetch { (fetchRequest) in
self.bridgeToSwift.refetch { (fetchRequest: NSFetchRequest<NSManagedObject>) in
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest.cs_dynamicCast()) }
}
}
@@ -529,7 +529,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSListMonitor else {
+10 -10
View File
@@ -51,7 +51,7 @@ public protocol CSListObserver: class, AnyObject {
- parameter monitor: the `CSListMonitor` monitoring the list being observed
*/
@objc
optional func listMonitorWillChange(monitor: CSListMonitor)
optional func listMonitorWillChange(_ monitor: CSListMonitor)
/**
Handles processing right after a change to the observed list occurs
@@ -59,7 +59,7 @@ public protocol CSListObserver: class, AnyObject {
- parameter monitor: the `CSListMonitor` monitoring the object being observed
*/
@objc
optional func listMonitorDidChange(monitor: CSListMonitor)
optional func listMonitorDidChange(_ monitor: CSListMonitor)
/**
This method is broadcast from within the `CSListMonitor`'s `-refetchWithFetchClauses:` method to let observers prepare for the internal `NSFetchedResultsController`'s pending change to its predicate, sort descriptors, etc. Note that the actual refetch will happen after the `NSFetchedResultsController`'s last `-controllerDidChangeContent:` notification completes.
@@ -67,7 +67,7 @@ public protocol CSListObserver: class, AnyObject {
- parameter monitor: the `CSListMonitor` monitoring the object being observed
*/
@objc
optional func listMonitorWillRefetch(monitor: CSListMonitor)
optional func listMonitorWillRefetch(_ monitor: CSListMonitor)
/**
After the `CSListMonitor`'s `-refetchWithFetchClauses:` method is called, this method is broadcast after the `NSFetchedResultsController`'s last `-controllerDidChangeContent:` notification completes.
@@ -75,7 +75,7 @@ public protocol CSListObserver: class, AnyObject {
- parameter monitor: the `CSListMonitor` monitoring the object being observed
*/
@objc
optional func listMonitorDidRefetch(monitor: CSListMonitor)
optional func listMonitorDidRefetch(_ monitor: CSListMonitor)
}
@@ -103,7 +103,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the new `NSIndexPath` for the inserted object
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didInsertObject object: AnyObject, toIndexPath indexPath: NSIndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: AnyObject, toIndexPath indexPath: IndexPath)
/**
Notifies that an object was deleted from the specified `NSIndexPath` in the list
@@ -113,7 +113,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the `NSIndexPath` for the deleted object
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didDeleteObject object: AnyObject, fromIndexPath indexPath: NSIndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: AnyObject, fromIndexPath indexPath: IndexPath)
/**
Notifies that an object at the specified `NSIndexPath` was updated
@@ -123,7 +123,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the `NSIndexPath` for the updated object
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didUpdateObject object: AnyObject, atIndexPath indexPath: NSIndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: AnyObject, atIndexPath indexPath: IndexPath)
/**
Notifies that an object's index changed
@@ -134,7 +134,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter toIndexPath: the new `NSIndexPath` for the moved object
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didMoveObject object: AnyObject, fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didMoveObject object: AnyObject, fromIndexPath: IndexPath, toIndexPath: IndexPath)
}
@@ -163,7 +163,7 @@ public protocol CSListSectionObserver: CSListObjectObserver {
- parameter sectionIndex: the new section index for the new section
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int)
optional func listMonitor(_ monitor: CSListMonitor, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int)
/**
Notifies that a section was inserted at the specified index
@@ -173,7 +173,7 @@ public protocol CSListSectionObserver: CSListObjectObserver {
- parameter sectionIndex: the previous section index for the deleted section
*/
@objc
optional func listMonitor(monitor: CSListMonitor, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int)
optional func listMonitor(_ monitor: CSListMonitor, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int)
}
#endif
+10 -10
View File
@@ -61,7 +61,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
@objc
public var migrationTypes: [CSMigrationType]? {
guard case .Success(let migrationTypes) = self.bridgeToSwift else {
guard case .success(let migrationTypes) = self.bridgeToSwift else {
return nil
}
@@ -74,7 +74,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
@objc
public var error: NSError? {
guard case .Failure(let error) = self.bridgeToSwift else {
guard case .failure(let error) = self.bridgeToSwift else {
return nil
}
@@ -90,14 +90,14 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleSuccess(@noescape success: (migrationTypes: [CSMigrationType]) -> Void, @noescape failure: (error: NSError) -> Void) {
public func handleSuccess(@noescape _ success: (migrationTypes: [CSMigrationType]) -> Void, @noescape failure: (error: NSError) -> Void) {
switch self.bridgeToSwift {
case .Success(let migrationTypes):
case .success(let migrationTypes):
success(migrationTypes: migrationTypes.map { $0.bridgeToObjectiveC })
case .Failure(let error):
case .failure(let error):
failure(error: error.bridgeToObjectiveC)
}
}
@@ -110,9 +110,9 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
- parameter success: the block to execute on success. The block passes an array of `CSMigrationType`s that indicates the migration steps completed.
*/
@objc
public func handleSuccess(@noescape success: (migrationTypes: [CSMigrationType]) -> Void) {
public func handleSuccess(@noescape _ success: (migrationTypes: [CSMigrationType]) -> Void) {
guard case .Success(let migrationTypes) = self.bridgeToSwift else {
guard case .success(let migrationTypes) = self.bridgeToSwift else {
return
}
@@ -127,9 +127,9 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleFailure(@noescape failure: (error: NSError) -> Void) {
public func handleFailure(@noescape _ failure: (error: NSError) -> Void) {
guard case .Failure(let error) = self.bridgeToSwift else {
guard case .failure(let error) = self.bridgeToSwift else {
return
}
@@ -144,7 +144,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSMigrationResult else {
+1 -1
View File
@@ -90,7 +90,7 @@ public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSMigrationType else {
+3 -3
View File
@@ -66,7 +66,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: an `CSObjectObserver` to send change notifications to
*/
public func addObjectObserver(observer: CSObjectObserver) {
public func addObjectObserver(_ observer: CSObjectObserver) {
let swift = self.bridgeToSwift
swift.unregisterObserver(observer)
@@ -94,7 +94,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
- parameter observer: an `CSObjectObserver` to unregister notifications to
*/
public func removeObjectObserver(observer: CSObjectObserver) {
public func removeObjectObserver(_ observer: CSObjectObserver) {
self.bridgeToSwift.unregisterObserver(observer)
}
@@ -107,7 +107,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSObjectMonitor else {
+3 -3
View File
@@ -50,7 +50,7 @@ public protocol CSObjectObserver: class, AnyObject {
- parameter object: the `NSManagedObject` instance being observed
*/
@objc
optional func objectMonitor(monitor: CSObjectMonitor, willUpdateObject object: AnyObject)
optional func objectMonitor(_ monitor: CSObjectMonitor, willUpdateObject object: AnyObject)
/**
Handles processing right after a change to the observed `object` occurs
@@ -60,7 +60,7 @@ public protocol CSObjectObserver: class, AnyObject {
- parameter changedPersistentKeys: an `NSSet` of key paths for the attributes that were changed. Note that `changedPersistentKeys` only contains keys for attributes/relationships present in the persistent store, thus transient properties will not be reported.
*/
@objc
optional func objectMonitor(monitor: CSObjectMonitor, didUpdateObject object: AnyObject, changedPersistentKeys: Set<String>)
optional func objectMonitor(_ monitor: CSObjectMonitor, didUpdateObject object: AnyObject, changedPersistentKeys: Set<String>)
/**
Handles processing right after `object` is deleted
@@ -69,7 +69,7 @@ public protocol CSObjectObserver: class, AnyObject {
- parameter object: the `NSManagedObject` instance being observed
*/
@objc
optional func objectMonitor(monitor: CSObjectMonitor, didDeleteObject object: AnyObject)
optional func objectMonitor(_ monitor: CSObjectMonitor, didDeleteObject object: AnyObject)
}
#endif
+5 -5
View File
@@ -41,7 +41,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
The list of sort descriptors
*/
@objc
public var sortDescriptors: [NSSortDescriptor] {
public var sortDescriptors: [SortDescriptor] {
return self.bridgeToSwift.sortDescriptors
}
@@ -57,7 +57,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
- parameter sortDescriptor: a `NSSortDescriptor`
*/
@objc
public convenience init(sortDescriptor: NSSortDescriptor) {
public convenience init(sortDescriptor: SortDescriptor) {
self.init(OrderBy(sortDescriptor))
}
@@ -73,7 +73,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
- parameter sortDescriptors: an array of `NSSortDescriptor`s
*/
@objc
public convenience init(sortDescriptors: [NSSortDescriptor]) {
public convenience init(sortDescriptors: [SortDescriptor]) {
self.init(OrderBy(sortDescriptors))
}
@@ -86,7 +86,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSOrderBy else {
@@ -104,7 +104,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
// MARK: CSFetchClause, CSQueryClause, CSDeleteClause
@objc
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) {
self.bridgeToSwift.applyToFetchRequest(fetchRequest)
}
+9 -9
View File
@@ -46,13 +46,13 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
- parameter localStorageOptions: When the `CSSQLiteStore` is passed to the `CSDataStack`'s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `CSLocalStorageOptionsNone`.
*/
@objc
public convenience init(fileURL: NSURL, configuration: String?, mappingModelBundles: [NSBundle]?, localStorageOptions: Int) {
public convenience init(fileURL: URL, configuration: String?, mappingModelBundles: [Bundle]?, localStorageOptions: Int) {
self.init(
SQLiteStore(
fileURL: fileURL,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
mappingModelBundles: mappingModelBundles ?? Bundle.allBundles,
localStorageOptions: LocalStorageOptions(rawValue: localStorageOptions)
)
)
@@ -68,13 +68,13 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
- parameter localStorageOptions: When the `CSSQLiteStore` is passed to the `CSDataStack`'s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `[CSLocalStorageOptions none]`.
*/
@objc
public convenience init(fileName: String, configuration: String?, mappingModelBundles: [NSBundle]?, localStorageOptions: Int) {
public convenience init(fileName: String, configuration: String?, mappingModelBundles: [Bundle]?, localStorageOptions: Int) {
self.init(
SQLiteStore(
fileName: fileName,
configuration: configuration,
mappingModelBundles: mappingModelBundles ?? NSBundle.allBundles(),
mappingModelBundles: mappingModelBundles ?? Bundle.allBundles,
localStorageOptions: LocalStorageOptions(rawValue: localStorageOptions)
)
)
@@ -98,16 +98,16 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
The `NSURL` that points to the SQLite file
*/
@objc
public var fileURL: NSURL {
public var fileURL: URL {
return self.bridgeToSwift.fileURL
return self.bridgeToSwift.fileURL as URL
}
/**
The `NSBundle`s from which to search mapping models for migrations
*/
@objc
public var mappingModelBundles: [NSBundle] {
public var mappingModelBundles: [Bundle] {
return self.bridgeToSwift.mappingModelBundles
}
@@ -154,7 +154,7 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
Called by the `CSDataStack` to perform actual deletion of the store file from disk. Do not call directly! The `sourceModel` argument is a hint for the existing store's model version. For `CSSQLiteStore`, this converts the database's WAL journaling mode to DELETE before deleting the file.
*/
@objc
public func eraseStorageAndWait(soureModel soureModel: NSManagedObjectModel, error: NSErrorPointer) -> Bool {
public func eraseStorageAndWait(soureModel: NSManagedObjectModel, error: NSErrorPointer) -> Bool {
return bridge(error) {
@@ -170,7 +170,7 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
return ObjectIdentifier(self.bridgeToSwift).hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSSQLiteStore else {
+10 -10
View File
@@ -61,7 +61,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
@objc
public var hasChanges: Bool {
guard case .Success(let hasChanges) = self.bridgeToSwift else {
guard case .success(let hasChanges) = self.bridgeToSwift else {
return false
}
@@ -74,7 +74,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
@objc
public var error: NSError? {
guard case .Failure(let error) = self.bridgeToSwift else {
guard case .failure(let error) = self.bridgeToSwift else {
return nil
}
@@ -90,14 +90,14 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleSuccess(@noescape success: (hasChanges: Bool) -> Void, @noescape failure: (error: NSError) -> Void) {
public func handleSuccess(@noescape _ success: (hasChanges: Bool) -> Void, @noescape failure: (error: NSError) -> Void) {
switch self.bridgeToSwift {
case .Success(let hasChanges):
case .success(let hasChanges):
success(hasChanges: hasChanges)
case .Failure(let error):
case .failure(let error):
failure(error: error.bridgeToObjectiveC)
}
}
@@ -110,9 +110,9 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
*/
@objc
public func handleSuccess(@noescape success: (hasChanges: Bool) -> Void) {
public func handleSuccess(@noescape _ success: (hasChanges: Bool) -> Void) {
guard case .Success(let hasChanges) = self.bridgeToSwift else {
guard case .success(let hasChanges) = self.bridgeToSwift else {
return
}
@@ -127,9 +127,9 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleFailure(@noescape failure: (error: NSError) -> Void) {
public func handleFailure(@noescape _ failure: (error: NSError) -> Void) {
guard case .Failure(let error) = self.bridgeToSwift else {
guard case .failure(let error) = self.bridgeToSwift else {
return
}
@@ -144,7 +144,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSSaveResult else {
+2 -2
View File
@@ -46,7 +46,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
*/
@objc
public static func keyPath(sectionKeyPath: KeyPath) -> CSSectionBy {
public static func keyPath(_ sectionKeyPath: KeyPath) -> CSSectionBy {
return self.init(SectionBy(sectionKeyPath))
}
@@ -59,7 +59,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
*/
@objc
public static func keyPath(sectionKeyPath: KeyPath, sectionIndexTransformer: (sectionName: String?) -> String?) -> CSSectionBy {
public static func keyPath(_ sectionKeyPath: KeyPath, sectionIndexTransformer: (sectionName: String?) -> String?) -> CSSectionBy {
return self.init(SectionBy(sectionKeyPath, sectionIndexTransformer))
}
+21 -21
View File
@@ -51,7 +51,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public convenience init(keyPath: KeyPath) {
self.init(.Attribute(keyPath))
self.init(.attribute(keyPath))
}
/**
@@ -67,9 +67,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSelectTerm` to a `CSSelect` clause for querying the average value of an attribute
*/
@objc
public static func average(keyPath: KeyPath, `as` alias: KeyPath?) -> CSSelectTerm {
public static func average(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.Average(keyPath, As: alias))
return self.init(.average(keyPath, As: alias))
}
/**
@@ -85,9 +85,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `SelectTerm` to a `Select` clause for a count query
*/
@objc
public static func count(keyPath: KeyPath, `as` alias: KeyPath?) -> CSSelectTerm {
public static func count(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.Count(keyPath, As: alias))
return self.init(.count(keyPath, As: alias))
}
/**
@@ -103,9 +103,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSelectTerm` to a `CSSelect` clause for querying the maximum value for an attribute
*/
@objc
public static func maximum(keyPath: KeyPath, `as` alias: KeyPath?) -> CSSelectTerm {
public static func maximum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.Maximum(keyPath, As: alias))
return self.init(.maximum(keyPath, As: alias))
}
/**
@@ -121,9 +121,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSelectTerm` to a `CSSelect` clause for querying the minimum value for an attribute
*/
@objc
public static func minimum(keyPath: KeyPath, `as` alias: KeyPath?) -> CSSelectTerm {
public static func minimum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.Minimum(keyPath, As: alias))
return self.init(.minimum(keyPath, As: alias))
}
/**
@@ -139,9 +139,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSelectTerm` to a `CSSelect` clause for querying the sum value for an attribute
*/
@objc
public static func sum(keyPath: KeyPath, `as` alias: KeyPath?) -> CSSelectTerm {
public static func sum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.Sum(keyPath, As: alias))
return self.init(.sum(keyPath, As: alias))
}
/**
@@ -158,9 +158,9 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
- returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute
*/
@objc
public static func objectIDAs(alias: KeyPath? = nil) -> CSSelectTerm {
public static func objectIDAs(_ alias: KeyPath? = nil) -> CSSelectTerm {
return self.init(.ObjectID(As: alias))
return self.init(.objectID(As: alias))
}
@@ -171,7 +171,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
return self.bridgeToSwift.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSSelectTerm else {
@@ -274,7 +274,7 @@ public final class CSSelect: NSObject {
*/
public convenience init(dateTerm: CSSelectTerm) {
self.init(Select<NSDate>(dateTerm.bridgeToSwift))
self.init(Select<Date>(dateTerm.bridgeToSwift))
}
/**
@@ -290,7 +290,7 @@ public final class CSSelect: NSObject {
*/
public convenience init(dataTerm: CSSelectTerm) {
self.init(Select<NSData>(dataTerm.bridgeToSwift))
self.init(Select<Data>(dataTerm.bridgeToSwift))
}
/**
@@ -306,7 +306,7 @@ public final class CSSelect: NSObject {
*/
public convenience init(objectIDTerm: ()) {
self.init(Select<NSManagedObjectID>(.ObjectID()))
self.init(Select<NSManagedObjectID>(.objectID()))
}
/**
@@ -320,7 +320,7 @@ public final class CSSelect: NSObject {
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
- returns: a `CSSelect` clause for querying an entity attribute
*/
public static func dictionaryForTerm(term: CSSelectTerm) -> CSSelect {
public static func dictionaryForTerm(_ term: CSSelectTerm) -> CSSelect {
return self.init(Select<NSDictionary>(term.bridgeToSwift))
}
@@ -339,7 +339,7 @@ public final class CSSelect: NSObject {
- parameter terms: the `CSSelectTerm`s specifying the attribute/aggregate values to query
- returns: a `CSSelect` clause for querying an entity attribute
*/
public static func dictionaryForTerms(terms: [CSSelectTerm]) -> CSSelect {
public static func dictionaryForTerms(_ terms: [CSSelectTerm]) -> CSSelect {
return self.init(Select<NSDictionary>(terms.map { $0.bridgeToSwift }))
}
@@ -353,7 +353,7 @@ public final class CSSelect: NSObject {
^ self.selectTerms.map { $0.hashValue }.reduce(0, combine: ^)
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSSelect else {
@@ -381,7 +381,7 @@ public final class CSSelect: NSObject {
public init<T: SelectResultType>(_ swiftValue: Select<T>) {
self.attributeType = .UndefinedAttributeType
self.attributeType = .undefinedAttributeType
self.selectTerms = swiftValue.selectTerms
self.bridgeToSwift = swiftValue
super.init()
+6 -6
View File
@@ -76,7 +76,7 @@ public final class CSSetupResult: NSObject {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleSuccess(@noescape success: (storage: CSStorageInterface) -> Void, @noescape failure: (error: NSError) -> Void) {
public func handleSuccess(@noescape _ success: (storage: CSStorageInterface) -> Void, @noescape failure: (error: NSError) -> Void) {
if let storage = self.storage {
@@ -96,7 +96,7 @@ public final class CSSetupResult: NSObject {
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
*/
@objc
public func handleSuccess(@noescape success: (storage: CSStorageInterface) -> Void) {
public func handleSuccess(@noescape _ success: (storage: CSStorageInterface) -> Void) {
guard let storage = self.storage else {
@@ -113,7 +113,7 @@ public final class CSSetupResult: NSObject {
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
*/
@objc
public func handleFailure(@noescape failure: (error: NSError) -> Void) {
public func handleFailure(@noescape _ failure: (error: NSError) -> Void) {
guard let error = self.error else {
@@ -134,7 +134,7 @@ public final class CSSetupResult: NSObject {
return self.isSuccess.hashValue ^ self.error!.hashValue
}
public override func isEqual(object: AnyObject?) -> Bool {
public override func isEqual(_ object: AnyObject?) -> Bool {
guard let object = object as? CSSetupResult else {
@@ -156,11 +156,11 @@ public final class CSSetupResult: NSObject {
switch swiftValue {
case .Success(let storage):
case .success(let storage):
self.storage = storage.bridgeToObjectiveC
self.error = nil
case .Failure(let error):
case .failure(let error):
self.storage = nil
self.error = error.bridgeToObjectiveC
}
+7 -7
View File
@@ -70,22 +70,22 @@ public enum CSLocalStorageOptions: Int {
/**
Tells the `DataStack` that the store should not be migrated or recreated, and should simply fail on model mismatch
*/
case None = 0
case none = 0
/**
Tells the `DataStack` to delete and recreate the store on model mismatch, otherwise exceptions will be thrown on failure instead
*/
case RecreateStoreOnModelMismatch = 1
case recreateStoreOnModelMismatch = 1
/**
Tells the `DataStack` to prevent progressive migrations for the store
*/
case PreventProgressiveMigration = 2
case preventProgressiveMigration = 2
/**
Tells the `DataStack` to allow lightweight migration for the store when added synchronously
*/
case AllowSynchronousLightweightMigration = 4
case allowSynchronousLightweightMigration = 4
}
@@ -103,13 +103,13 @@ public protocol CSLocalStorage: CSStorageInterface {
The `NSURL` that points to the store file
*/
@objc
var fileURL: NSURL { get }
var fileURL: URL { get }
/**
The `NSBundle`s from which to search mapping models for migrations
*/
@objc
var mappingModelBundles: [NSBundle] { get }
var mappingModelBundles: [Bundle] { get }
/**
Options that tell the `CSDataStack` how to setup the persistent store
@@ -121,5 +121,5 @@ public protocol CSLocalStorage: CSStorageInterface {
Called by the `CSDataStack` to perform actual deletion of the store file from disk. Do not call directly! The `sourceModel` argument is a hint for the existing store's model version. Implementers can use the `sourceModel` to perform necessary store operations. (SQLite stores for example, can convert WAL journaling mode to DELETE before deleting)
*/
@objc
func eraseStorageAndWait(soureModel soureModel: NSManagedObjectModel, error: NSErrorPointer) -> Bool
func eraseStorageAndWait(soureModel: NSManagedObjectModel, error: NSErrorPointer) -> Bool
}
@@ -58,7 +58,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- 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? {
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
return bridge {
@@ -87,7 +87,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public override func createInto(into: CSInto) -> AnyObject {
public override func createInto(_ into: CSInto) -> AnyObject {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -100,7 +100,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public override func editObject(object: NSManagedObject?) -> AnyObject? {
public override func editObject(_ object: NSManagedObject?) -> AnyObject? {
return self.bridgeToSwift.edit(object)
}
@@ -114,7 +114,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}
@@ -125,7 +125,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- parameter object: the `NSManagedObject` type to be deleted
*/
@objc
public override func deleteObject(object: NSManagedObject?) {
public override func deleteObject(_ object: NSManagedObject?) {
return self.bridgeToSwift.delete(object)
}
@@ -135,7 +135,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- parameter objects: the `NSManagedObject`s to be deleted
*/
public override func deleteObjects(objects: [NSManagedObject]) {
public override func deleteObjects(_ objects: [NSManagedObject]) {
self.bridgeToSwift.delete(objects)
}
+3 -3
View File
@@ -41,7 +41,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
The block to customize the `NSFetchRequest`
*/
@objc
public var block: (fetchRequest: NSFetchRequest) -> Void {
public var block: (fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void {
return self.bridgeToSwift.closure
}
@@ -53,7 +53,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
- parameter block: the block to customize the `NSFetchRequest`
*/
@objc
public convenience init(block: (fetchRequest: NSFetchRequest) -> Void) {
public convenience init(block: (fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
self.init(Tweak(block))
}
@@ -70,7 +70,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
// MARK: CSFetchClause, CSQueryClause, CSDeleteClause
@objc
public func applyToFetchRequest(fetchRequest: NSFetchRequest) {
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) {
self.bridgeToSwift.applyToFetchRequest(fetchRequest)
}
@@ -43,7 +43,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
*/
@objc
public func commit(completion: ((result: CSSaveResult) -> Void)?) {
public func commit(_ completion: ((result: CSSaveResult) -> Void)?) {
self.bridgeToSwift.commit { (result) in
@@ -110,7 +110,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
- parameter closure: the closure where changes can be made prior to the flush
*/
@objc
public func flush(block: () -> Void) {
public func flush(_ block: () -> Void) {
self.bridgeToSwift.flush {
@@ -142,7 +142,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
*/
@objc
@warn_unused_result
public func beginUnsafeWithSupportsUndo(supportsUndo: Bool) -> CSUnsafeDataTransaction {
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
return bridge {

Some files were not shown because too many files have changed in this diff Show More