diff --git a/Carthage/Checkouts/GCDKit b/Carthage/Checkouts/GCDKit index 3472250..b93656e 160000 --- a/Carthage/Checkouts/GCDKit +++ b/Carthage/Checkouts/GCDKit @@ -1 +1 @@ -Subproject commit 347225011ae8ad0334c8ef63ddd26c26bcc81a73 +Subproject commit b93656e1aa48678a4aae73293160f627bf500e58 diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index 759b0b4..5f15666 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -1420,7 +1420,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "John Rommel Estropia"; TargetAttributes = { 2F03A52F19C5C6DA005002A5 = { @@ -2132,6 +2132,7 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -2188,6 +2189,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = "USE_FRAMEWORKS=1"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -2203,7 +2205,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore; PRODUCT_NAME = CoreStore; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; diff --git a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme index 563c5d8..abd4547 100644 --- a/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme +++ b/CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore OSX.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> + buildForAnalyzing = "NO"> ) { + func listMonitorWillRefetch(_ monitor: ListMonitor) { self.setTable(enabled: false) } - func listMonitorDidRefetch(monitor: ListMonitor) { + func listMonitorDidRefetch(_ monitor: ListMonitor) { self.filterBarButton?.title = Static.filter.rawValue self.tableView.reloadData() diff --git a/CoreStoreDemo/CoreStoreDemo/List and Object Observers Demo/ObjectObserverDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/List and Object Observers Demo/ObjectObserverDemoViewController.swift index e806042..19819af 100644 --- a/CoreStoreDemo/CoreStoreDemo/List and Object Observers Demo/ObjectObserverDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/List and Object Observers Demo/ObjectObserverDemoViewController.swift @@ -58,10 +58,10 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver { CoreStore.beginSynchronous { (transaction) -> Void in - let palette = transaction.create(Into(Palette)) + let palette = transaction.create(Into(Palette.self)) palette.setInitialValues() - transaction.commitAndWait() + _ = transaction.commitAndWait() } let palette = CoreStore.fetchOne(From(), OrderBy(.ascending("hue")))! diff --git a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift index 4260ee1..e2844d0 100644 --- a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift @@ -132,7 +132,7 @@ class MigrationsDemoViewController: UIViewController { @IBOutlet private dynamic weak var progressView: UIProgressView? @IBOutlet private dynamic weak var tableView: UITableView? - @IBAction private dynamic func segmentedControlValueChanged(sender: AnyObject?) { + @IBAction private dynamic func segmentedControlValueChanged(_ sender: AnyObject?) { guard let index = self.segmentedControl?.selectedSegmentIndex else { @@ -275,8 +275,8 @@ class MigrationsDemoViewController: UIViewController { private func reloadTableHeaderWithProgress(_ progress: Progress) { self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true) - self.titleLabel?.text = "Migrating: \(progress.localizedDescription)" - self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription)" + self.titleLabel?.text = "Migrating: \(progress.localizedDescription ?? "")" + self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription ?? "")" } private func updateDisplay(reloadData: Bool, scrollToSelection: Bool, animated: Bool) { @@ -311,7 +311,8 @@ class MigrationsDemoViewController: UIViewController { tableView.layoutIfNeeded() - if let indexPath = self.lastSelectedIndexPath where indexPath.row < tableView.numberOfRows(inSection: 0) { + if let indexPath = self.lastSelectedIndexPath, + indexPath.row < tableView.numberOfRows(inSection: 0) { tableView.selectRow(at: indexPath, animated: scrollToSelection && animated, diff --git a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemo.xcdatamodel/contents b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemo.xcdatamodel/contents index b1f5a2e..0bfb5f2 100644 --- a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemo.xcdatamodel/contents +++ b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemo.xcdatamodel/contents @@ -1,9 +1,9 @@ - + - - - + + + diff --git a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV2.xcdatamodel/contents b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV2.xcdatamodel/contents index dd6f661..cc9fb18 100644 --- a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV2.xcdatamodel/contents +++ b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV2.xcdatamodel/contents @@ -1,10 +1,10 @@ - + - - - - + + + + diff --git a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV3.xcdatamodel/contents b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV3.xcdatamodel/contents index 48509e6..04a1049 100644 --- a/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV3.xcdatamodel/contents +++ b/CoreStoreDemo/CoreStoreDemo/MigrationDemo.xcdatamodeld/MigrationDemoV3.xcdatamodel/contents @@ -1,11 +1,11 @@ - + - - - - - + + + + + diff --git a/CoreStoreDemo/CoreStoreDemo/Stack Setup Demo/StackSetupDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/Stack Setup Demo/StackSetupDemoViewController.swift index ab49a0e..7dbbed2 100644 --- a/CoreStoreDemo/CoreStoreDemo/Stack Setup Demo/StackSetupDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/Stack Setup Demo/StackSetupDemoViewController.swift @@ -100,8 +100,8 @@ private struct Static { class StackSetupDemoViewController: UITableViewController { let accounts = [ - Static.facebookStack.fetchAll(From(UserAccount)) ?? [], - Static.twitterStack.fetchAll(From(UserAccount)) ?? [] + Static.facebookStack.fetchAll(From(UserAccount.self)) ?? [], + Static.twitterStack.fetchAll(From(UserAccount.self)) ?? [] ] diff --git a/CoreStoreDemo/CoreStoreDemo/Transactions Demo/TransactionsDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/Transactions Demo/TransactionsDemoViewController.swift index 4b86181..2b018d0 100644 --- a/CoreStoreDemo/CoreStoreDemo/Transactions Demo/TransactionsDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/Transactions Demo/TransactionsDemoViewController.swift @@ -105,7 +105,7 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec // MARK: MKMapViewDelegate - func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { + func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { let identifier = "MKAnnotationView" var annotationView: MKPinAnnotationView! = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKPinAnnotationView @@ -162,7 +162,9 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec @IBAction dynamic func longPressGestureRecognized(_ sender: AnyObject?) { - if let mapView = self.mapView, let gesture = sender as? UILongPressGestureRecognizer where gesture.state == .began { + if let mapView = self.mapView, + let gesture = sender as? UILongPressGestureRecognizer, + gesture.state == .began { let coordinate = mapView.convert( gesture.location(in: mapView), diff --git a/Sources/Convenience/NSProgress+Convenience.swift b/Sources/Convenience/NSProgress+Convenience.swift index c6ca896..4135086 100644 --- a/Sources/Convenience/NSProgress+Convenience.swift +++ b/Sources/Convenience/NSProgress+Convenience.swift @@ -96,14 +96,14 @@ private final class ProgressObserver: NSObject { self.progress.addObserver( self, - forKeyPath: "fractionCompleted", + forKeyPath: #keyPath(Progress.fractionCompleted), options: [.initial, .new], context: nil ) } else { - self.progress.removeObserver(self, forKeyPath: "fractionCompleted") + self.progress.removeObserver(self, forKeyPath: #keyPath(Progress.fractionCompleted)) } } } @@ -119,15 +119,17 @@ private final class ProgressObserver: NSObject { if let _ = self.progressHandler { self.progressHandler = nil - self.progress.removeObserver(self, forKeyPath: "fractionCompleted") + self.progress.removeObserver(self, forKeyPath: #keyPath(Progress.fractionCompleted)) } } override func observeValue(forKeyPath keyPath: String?, of object: AnyObject?, change: [NSKeyValueChangeKey : AnyObject]?, context: UnsafeMutablePointer?) { - guard let progress = object as? Progress where progress == self.progress && keyPath == "fractionCompleted" else { - - return + guard let progress = object as? Progress, + progress == self.progress, + keyPath == #keyPath(Progress.fractionCompleted) else { + + return } GCDQueue.main.async { [weak self] () -> Void in diff --git a/Sources/Fetching and Querying/Concrete Clauses/From.swift b/Sources/Fetching and Querying/Concrete Clauses/From.swift index 0dca42e..83038f3 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/From.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/From.swift @@ -68,7 +68,6 @@ public struct From { ``` let people = transaction.fetchAll(From()) ``` - - parameter entity: the associated `NSManagedObject` type */ public init(_ entity: T.Type) { @@ -81,7 +80,6 @@ public struct From { ``` let people = transaction.fetchAll(From()) ``` - - parameter entityClass: the associated `NSManagedObject` entity class */ public init(_ entityClass: AnyClass) { @@ -98,7 +96,6 @@ public struct From { ``` let people = transaction.fetchAll(From(nil, "Configuration1")) ``` - - parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter) */ @@ -112,7 +109,6 @@ public struct From { ``` let people = transaction.fetchAll(From(["Configuration1", "Configuration2"])) ``` - - parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ public init(_ configurations: [String?]) { @@ -125,7 +121,6 @@ public struct From { ``` let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1")) ``` - - parameter entity: the associated `NSManagedObject` type - parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter) @@ -140,7 +135,6 @@ public struct From { ``` let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"])) ``` - - parameter entity: the associated `NSManagedObject` type - parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ @@ -154,7 +148,6 @@ public struct From { ``` let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1")) ``` - - parameter entity: the associated `NSManagedObject` entity class - parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. - parameter otherConfigurations: an optional list of other configuration names to associate objects from (see `configuration` parameter) @@ -173,7 +166,6 @@ public struct From { ``` let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"])) ``` - - parameter entity: the associated `NSManagedObject` entity class - parameter configurations: a list of `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ diff --git a/Sources/Fetching and Querying/Concrete Clauses/GroupBy.swift b/Sources/Fetching and Querying/Concrete Clauses/GroupBy.swift index 095cdbd..3723b0b 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/GroupBy.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/GroupBy.swift @@ -73,7 +73,7 @@ public struct GroupBy: QueryClause, Hashable { public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) { - if let keyPaths = fetchRequest.propertiesToGroupBy as? [String] where keyPaths != self.keyPaths { + if let keyPaths = fetchRequest.propertiesToGroupBy as? [String], keyPaths != self.keyPaths { CoreStore.log( .warning, diff --git a/Sources/Fetching and Querying/Concrete Clauses/OrderBy.swift b/Sources/Fetching and Querying/Concrete Clauses/OrderBy.swift index 420fd1a..7063cb2 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/OrderBy.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/OrderBy.swift @@ -140,7 +140,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable { public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) { - if let sortDescriptors = fetchRequest.sortDescriptors where sortDescriptors != self.sortDescriptors { + if let sortDescriptors = fetchRequest.sortDescriptors, sortDescriptors != self.sortDescriptors { CoreStore.log( .warning, diff --git a/Sources/Fetching and Querying/Concrete Clauses/Select.swift b/Sources/Fetching and Querying/Concrete Clauses/Select.swift index b51983d..df8018d 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/Select.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/Select.swift @@ -83,7 +83,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Where("employeeID", isEqualTo: 1111) ) ``` - - parameter keyPath: the attribute name - returns: a `SelectTerm` to a `Select` clause for querying an entity attribute */ @@ -100,7 +99,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Select(.average("age")) ) ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for querying the average value of an attribute @@ -123,7 +121,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Select(.count("employeeID")) ) ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for a count query @@ -146,7 +143,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Select(.maximum("age")) ) ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for querying the maximum value for an attribute @@ -169,7 +165,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Select(.minimum("age")) ) ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for querying the minimum value for an attribute @@ -192,7 +187,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Select(.sum("age")) ) ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for querying the sum value for an attribute @@ -216,7 +210,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable { Where("employeeID", isEqualTo: 1111) ) ``` - - parameter keyPath: the attribute name - 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 @@ -745,9 +738,9 @@ internal extension Collection where Iterator.Element == SelectTerm { fetchRequest.includesPendingChanges = false fetchRequest.resultType = .dictionaryResultType - func attributeDescriptionForKeyPath(keyPath: String, inEntity entity: NSEntityDescription) -> NSAttributeDescription? { + func attributeDescription(for keyPath: String, in entity: NSEntityDescription) -> NSAttributeDescription? { - let components = keyPath.componentsSeparatedByString(".") + let components = keyPath.components(separatedBy: ".") switch components.count { case 0: @@ -761,9 +754,9 @@ internal extension Collection where Iterator.Element == SelectTerm { return nil } - return attributeDescriptionForKeyPath( - components.dropFirst().joinWithSeparator("."), - inEntity: relationship.entity + return attributeDescription( + for: components.dropFirst().joined(separator: "."), + in: relationship.entity ) } } @@ -775,7 +768,7 @@ internal extension Collection where Iterator.Element == SelectTerm { case ._attribute(let keyPath): let entityDescription = fetchRequest.entity! - if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) { + if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) { propertiesToFetch.append(attributeDescription) } @@ -789,7 +782,7 @@ internal extension Collection where Iterator.Element == SelectTerm { case ._aggregate(let function, let keyPath, let alias, let nativeType): let entityDescription = fetchRequest.entity! - if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) { + if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) { let expressionDescription = NSExpressionDescription() expressionDescription.name = alias diff --git a/Sources/Fetching and Querying/Concrete Clauses/Where.swift b/Sources/Fetching and Querying/Concrete Clauses/Where.swift index 7cf8022..836bb37 100644 --- a/Sources/Fetching and Querying/Concrete Clauses/Where.swift +++ b/Sources/Fetching and Querying/Concrete Clauses/Where.swift @@ -145,7 +145,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable { public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) { - if let predicate = fetchRequest.predicate where predicate != self.predicate { + if let predicate = fetchRequest.predicate, predicate != self.predicate { CoreStore.log( .warning, diff --git a/Sources/Importing/BaseDataTransaction+Importing.swift b/Sources/Importing/BaseDataTransaction+Importing.swift index 3abca84..2908488 100644 --- a/Sources/Importing/BaseDataTransaction+Importing.swift +++ b/Sources/Importing/BaseDataTransaction+Importing.swift @@ -220,8 +220,8 @@ public extension BaseDataTransaction { let uniqueIDValue = object.uniqueIDValue - guard let source = mapping.removeValue(forKey: uniqueIDValue) - where T.shouldUpdateFromImportSource(source, inTransaction: self) else { + guard let source = mapping.removeValue(forKey: uniqueIDValue), + T.shouldUpdateFromImportSource(source, inTransaction: self) else { return } diff --git a/Sources/Internal/FetchedResultsControllerDelegate.swift b/Sources/Internal/FetchedResultsControllerDelegate.swift index ca6b34b..291bad3 100644 --- a/Sources/Internal/FetchedResultsControllerDelegate.swift +++ b/Sources/Internal/FetchedResultsControllerDelegate.swift @@ -120,6 +120,24 @@ internal final class FetchedResultsControllerDelegate = [start] var version = start - while let nextVersion = versionTree[version] where nextVersion != version { + while let nextVersion = versionTree[version], nextVersion != version { if checklist.contains(nextVersion) { @@ -236,7 +236,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D internal func nextVersionFrom(_ version: String) -> String? { - guard let nextVersion = self.versionTree[version] where nextVersion != version else { + guard let nextVersion = self.versionTree[version], nextVersion != version else { return nil } @@ -252,7 +252,6 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D // MARK: - MigrationChain: Equatable -@warn_unused_result public func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool { return lhs.versionTree == rhs.versionTree diff --git a/Sources/Migrating/SetupResult.swift b/Sources/Migrating/SetupResult.swift index 5e3cd31..77cbae2 100644 --- a/Sources/Migrating/SetupResult.swift +++ b/Sources/Migrating/SetupResult.swift @@ -135,48 +135,3 @@ public func == (lhs: SetupResult, r return false } } - - -// MARK: - Deprecated - -/** - Deprecated. Replaced by `SetupResult` 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: Boolean { - - /** - Deprecated. Replaced by `SetupResult.success` when using the new `addStorage(_:completion:)` method variants. - */ - case success(NSPersistentStore) - - /** - Deprecated. Replaced by `SetupResult.failure` when using the new `addStorage(_:completion:)` method variants. - */ - case failure(NSError) - - - // MARK: BooleanType - - public var boolValue: Bool { - - switch self { - - case .success: return true - case .failure: return false - } - } - - - // MARK: Internal - - internal init(_ store: NSPersistentStore) { - - self = .success(store) - } - - internal init(_ error: NSError) { - - self = .failure(error) - } -} diff --git a/Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift b/Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift index 1586b91..34f2ed1 100644 --- a/Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift +++ b/Sources/ObjectiveC/CSBaseDataTransaction+Querying.swift @@ -38,7 +38,6 @@ public extension CSBaseDataTransaction { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? { do { @@ -58,7 +57,6 @@ public extension CSBaseDataTransaction { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? { do { @@ -78,7 +76,6 @@ public extension CSBaseDataTransaction { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] { return objects.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0.objectID) } @@ -91,7 +88,6 @@ public extension CSBaseDataTransaction { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] { return objectIDs.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0) } @@ -105,7 +101,6 @@ public extension CSBaseDataTransaction { - returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? { CoreStore.assert( @@ -123,7 +118,6 @@ public extension CSBaseDataTransaction { - returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? { CoreStore.assert( @@ -141,7 +135,6 @@ public extension CSBaseDataTransaction { - returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? { CoreStore.assert( @@ -159,7 +152,6 @@ public extension CSBaseDataTransaction { - returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? { CoreStore.assert( @@ -180,7 +172,6 @@ public extension CSBaseDataTransaction { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? { CoreStore.assert( @@ -201,7 +192,6 @@ public extension CSBaseDataTransaction { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? { CoreStore.assert( diff --git a/Sources/ObjectiveC/CSCoreStore+Migrating.swift b/Sources/ObjectiveC/CSCoreStore+Migrating.swift index 06004ba..ff87270 100644 --- a/Sources/ObjectiveC/CSCoreStore+Migrating.swift +++ b/Sources/ObjectiveC/CSCoreStore+Migrating.swift @@ -44,7 +44,6 @@ public extension CSCoreStore { } error: &error]; ``` - - 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. */ @@ -68,7 +67,6 @@ public extension CSCoreStore { } error: &error]; ``` - - parameter storage: the `CSSQLiteStore` 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. Note that the `CSLocalStorage` associated to the `-[CSSetupResult storage]` may not always be the same instance as the parameter argument if a previous `CSLocalStorage` was already added at the same URL and with the same configuration. - parameter error: the `NSError` pointer that indicates the reason in case of an failure @@ -101,7 +99,6 @@ public extension CSCoreStore { - returns: a `CSMigrationType` array indicating the migration steps required for the store, or an empty array if the file does not exist yet. Otherwise, `nil` is returned and the `error` argument is set if either inspection of the store failed, or if no mapping model was found/inferred. */ @objc - @warn_unused_result public static func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? { return self.defaultStack.requiredMigrationsForSQLiteStore(storage, error: error) diff --git a/Sources/ObjectiveC/CSCoreStore+Observing.swift b/Sources/ObjectiveC/CSCoreStore+Observing.swift index 3f27ce7..dc2b156 100644 --- a/Sources/ObjectiveC/CSCoreStore+Observing.swift +++ b/Sources/ObjectiveC/CSCoreStore+Observing.swift @@ -40,7 +40,6 @@ public extension CSCoreStore { - returns: a `CSObjectMonitor` that monitors changes to `object` */ @objc - @warn_unused_result public static func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor { return self.defaultStack.monitorObject(object) @@ -54,7 +53,6 @@ public extension CSCoreStore { - returns: a `CSListMonitor` instance that monitors changes to the list */ @objc - @warn_unused_result public static func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor { return self.defaultStack.monitorListFrom(from, fetchClauses: fetchClauses) @@ -86,7 +84,6 @@ public extension CSCoreStore { - returns: a `CSListMonitor` instance that monitors changes to the list */ @objc - @warn_unused_result public static func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor { return self.defaultStack.monitorSectionedListFrom( diff --git a/Sources/ObjectiveC/CSCoreStore+Querying.swift b/Sources/ObjectiveC/CSCoreStore+Querying.swift index eb21e5a..d292e11 100644 --- a/Sources/ObjectiveC/CSCoreStore+Querying.swift +++ b/Sources/ObjectiveC/CSCoreStore+Querying.swift @@ -38,7 +38,6 @@ public extension CSCoreStore { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public static func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? { return self.defaultStack.fetchExistingObject(object) @@ -51,7 +50,6 @@ public extension CSCoreStore { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? { return self.defaultStack.fetchExistingObjectWithID(objectID) @@ -64,7 +62,6 @@ public extension CSCoreStore { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] { return self.defaultStack.fetchExistingObjects(objects) @@ -77,7 +74,6 @@ public extension CSCoreStore { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] { return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs) @@ -91,7 +87,6 @@ public extension CSCoreStore { - returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? { return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses) @@ -105,7 +100,6 @@ public extension CSCoreStore { - returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? { return self.defaultStack.fetchAllFrom(from, fetchClauses: fetchClauses) @@ -119,7 +113,6 @@ public extension CSCoreStore { - returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public static func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? { return self.defaultStack.fetchCountFrom(from, fetchClauses: fetchClauses) @@ -133,7 +126,6 @@ public extension CSCoreStore { - returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public static func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? { return self.defaultStack.fetchObjectIDFrom(from, fetchClauses: fetchClauses) @@ -147,7 +139,6 @@ public extension CSCoreStore { - returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public static func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? { return self.defaultStack.fetchObjectIDsFrom(from, fetchClauses: fetchClauses) @@ -164,7 +155,6 @@ public extension CSCoreStore { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? { return self.defaultStack.queryValueFrom(from, selectClause: selectClause, queryClauses: queryClauses) @@ -181,7 +171,6 @@ public extension CSCoreStore { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? { return self.defaultStack.queryAttributesFrom(from, selectClause: selectClause, queryClauses: queryClauses) diff --git a/Sources/ObjectiveC/CSCoreStore+Setup.swift b/Sources/ObjectiveC/CSCoreStore+Setup.swift index 049c91e..1fb3627 100644 --- a/Sources/ObjectiveC/CSCoreStore+Setup.swift +++ b/Sources/ObjectiveC/CSCoreStore+Setup.swift @@ -67,7 +67,7 @@ public extension CSCoreStore { @objc public static func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? { - return CoreStore.entityDescriptionForType(type) + return CoreStore.entityDescription(for: type) } /** @@ -75,7 +75,6 @@ public extension CSCoreStore { ``` CSSQLiteStore *storage = [CSCoreStore addInMemoryStorageAndWaitAndReturnError:&error]; ``` - - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSInMemoryStore` added to the `defaultStack` */ @@ -91,7 +90,6 @@ public extension CSCoreStore { ``` CSSQLiteStore *storage = [CSCoreStore addSQLiteStorageAndWaitAndReturnError:&error]; ``` - - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSSQLiteStore` added to the `defaultStack` */ @@ -110,7 +108,6 @@ public extension CSCoreStore { addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"] error: &error]; ``` - - parameter storage: the `CSInMemoryStore` - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSInMemoryStore` added to the `defaultStack` @@ -130,7 +127,6 @@ public extension CSCoreStore { addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"] error: &error]; ``` - - parameter storage: the `CSSQLiteStore` - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSSQLiteStore` added to the `defaultStack` diff --git a/Sources/ObjectiveC/CSCoreStore+Transaction.swift b/Sources/ObjectiveC/CSCoreStore+Transaction.swift index c793d54..43e037f 100644 --- a/Sources/ObjectiveC/CSCoreStore+Transaction.swift +++ b/Sources/ObjectiveC/CSCoreStore+Transaction.swift @@ -70,7 +70,6 @@ public extension CSCoreStore { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public static func beginUnsafe() -> CSUnsafeDataTransaction { return bridge { @@ -86,7 +85,6 @@ public extension CSCoreStore { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public static func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction { return bridge { diff --git a/Sources/ObjectiveC/CSDataStack+Migrating.swift b/Sources/ObjectiveC/CSDataStack+Migrating.swift index 05a1105..3454789 100644 --- a/Sources/ObjectiveC/CSDataStack+Migrating.swift +++ b/Sources/ObjectiveC/CSDataStack+Migrating.swift @@ -44,7 +44,6 @@ public extension CSDataStack { } error: &error]; ``` - - 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. */ @@ -72,7 +71,6 @@ public extension CSDataStack { } error: &error]; ``` - - parameter storage: the `CSSQLiteStore` 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. Note that the `CSLocalStorage` associated to the `-[CSSetupResult storage]` may not always be the same instance as the parameter argument if a previous `CSLocalStorage` was already added at the same URL and with the same configuration. - parameter error: the `NSError` pointer that indicates the reason in case of an failure @@ -118,7 +116,6 @@ public extension CSDataStack { - returns: a `CSMigrationType` array indicating the migration steps required for the store, or an empty array if the file does not exist yet. Otherwise, `nil` is returned and the `error` argument is set if either inspection of the store failed, or if no mapping model was found/inferred. */ @objc - @warn_unused_result public func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? { return bridge(error) { diff --git a/Sources/ObjectiveC/CSDataStack+Observing.swift b/Sources/ObjectiveC/CSDataStack+Observing.swift index 11c8076..5e15528 100644 --- a/Sources/ObjectiveC/CSDataStack+Observing.swift +++ b/Sources/ObjectiveC/CSDataStack+Observing.swift @@ -40,7 +40,6 @@ public extension CSDataStack { - returns: a `ObjectMonitor` that monitors changes to `object` */ @objc - @warn_unused_result public func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor { return bridge { @@ -57,7 +56,6 @@ public extension CSDataStack { - returns: a `CSListMonitor` instance that monitors changes to the list */ @objc - @warn_unused_result public func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor { CoreStore.assert( @@ -124,7 +122,6 @@ public extension CSDataStack { - returns: a `CSListMonitor` instance that monitors changes to the list */ @objc - @warn_unused_result public func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor { CoreStore.assert( diff --git a/Sources/ObjectiveC/CSDataStack+Querying.swift b/Sources/ObjectiveC/CSDataStack+Querying.swift index d9f48ef..0cb5fe2 100644 --- a/Sources/ObjectiveC/CSDataStack+Querying.swift +++ b/Sources/ObjectiveC/CSDataStack+Querying.swift @@ -38,7 +38,6 @@ public extension CSDataStack { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? { do { @@ -58,7 +57,6 @@ public extension CSDataStack { - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found. */ @objc - @warn_unused_result public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? { do { @@ -78,7 +76,6 @@ public extension CSDataStack { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] { return objects.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0.objectID) } @@ -91,7 +88,6 @@ public extension CSDataStack { - returns: the `NSManagedObject` array for objects that exists in the transaction */ @objc - @warn_unused_result public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] { return objectIDs.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0) } @@ -105,7 +101,6 @@ public extension CSDataStack { - returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? { CoreStore.assert( @@ -123,7 +118,6 @@ public extension CSDataStack { - returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? { CoreStore.assert( @@ -141,7 +135,6 @@ public extension CSDataStack { - returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? { CoreStore.assert( @@ -159,7 +152,6 @@ public extension CSDataStack { - returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? { CoreStore.assert( @@ -177,7 +169,6 @@ public extension CSDataStack { - returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s */ @objc - @warn_unused_result public func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? { CoreStore.assert( @@ -198,7 +189,6 @@ public extension CSDataStack { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? { CoreStore.assert( @@ -219,7 +209,6 @@ public extension CSDataStack { - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter. */ @objc - @warn_unused_result public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? { CoreStore.assert( diff --git a/Sources/ObjectiveC/CSDataStack+Transaction.swift b/Sources/ObjectiveC/CSDataStack+Transaction.swift index b4416b8..d9f7f5d 100644 --- a/Sources/ObjectiveC/CSDataStack+Transaction.swift +++ b/Sources/ObjectiveC/CSDataStack+Transaction.swift @@ -70,7 +70,6 @@ public extension CSDataStack { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public func beginUnsafe() -> CSUnsafeDataTransaction { return bridge { @@ -86,7 +85,6 @@ public extension CSDataStack { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction { return bridge { diff --git a/Sources/ObjectiveC/CSDataStack.swift b/Sources/ObjectiveC/CSDataStack.swift index 9e71d9f..ee5c380 100644 --- a/Sources/ObjectiveC/CSDataStack.swift +++ b/Sources/ObjectiveC/CSDataStack.swift @@ -153,7 +153,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType { @objc public func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? { - return self.bridgeToSwift.entityDescriptionForType(type) + return self.bridgeToSwift.entityDescription(for: type) } /** @@ -161,7 +161,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType { ``` CSSQLiteStore *storage = [dataStack addInMemoryStorageAndWaitAndReturnError:&error]; ``` - - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSInMemoryStore` added to the stack */ @@ -180,7 +179,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType { ``` CSSQLiteStore *storage = [dataStack addSQLiteStorageAndWaitAndReturnError:&error]; ``` - - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSSQLiteStore` added to the stack */ @@ -202,7 +200,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType { addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"] error: &error]; ``` - - parameter storage: the `CSInMemoryStore` - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSInMemoryStore` added to the stack @@ -225,7 +222,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType { addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"] error: &error]; ``` - - parameter storage: the `CSSQLiteStore` - parameter error: the `NSError` pointer that indicates the reason in case of an failure - returns: the `CSSQLiteStore` added to the stack diff --git a/Sources/ObjectiveC/CSFrom.swift b/Sources/ObjectiveC/CSFrom.swift index 2e22bff..7354b76 100644 --- a/Sources/ObjectiveC/CSFrom.swift +++ b/Sources/ObjectiveC/CSFrom.swift @@ -68,7 +68,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType { ``` MyPersonEntity *people = [transaction fetchAllFrom:CSFromClass([MyPersonEntity class])]; ``` - - parameter entityClass: the `NSManagedObject` class type to be created */ @objc @@ -83,7 +82,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType { MyPersonEntity *people = [transaction fetchAllFrom: CSFromClass([MyPersonEntity class], @"Config1")]; ``` - - parameter configuration: the `NSPersistentStore` configuration name to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `[NSNull null]` to use the default configuration. */ @objc @@ -109,7 +107,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType { CSFromClass([MyPersonEntity class], @[[NSNull null], @"Config1"])]; ``` - - parameter entity: the associated `NSManagedObject` entity class - parameter configurations: an array of the `NSPersistentStore` configuration names to associate objects from. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `[NSNull null]` to use the default configuration. */ diff --git a/Sources/ObjectiveC/CSInto.swift b/Sources/ObjectiveC/CSInto.swift index bafeb78..e85cd81 100644 --- a/Sources/ObjectiveC/CSInto.swift +++ b/Sources/ObjectiveC/CSInto.swift @@ -62,7 +62,6 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType { MyPersonEntity *person = [transaction createInto: CSIntoClass([MyPersonEntity class])]; ``` - - parameter entityClass: the `NSManagedObject` class type to be created */ @objc @@ -77,7 +76,6 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType { MyPersonEntity *person = [transaction createInto: CSIntoClass([MyPersonEntity class])]; ``` - - parameter entityClass: the `NSManagedObject` class type to be created - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ diff --git a/Sources/ObjectiveC/CSListMonitor.swift b/Sources/ObjectiveC/CSListMonitor.swift index 7ad6043..391db0c 100644 --- a/Sources/ObjectiveC/CSListMonitor.swift +++ b/Sources/ObjectiveC/CSListMonitor.swift @@ -121,7 +121,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: `YES` if at least one object in any section exists, `NO` otherwise */ @objc - @warn_unused_result public func hasObjects() -> Bool { return self.bridgeToSwift.hasObjects() @@ -134,7 +133,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: `YES` if at least one object in the specified section exists, `NO` otherwise */ @objc - @warn_unused_result public func hasObjectsInSection(_ section: Int) -> Bool { return self.bridgeToSwift.hasObjectsInSection(section) @@ -146,7 +144,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: all objects in all sections */ @objc - @warn_unused_result public func objectsInAllSections() -> [NSManagedObject] { return self.bridgeToSwift.objectsInAllSections() @@ -159,7 +156,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: all objects in the specified section */ @objc - @warn_unused_result public func objectsInSection(_ section: Int) -> [NSManagedObject] { return self.bridgeToSwift.objectsInSection(section) @@ -172,7 +168,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: all objects in the specified section, or `nil` if out of bounds */ @objc - @warn_unused_result public func objectsInSafeSection(safeSectionIndex section: Int) -> [NSManagedObject]? { return self.bridgeToSwift.objectsInSection(safeSectionIndex: section) @@ -184,7 +179,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the number of sections */ @objc - @warn_unused_result public func numberOfSections() -> Int { return self.bridgeToSwift.numberOfSections() @@ -196,7 +190,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the number of objects in all sections */ @objc - @warn_unused_result public func numberOfObjects() -> Int { return self.bridgeToSwift.numberOfObjects() @@ -209,7 +202,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the number of objects in the specified section */ @objc - @warn_unused_result public func numberOfObjectsInSection(_ section: Int) -> Int { return self.bridgeToSwift.numberOfObjectsInSection(section) @@ -222,7 +214,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the number of objects in the specified section, or `nil` if out of bounds */ @objc - @warn_unused_result public func numberOfObjectsInSafeSection(safeSectionIndex section: Int) -> NSNumber? { return self.bridgeToSwift.numberOfObjectsInSection(safeSectionIndex: section) @@ -235,7 +226,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the `NSFetchedResultsSectionInfo` for the specified section */ @objc - @warn_unused_result public func sectionInfoAtIndex(_ section: Int) -> NSFetchedResultsSectionInfo { return self.bridgeToSwift.sectionInfoAtIndex(section) @@ -248,7 +238,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if the section index is out of bounds. */ @objc - @warn_unused_result public func sectionInfoAtSafeSectionIndex(safeSectionIndex section: Int) -> NSFetchedResultsSectionInfo? { return self.bridgeToSwift.sectionInfoAtIndex(safeSectionIndex: section) @@ -260,7 +249,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the `NSFetchedResultsSectionInfo`s for all sections */ @objc - @warn_unused_result public func sections() -> [NSFetchedResultsSectionInfo] { return self.bridgeToSwift.sections() @@ -274,7 +262,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the target section for the specified "Section Index" title and index. */ @objc - @warn_unused_result public func targetSectionForSectionIndexTitle(title: String, index: Int) -> Int { return self.bridgeToSwift.targetSectionForSectionIndex(title: title, index: index) @@ -286,7 +273,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the section index titles for all sections */ @objc - @warn_unused_result public func sectionIndexTitles() -> [String] { return self.bridgeToSwift.sectionIndexTitles() @@ -299,7 +285,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the index of the `NSManagedObject` if it exists in the `CSListMonitor`'s fetched objects, or `nil` if not found. */ @objc - @warn_unused_result public func indexOf(_ object: NSManagedObject) -> NSNumber? { return self.bridgeToSwift.indexOf(object) @@ -312,7 +297,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType { - returns: the `NSIndexPath` of the `NSManagedObject` if it exists in the `ListMonitor`'s fetched objects, or `nil` if not found. */ @objc - @warn_unused_result public func indexPathOf(_ object: NSManagedObject) -> IndexPath? { return self.bridgeToSwift.indexPathOf(object) diff --git a/Sources/ObjectiveC/CSMigrationResult.swift b/Sources/ObjectiveC/CSMigrationResult.swift index b1c3df3..6c29313 100644 --- a/Sources/ObjectiveC/CSMigrationResult.swift +++ b/Sources/ObjectiveC/CSMigrationResult.swift @@ -90,7 +90,7 @@ 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(_ success: @noescape (migrationTypes: [CSMigrationType]) -> Void, failure: @noescape (error: NSError) -> Void) { switch self.bridgeToSwift { @@ -110,7 +110,7 @@ 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(_ success: @noescape (migrationTypes: [CSMigrationType]) -> Void) { guard case .success(let migrationTypes) = self.bridgeToSwift else { @@ -127,7 +127,7 @@ 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(_ failure: @noescape (error: NSError) -> Void) { guard case .failure(let error) = self.bridgeToSwift else { diff --git a/Sources/ObjectiveC/CSOrderBy.swift b/Sources/ObjectiveC/CSOrderBy.swift index f860ec5..bf079b3 100644 --- a/Sources/ObjectiveC/CSOrderBy.swift +++ b/Sources/ObjectiveC/CSOrderBy.swift @@ -53,7 +53,6 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl fetchAllFrom:CSFromClass([MyPersonEntity class]) fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]]; ``` - - parameter sortDescriptor: a `NSSortDescriptor` */ @objc @@ -69,7 +68,6 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl fetchAllFrom:CSFromClass([MyPersonEntity class]) fetchClauses:@[CSOrderByKeys(CSSortAscending(@"fullname"), CSSortDescending(@"age"), nil))]]]; ``` - - parameter sortDescriptors: an array of `NSSortDescriptor`s */ @objc diff --git a/Sources/ObjectiveC/CSSaveResult.swift b/Sources/ObjectiveC/CSSaveResult.swift index 78863ae..49238d0 100644 --- a/Sources/ObjectiveC/CSSaveResult.swift +++ b/Sources/ObjectiveC/CSSaveResult.swift @@ -90,7 +90,7 @@ 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(_ success: @noescape (hasChanges: Bool) -> Void, failure: @noescape (error: NSError) -> Void) { switch self.bridgeToSwift { @@ -110,7 +110,7 @@ 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(_ success: @noescape (hasChanges: Bool) -> Void) { guard case .success(let hasChanges) = self.bridgeToSwift else { @@ -127,7 +127,7 @@ 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(_ failure: @noescape (error: NSError) -> Void) { guard case .failure(let error) = self.bridgeToSwift else { diff --git a/Sources/ObjectiveC/CSSelect.swift b/Sources/ObjectiveC/CSSelect.swift index 8284832..32416d1 100644 --- a/Sources/ObjectiveC/CSSelect.swift +++ b/Sources/ObjectiveC/CSSelect.swift @@ -45,7 +45,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { select:CSSelectString(CSAttribute(@"fullname")) fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]]; ``` - - parameter keyPath: the attribute name */ @objc @@ -61,7 +60,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm average:@"age" as:nil]]]; ``` - - parameter keyPath: the attribute name - parameter `as`: 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()" is used - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the average value of an attribute @@ -79,7 +77,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm count:@"employeeID" as:nil]]]; ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `SelectTerm` to a `Select` clause for a count query @@ -97,7 +94,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm maximum:@"age" as:nil]]]; ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the maximum value for an attribute @@ -115,7 +111,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm minimum:@"age" as:nil]]]; ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the minimum value for an attribute @@ -133,7 +128,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect numberForTerm:[CSSelectTerm sum:@"age" as:nil]]]; ``` - - parameter keyPath: the attribute name - 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()" is used - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the sum value for an attribute @@ -152,7 +146,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType { select:[CSSelect objectIDForTerm:[CSSelectTerm objectIDAs:nil]] fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]]; ``` - - parameter keyPath: the attribute name - 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 @@ -221,7 +214,6 @@ public final class CSSelect: NSObject { select:CSSelectNumber(CSAggregateMax(@"age")) // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(numberTerm: CSSelectTerm) { @@ -237,7 +229,6 @@ public final class CSSelect: NSObject { select:CSSelectDecimal(CSAggregateAverage(@"price")) // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(decimalTerm: CSSelectTerm) { @@ -253,7 +244,6 @@ public final class CSSelect: NSObject { select:CSSelectString(CSAttribute(@"fullname")) // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(stringTerm: CSSelectTerm) { @@ -269,7 +259,6 @@ public final class CSSelect: NSObject { select:CSSelectDate(CSAggregateMax(@"updatedDate")) // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(dateTerm: CSSelectTerm) { @@ -285,7 +274,6 @@ public final class CSSelect: NSObject { select:CSSelectData(CSAttribute(@"imageData")) // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(dataTerm: CSSelectTerm) { @@ -301,7 +289,6 @@ public final class CSSelect: NSObject { select:CSSelectObjectID() // ... ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query */ public convenience init(objectIDTerm: ()) { @@ -316,7 +303,6 @@ public final class CSSelect: NSObject { queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]] select:[CSSelect dictionaryForTerm:[CSSelectTerm maximum:@"age" as:nil]]]; ``` - - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query - returns: a `CSSelect` clause for querying an entity attribute */ @@ -335,7 +321,6 @@ public final class CSSelect: NSObject { [CSSelectTerm attribute:@"age" as:nil] ]]]; ``` - - parameter terms: the `CSSelectTerm`s specifying the attribute/aggregate values to query - returns: a `CSSelect` clause for querying an entity attribute */ diff --git a/Sources/ObjectiveC/CSSetupResult.swift b/Sources/ObjectiveC/CSSetupResult.swift index 065e084..6d4034e 100644 --- a/Sources/ObjectiveC/CSSetupResult.swift +++ b/Sources/ObjectiveC/CSSetupResult.swift @@ -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(_ success: @noescape (storage: CSStorageInterface) -> Void, failure: @noescape (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(_ success: @noescape (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(_ failure: @noescape (error: NSError) -> Void) { guard let error = self.error else { diff --git a/Sources/ObjectiveC/CSUnsafeDataTransaction.swift b/Sources/ObjectiveC/CSUnsafeDataTransaction.swift index 7d6d336..bebf956 100644 --- a/Sources/ObjectiveC/CSUnsafeDataTransaction.swift +++ b/Sources/ObjectiveC/CSUnsafeDataTransaction.swift @@ -125,7 +125,6 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public func beginUnsafe() -> CSUnsafeDataTransaction { return bridge { @@ -141,7 +140,6 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction { - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made. */ @objc - @warn_unused_result public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction { return bridge { diff --git a/Sources/ObjectiveC/CSWhere.swift b/Sources/ObjectiveC/CSWhere.swift index ab2a9ca..28e2d7e 100644 --- a/Sources/ObjectiveC/CSWhere.swift +++ b/Sources/ObjectiveC/CSWhere.swift @@ -53,7 +53,6 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau fetchAllFrom:CSFromClass([MyPersonEntity class]) fetchClauses:@[CSWhereValue(YES)]]]; ``` - - parameter value: the boolean value for the predicate */ @objc @@ -70,7 +69,6 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau fetchAllFrom:CSFromClass([MyPersonEntity class]) fetchClauses:@[CSWherePredicate(predicate)]]; ``` - - parameter format: the format string for the predicate - parameter argumentArray: the arguments for `format` */ diff --git a/Sources/ObjectiveC/NSManagedObject+ObjectiveC.swift b/Sources/ObjectiveC/NSManagedObject+ObjectiveC.swift index 031d642..a8ad78e 100644 --- a/Sources/ObjectiveC/NSManagedObject+ObjectiveC.swift +++ b/Sources/ObjectiveC/NSManagedObject+ObjectiveC.swift @@ -38,7 +38,6 @@ public extension NSManagedObject { - returns: the primitive value for the KVC key */ @objc - @warn_unused_result public func cs_accessValueForKVCKey(_ KVCKey: KeyPath) -> AnyObject? { return self.accessValueForKVCKey(KVCKey) diff --git a/Sources/Observing/ListMonitor.swift b/Sources/Observing/ListMonitor.swift index bbc92e8..ed3b365 100644 --- a/Sources/Observing/ListMonitor.swift +++ b/Sources/Observing/ListMonitor.swift @@ -311,10 +311,9 @@ public final class ListMonitor: Hashable { return nil } - guard let sections = self.fetchedResultsController.sections - where section < sections.count else { - - return nil + guard let sections = self.fetchedResultsController.sections, section < sections.count else { + + return nil } return sections[section] } @@ -1105,8 +1104,8 @@ public final class ListMonitor: Hashable { self.isPersistentStoreChanging = true - guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init) - where !Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else { + guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init), + !Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else { return } diff --git a/Sources/Observing/ObjectMonitor.swift b/Sources/Observing/ObjectMonitor.swift index 01ba28d..489eb76 100644 --- a/Sources/Observing/ObjectMonitor.swift +++ b/Sources/Observing/ObjectMonitor.swift @@ -341,7 +341,8 @@ extension ObjectMonitor: FetchedResultsControllerHandler { userInfo: [String(NSManagedObject.self): anObject] ) - case .update: + case .update, + .move where indexPath == newIndexPath: NotificationCenter.default.post( name: Notification.Name.objectMonitorDidUpdateObject, object: self, diff --git a/Sources/Setup/CoreStore+Setup.swift b/Sources/Setup/CoreStore+Setup.swift index ad67e6e..d2f9362 100644 --- a/Sources/Setup/CoreStore+Setup.swift +++ b/Sources/Setup/CoreStore+Setup.swift @@ -53,9 +53,9 @@ public extension CoreStore { /** Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from `defaultStack`'s model. */ - public static func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? { + public static func entityDescription(for type: NSManagedObject.Type) -> NSEntityDescription? { - return self.defaultStack.entityDescriptionForType(type) + return self.defaultStack.entityDescription(for: type) } /** @@ -63,7 +63,6 @@ public extension CoreStore { ``` try CoreStore.addStorageAndWait() ``` - - returns: the local SQLite storage added to the `defaultStack` */ @discardableResult @@ -77,7 +76,6 @@ public extension CoreStore { ``` try CoreStore.addStorageAndWait(InMemoryStore.self) ``` - - parameter storeType: the `StorageInterface` type - throws: a `CoreStoreError` value indicating the failure - returns: the `StorageInterface` added to the `defaultStack` @@ -93,7 +91,6 @@ public extension CoreStore { ``` try CoreStore.addStorageAndWait(InMemoryStore(configuration: "Config1")) ``` - - parameter storage: the `StorageInterface` - throws: a `CoreStoreError` value indicating the failure - returns: the `StorageInterface` added to the `defaultStack` @@ -109,7 +106,6 @@ public extension CoreStore { ``` try CoreStore.addStorageAndWait(SQLiteStore.self) ``` - - parameter storeType: the `LocalStorageface` type - throws: a `CoreStoreError` value indicating the failure - returns: the local storage added to the `defaultStack` @@ -125,7 +121,6 @@ public extension CoreStore { ``` try CoreStore.addStorageAndWait(SQLiteStore(configuration: "Config1")) ``` - - parameter storage: the local storage - throws: a `CoreStoreError` value indicating the failure - returns: the local storage added to the `defaultStack`. Note that this 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. @@ -152,7 +147,6 @@ public extension CoreStore { } try CoreStore.addStorageAndWait(storage) ``` - - parameter storage: the local storage - throws: a `CoreStoreError` value indicating the failure - returns: the cloud storage added to the stack. Note that this 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. @@ -162,4 +156,16 @@ public extension CoreStore { return try self.defaultStack.addStorageAndWait(storage) } + + + // MARK: Deprecated + + /** + Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from `defaultStack`'s model. + */ + @available(*, deprecated: 3.0.0, renamed: "entityDescription(for:)") + public static func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? { + + return self.entityDescription(for: type) + } } diff --git a/Sources/Setup/DataStack.swift b/Sources/Setup/DataStack.swift index 9a014ce..9fae2c9 100644 --- a/Sources/Setup/DataStack.swift +++ b/Sources/Setup/DataStack.swift @@ -95,7 +95,7 @@ public final class DataStack { /** Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass. */ - public func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? { + public func entityDescription(for type: NSManagedObject.Type) -> NSEntityDescription? { return NSEntityDescription.entity( forEntityName: self.model.entityNameForClass(type), @@ -116,7 +116,6 @@ public final class DataStack { ``` try dataStack.addStorageAndWait() ``` - - throws: a `CoreStoreError` value indicating the failure - returns: the local SQLite storage added to the stack */ @@ -131,7 +130,6 @@ public final class DataStack { ``` try dataStack.addStorageAndWait(InMemoryStore.self) ``` - - parameter storeType: the `StorageInterface` type - throws: a `CoreStoreError` value indicating the failure - returns: the `StorageInterface` added to the stack @@ -147,7 +145,6 @@ public final class DataStack { ``` try dataStack.addStorageAndWait(InMemoryStore(configuration: "Config1")) ``` - - parameter storage: the `StorageInterface` - throws: a `CoreStoreError` value indicating the failure - returns: the `StorageInterface` added to the stack @@ -187,7 +184,6 @@ public final class DataStack { ``` try dataStack.addStorageAndWait(SQLiteStore.self) ``` - - parameter storeType: the `LocalStorageface` type - throws: a `CoreStoreError` value indicating the failure - returns: the local storage added to the stack @@ -203,7 +199,6 @@ public final class DataStack { ``` try dataStack.addStorageAndWait(SQLiteStore(configuration: "Config1")) ``` - - parameter storage: the local storage - throws: a `CoreStoreError` value indicating the failure - returns: the local storage added to the stack. Note that this 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. @@ -226,8 +221,8 @@ public final class DataStack { if let persistentStore = self.coordinator.persistentStore(for: fileURL as URL) { - if let existingStorage = persistentStore.storageInterface as? T - where storage.matchesPersistentStore(persistentStore) { + if let existingStorage = persistentStore.storageInterface as? T, + storage.matchesPersistentStore(persistentStore) { return existingStorage } @@ -304,7 +299,6 @@ public final class DataStack { } try dataStack.addStorageAndWait(storage) ``` - - parameter storage: the local storage - throws: a `CoreStoreError` value indicating the failure - returns: the cloud storage added to the stack. Note that this 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. @@ -322,8 +316,8 @@ public final class DataStack { let cacheFileURL = storage.cacheFileURL if let persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) { - if let existingStorage = persistentStore.storageInterface as? T - where storage.matchesPersistentStore(persistentStore) { + if let existingStorage = persistentStore.storageInterface as? T, + storage.matchesPersistentStore(persistentStore) { return existingStorage } @@ -518,12 +512,20 @@ public final class DataStack { } } } + + + // MARK: Deprecated + + @available(*, deprecated: 3.0.0, renamed: "entityDescription(for:)") + public func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? { + + return self.entityDescription(for: type) + } } // MARK: - DataStack: Equatable -@warn_unused_result public func == (lhs: DataStack, rhs: DataStack) -> Bool { return lhs === rhs diff --git a/Sources/Setup/StorageInterfaces/ICloudStore.swift b/Sources/Setup/StorageInterfaces/ICloudStore.swift index b02a368..116e9ee 100644 --- a/Sources/Setup/StorageInterfaces/ICloudStore.swift +++ b/Sources/Setup/StorageInterfaces/ICloudStore.swift @@ -57,7 +57,6 @@ public class ICloudStore: CloudStorage { } ) ``` - - parameter ubiquitousContentName: the name of the store in iCloud. This is required and should not be empty, and should not contain periods (`.`). - parameter ubiquitousContentTransactionLogsSubdirectory: an optional subdirectory path for the transaction logs - parameter ubiquitousContainerID: a container if your app has multiple ubiquity container identifiers in its entitlements @@ -481,8 +480,8 @@ public class ICloudStore: CloudStorage { guard let `self` = self, let observer = observer, - let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack - where self.dataStack === dataStack else { + let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack, + self.dataStack === dataStack else { return } diff --git a/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift b/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift index 6504aaf..d5f5420 100644 --- a/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift +++ b/Sources/Setup/StorageInterfaces/LegacySQLiteStore.swift @@ -25,6 +25,9 @@ import Foundation import CoreData +#if USE_FRAMEWORKS + import GCDKit +#endif // MARK: - LegacySQLiteStore @@ -180,7 +183,29 @@ public final class LegacySQLiteStore: LocalStorage, DefaultInitializableStore { options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]] ) try journalUpdatingCoordinator.remove(store) - try FileManager.default.removeItem(at: fileURL) + + let fileManager = FileManager.default + do { + + let temporaryFile = try URL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!) + .appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack", isDirectory: true) + .appendingPathComponent("trash", isDirectory: true) + .appendingPathComponent(UUID().uuidString, isDirectory: false) + try fileManager.createDirectory( + at: try temporaryFile.deletingLastPathComponent(), + withIntermediateDirectories: true, + attributes: nil + ) + try fileManager.moveItem(at: fileURL, to: temporaryFile) + GCDQueue.background.async { + + _ = try? fileManager.removeItem(at: temporaryFile) + } + } + catch { + + try fileManager.removeItem(at: fileURL) + } } } diff --git a/Sources/Setup/StorageInterfaces/SQLiteStore.swift b/Sources/Setup/StorageInterfaces/SQLiteStore.swift index 02541b3..10e7a3c 100644 --- a/Sources/Setup/StorageInterfaces/SQLiteStore.swift +++ b/Sources/Setup/StorageInterfaces/SQLiteStore.swift @@ -24,6 +24,9 @@ // import CoreData +#if USE_FRAMEWORKS + import GCDKit +#endif // MARK: - SQLiteStore @@ -177,7 +180,29 @@ public final class SQLiteStore: LocalStorage, DefaultInitializableStore { options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]] ) try journalUpdatingCoordinator.remove(store) - try FileManager.default.removeItem(at: fileURL) + + let fileManager = FileManager.default + do { + + let temporaryFile = try URL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!) + .appendingPathComponent(Bundle.main.bundleIdentifier ?? "com.CoreStore.DataStack", isDirectory: true) + .appendingPathComponent("trash", isDirectory: true) + .appendingPathComponent(UUID().uuidString, isDirectory: false) + try fileManager.createDirectory( + at: try temporaryFile.deletingLastPathComponent(), + withIntermediateDirectories: true, + attributes: nil + ) + try fileManager.moveItem(at: fileURL, to: temporaryFile) + GCDQueue.background.async { + + _ = try? fileManager.removeItem(at: temporaryFile) + } + } + catch { + + try fileManager.removeItem(at: fileURL) + } } } diff --git a/Sources/Transactions/Into.swift b/Sources/Transactions/Into.swift index 61a4a87..cb19731 100644 --- a/Sources/Transactions/Into.swift +++ b/Sources/Transactions/Into.swift @@ -68,7 +68,6 @@ public struct Into: Hashable { ``` let person = transaction.create(Into(MyPersonEntity.self)) ``` - - parameter entity: the `NSManagedObject` type to be created */ public init(_ entity: T.Type) { @@ -81,7 +80,6 @@ public struct Into: Hashable { ``` let person = transaction.create(Into(MyPersonEntity.self)) ``` - - parameter entityClass: the `NSManagedObject` class type to be created */ public init(_ entityClass: AnyClass) { @@ -98,7 +96,6 @@ public struct Into: Hashable { ``` let person = transaction.create(Into("Configuration1")) ``` - - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ public init(_ configuration: String?) { @@ -111,7 +108,6 @@ public struct Into: Hashable { ``` let person = transaction.create(Into(MyPersonEntity.self, "Configuration1")) ``` - - parameter entity: the `NSManagedObject` type to be created - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */ @@ -125,7 +121,6 @@ public struct Into: Hashable { ``` let person = transaction.create(Into(MyPersonEntity.self, "Configuration1")) ``` - - parameter entityClass: the `NSManagedObject` class type to be created - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration. */