WIP: demo app

This commit is contained in:
John Rommel Estropia
2016-07-25 08:21:22 +09:00
parent db5b8ca702
commit e9be711d4c
61 changed files with 210 additions and 298 deletions

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -11,8 +11,7 @@
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES"
hideIssues = "NO">
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F03A52F19C5C6DA005002A5"
@@ -26,8 +25,7 @@
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO"
hideIssues = "NO">
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F03A53A19C5C6DA005002A5"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@@ -272,11 +272,14 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "John Rommel Estropia";
TargetAttributes = {
B54AAD481AF4D26E00848AE0 = {
CreatedOnToolsVersion = 6.3;
DevelopmentTeam = 2JT32EJ5BH;
DevelopmentTeamName = "JOHNROMMEL ESTROPIA";
LastSwiftMigration = 0800;
};
};
};
@@ -461,6 +464,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -473,6 +477,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};

View File

@@ -102,10 +102,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
switch self.segmentedControl?.selectedSegmentIndex {
case Section.Fetching.rawValue?:
case Section.fetching.rawValue?:
return self.fetchingItems.count
case Section.Querying.rawValue?:
case Section.querying.rawValue?:
return self.queryingItems.count
default:
@@ -119,10 +119,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
switch self.segmentedControl?.selectedSegmentIndex {
case Section.Fetching.rawValue?:
case Section.fetching.rawValue?:
cell.textLabel?.text = self.fetchingItems[indexPath.row].title
case Section.Querying.rawValue?:
case Section.querying.rawValue?:
cell.textLabel?.text = self.queryingItems[indexPath.row].title
default:
@@ -141,10 +141,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
switch self.segmentedControl?.selectedSegmentIndex {
case Section.Fetching.rawValue?:
case Section.fetching.rawValue?:
self.performSegue(withIdentifier: "FetchingResultsViewController", sender: indexPath)
case Section.Querying.rawValue?:
case Section.querying.rawValue?:
self.performSegue(withIdentifier: "QueryingResultsViewController", sender: indexPath)
default:
@@ -157,8 +157,8 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
private enum Section: Int {
case Fetching
case Querying
case fetching
case querying
}
private let fetchingItems = [

View File

@@ -201,12 +201,12 @@ class ListObserverDemoViewController: UITableViewController, ListSectionObserver
self.tableView.endUpdates()
}
func listMonitorWillRefetch(monitor: ListMonitor<Palette>) {
func listMonitorWillRefetch(_ monitor: ListMonitor<Palette>) {
self.setTable(enabled: false)
}
func listMonitorDidRefetch(monitor: ListMonitor<Palette>) {
func listMonitorDidRefetch(_ monitor: ListMonitor<Palette>) {
self.filterBarButton?.title = Static.filter.rawValue
self.tableView.reloadData()

View File

@@ -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<Palette>(), OrderBy(.ascending("hue")))!

View File

@@ -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,

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14E46" minimumToolsVersion="Xcode 4.3">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11198.3" systemVersion="15F34" minimumToolsVersion="Xcode 4.3" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV1" syncable="YES">
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
<attribute name="hasHead" optional="YES" attributeType="Boolean" syncable="YES"/>
<attribute name="hasTail" optional="YES" attributeType="Boolean" syncable="YES"/>
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasHead" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasTail" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
</entity>
<elements>
<element name="Organism" positionX="-36" positionY="9" width="128" height="90"/>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14E46" minimumToolsVersion="Xcode 4.3">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11198.3" systemVersion="15F34" minimumToolsVersion="Xcode 4.3" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV2" syncable="YES">
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
<attribute name="hasHead" attributeType="Boolean" syncable="YES"/>
<attribute name="hasTail" attributeType="Boolean" syncable="YES"/>
<attribute name="numberOfFlippers" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasHead" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasTail" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="numberOfFlippers" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
</entity>
<elements>
<element name="Organism" positionX="-36" positionY="9" width="128" height="105"/>

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14E46" minimumToolsVersion="Xcode 4.3">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11198.3" systemVersion="15F34" minimumToolsVersion="Xcode 4.3" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV3" syncable="YES">
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
<attribute name="hasHead" attributeType="Boolean" syncable="YES"/>
<attribute name="hasTail" attributeType="Boolean" syncable="YES"/>
<attribute name="hasVertebrae" attributeType="Boolean" syncable="YES"/>
<attribute name="numberOfLimbs" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasHead" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasTail" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="hasVertebrae" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="numberOfLimbs" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
</entity>
<elements>
<element name="Organism" positionX="-36" positionY="9" width="128" height="120"/>

View File

@@ -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)) ?? []
]

View File

@@ -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),

View File

@@ -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<Void>?) {
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

View File

@@ -68,7 +68,6 @@ public struct From<T: NSManagedObject> {
```
let people = transaction.fetchAll(From<MyPersonEntity>())
```
- parameter entity: the associated `NSManagedObject` type
*/
public init(_ entity: T.Type) {
@@ -81,7 +80,6 @@ public struct From<T: NSManagedObject> {
```
let people = transaction.fetchAll(From<MyPersonEntity>())
```
- parameter entityClass: the associated `NSManagedObject` entity class
*/
public init(_ entityClass: AnyClass) {
@@ -98,7 +96,6 @@ public struct From<T: NSManagedObject> {
```
let people = transaction.fetchAll(From<MyPersonEntity>(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<T: NSManagedObject> {
```
let people = transaction.fetchAll(From<MyPersonEntity>(["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<T: NSManagedObject> {
```
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<T: NSManagedObject> {
```
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<T: NSManagedObject> {
```
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<T: NSManagedObject> {
```
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.
*/

View File

@@ -73,7 +73,7 @@ public struct GroupBy: QueryClause, Hashable {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let keyPaths = fetchRequest.propertiesToGroupBy as? [String] where keyPaths != self.keyPaths {
if let keyPaths = fetchRequest.propertiesToGroupBy as? [String], keyPaths != self.keyPaths {
CoreStore.log(
.warning,

View File

@@ -140,7 +140,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let sortDescriptors = fetchRequest.sortDescriptors where sortDescriptors != self.sortDescriptors {
if let sortDescriptors = fetchRequest.sortDescriptors, sortDescriptors != self.sortDescriptors {
CoreStore.log(
.warning,

View File

@@ -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<Int>(.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(<attributeName>)" 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<Int>(.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(<attributeName>)" is used
- returns: a `SelectTerm` to a `Select` clause for a count query
@@ -146,7 +143,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
Select<Int>(.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(<attributeName>)" 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<Int>(.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(<attributeName>)" 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<Int>(.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(<attributeName>)" 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

View File

@@ -145,7 +145,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
if let predicate = fetchRequest.predicate where predicate != self.predicate {
if let predicate = fetchRequest.predicate, predicate != self.predicate {
CoreStore.log(
.warning,

View File

@@ -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
}

View File

@@ -120,6 +120,24 @@ internal final class FetchedResultsControllerDelegate<EntityType: NSManagedObjec
// http://stackoverflow.com/questions/31383760/ios-9-attempt-to-delete-and-reload-the-same-index-path/31384014#31384014
// https://forums.developer.apple.com/message/9998#9998
// https://forums.developer.apple.com/message/31849#31849
if #available(iOS 10.0, tvOS 10.0, watchOS 3.0, *) {
// iOS 10 is better, but still not perfect...
if case .update = actualType,
let indexPath = indexPath,
let newIndexPath = newIndexPath {
self.handler?.controller(
controller,
didChangeObject: anObject,
atIndexPath: indexPath,
forChangeType: .move,
newIndexPath: newIndexPath
)
return
}
}
switch actualType {

View File

@@ -124,7 +124,6 @@ internal extension NSManagedObjectContext {
}
context.mergeChanges(fromContextDidSave: note)
}
if rootContext.isSavingSynchronously == true {
context.performAndWait(mergeChanges)

View File

@@ -129,7 +129,7 @@ internal extension NSManagedObjectContext {
return
}
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
if let parentContext = self.parent, self.shouldCascadeSavesToParent {
switch parentContext.saveSynchronously() {
@@ -183,7 +183,7 @@ internal extension NSManagedObjectContext {
return
}
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
if self.shouldCascadeSavesToParent, let parentContext = self.parent {
parentContext.saveAsynchronouslyWithCompletion(completion)
}

View File

@@ -52,7 +52,8 @@ internal extension NSManagedObjectModel {
let modelVersions = Set(versionHashes.keys)
let currentModelVersion: String
if let plistModelVersion = versionInfo["NSManagedObjectModel_CurrentVersionName"] as? String where modelVersionHints.isEmpty || modelVersionHints.contains(plistModelVersion) {
if let plistModelVersion = versionInfo["NSManagedObjectModel_CurrentVersionName"] as? String,
modelVersionHints.isEmpty || modelVersionHints.contains(plistModelVersion) {
currentModelVersion = plistModelVersion
}
@@ -183,8 +184,8 @@ internal extension NSManagedObjectModel {
}
guard let modelFileURL = self.modelFileURL,
let modelVersions = self.modelVersions
where modelVersions.contains(modelVersion) else {
let modelVersions = self.modelVersions,
modelVersions.contains(modelVersion) else {
return nil
}
@@ -210,7 +211,7 @@ internal extension NSManagedObjectModel {
}
for modelVersion in self.modelVersions ?? [] {
if let versionModel = self[modelVersion] where modelHashes == versionModel.entityVersionHashesByName {
if let versionModel = self[modelVersion], modelHashes == versionModel.entityVersionHashesByName {
return versionModel
}

View File

@@ -47,7 +47,6 @@ 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.
*/
@@ -69,7 +68,6 @@ 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.
*/
@@ -91,7 +89,6 @@ public extension CoreStore {
}
)
```
- parameter storeType: the local 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 `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.
@@ -114,7 +111,6 @@ public extension CoreStore {
}
)
```
- parameter storage: the local 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 `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.
@@ -148,7 +144,6 @@ 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.
*/

View File

@@ -47,7 +47,6 @@ 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.
*/
@@ -69,7 +68,6 @@ 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.
*/
@@ -127,7 +125,6 @@ public extension DataStack {
}
)
```
- parameter storeType: the local 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 `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.
@@ -150,7 +147,6 @@ public extension DataStack {
}
)
```
- parameter storage: the local 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 `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.
@@ -176,8 +172,8 @@ public extension 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) {
GCDQueue.main.async {
@@ -316,7 +312,6 @@ 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.
*/
@@ -336,8 +331,8 @@ public extension DataStack {
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) {
GCDQueue.main.async {
@@ -608,7 +603,7 @@ public extension DataStack {
operations.append(
BlockOperation { [weak self] in
guard let `self` = self where !cancelled else {
guard let `self` = self, !cancelled else {
return
}
@@ -684,7 +679,8 @@ public extension DataStack {
while let nextVersion = migrationChain.nextVersionFrom(currentVersion),
let sourceModel = model[currentVersion],
let destinationModel = model[nextVersion] where sourceModel != model {
sourceModel != model,
let destinationModel = model[nextVersion] {
if let mappingModel = NSMappingModel(
from: storage.mappingModelBundles,

View File

@@ -138,7 +138,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
var checklist: Set<String> = [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

View File

@@ -135,48 +135,3 @@ public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, r
return false
}
}
// MARK: - Deprecated
/**
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: 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)
}
}

View File

@@ -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(

View File

@@ -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)

View File

@@ -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(

View File

@@ -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)

View File

@@ -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`

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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(

View File

@@ -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(

View File

@@ -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 {

View File

@@ -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

View File

@@ -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.
*/

View File

@@ -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.
*/

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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(<attributeName>)" 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(<attributeName>)" 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(<attributeName>)" 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(<attributeName>)" 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(<attributeName>)" 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
*/

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(_ 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 {

View File

@@ -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 {

View File

@@ -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`
*/

View File

@@ -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)

View File

@@ -311,10 +311,9 @@ public final class ListMonitor<T: NSManagedObject>: 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<T: NSManagedObject>: 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
}

View File

@@ -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,

View File

@@ -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)
}
}

View File

@@ -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

View File

@@ -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
}

View File

@@ -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)
}
}
}

View File

@@ -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)
}
}
}

View File

@@ -68,7 +68,6 @@ public struct Into<T: NSManagedObject>: 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<T: NSManagedObject>: 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<T: NSManagedObject>: Hashable {
```
let person = transaction.create(Into<MyPersonEntity>("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<T: NSManagedObject>: 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<T: NSManagedObject>: 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.
*/