mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-24 09:38:30 +02:00
WIP: demo app
This commit is contained in:
2
Carthage/Checkouts/GCDKit
vendored
2
Carthage/Checkouts/GCDKit
vendored
Submodule Carthage/Checkouts/GCDKit updated: 347225011a...b93656e1aa
@@ -1420,7 +1420,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 0730;
|
LastSwiftUpdateCheck = 0730;
|
||||||
LastUpgradeCheck = 0700;
|
LastUpgradeCheck = 0800;
|
||||||
ORGANIZATIONNAME = "John Rommel Estropia";
|
ORGANIZATIONNAME = "John Rommel Estropia";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
2F03A52F19C5C6DA005002A5 = {
|
2F03A52F19C5C6DA005002A5 = {
|
||||||
@@ -2132,6 +2132,7 @@
|
|||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"DEBUG=1",
|
"DEBUG=1",
|
||||||
@@ -2188,6 +2189,7 @@
|
|||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "USE_FRAMEWORKS=1";
|
GCC_PREPROCESSOR_DEFINITIONS = "USE_FRAMEWORKS=1";
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
@@ -2203,7 +2205,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
|
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.CoreStore;
|
||||||
PRODUCT_NAME = CoreStore;
|
PRODUCT_NAME = CoreStore;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0710"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0700"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -11,8 +11,7 @@
|
|||||||
buildForRunning = "YES"
|
buildForRunning = "YES"
|
||||||
buildForProfiling = "YES"
|
buildForProfiling = "YES"
|
||||||
buildForArchiving = "YES"
|
buildForArchiving = "YES"
|
||||||
buildForAnalyzing = "YES"
|
buildForAnalyzing = "YES">
|
||||||
hideIssues = "NO">
|
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "2F03A52F19C5C6DA005002A5"
|
BlueprintIdentifier = "2F03A52F19C5C6DA005002A5"
|
||||||
@@ -26,8 +25,7 @@
|
|||||||
buildForRunning = "NO"
|
buildForRunning = "NO"
|
||||||
buildForProfiling = "NO"
|
buildForProfiling = "NO"
|
||||||
buildForArchiving = "NO"
|
buildForArchiving = "NO"
|
||||||
buildForAnalyzing = "NO"
|
buildForAnalyzing = "NO">
|
||||||
hideIssues = "NO">
|
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "2F03A53A19C5C6DA005002A5"
|
BlueprintIdentifier = "2F03A53A19C5C6DA005002A5"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0720"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0700"
|
LastUpgradeVersion = "0800"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -272,11 +272,14 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 0700;
|
LastSwiftUpdateCheck = 0700;
|
||||||
LastUpgradeCheck = 0700;
|
LastUpgradeCheck = 0800;
|
||||||
ORGANIZATIONNAME = "John Rommel Estropia";
|
ORGANIZATIONNAME = "John Rommel Estropia";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
B54AAD481AF4D26E00848AE0 = {
|
B54AAD481AF4D26E00848AE0 = {
|
||||||
CreatedOnToolsVersion = 6.3;
|
CreatedOnToolsVersion = 6.3;
|
||||||
|
DevelopmentTeam = 2JT32EJ5BH;
|
||||||
|
DevelopmentTeamName = "JOHNROMMEL ESTROPIA";
|
||||||
|
LastSwiftMigration = 0800;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -461,6 +464,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -473,6 +477,8 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.johnestropia.corestore.demo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,10 +102,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
|
|||||||
|
|
||||||
switch self.segmentedControl?.selectedSegmentIndex {
|
switch self.segmentedControl?.selectedSegmentIndex {
|
||||||
|
|
||||||
case Section.Fetching.rawValue?:
|
case Section.fetching.rawValue?:
|
||||||
return self.fetchingItems.count
|
return self.fetchingItems.count
|
||||||
|
|
||||||
case Section.Querying.rawValue?:
|
case Section.querying.rawValue?:
|
||||||
return self.queryingItems.count
|
return self.queryingItems.count
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -119,10 +119,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
|
|||||||
|
|
||||||
switch self.segmentedControl?.selectedSegmentIndex {
|
switch self.segmentedControl?.selectedSegmentIndex {
|
||||||
|
|
||||||
case Section.Fetching.rawValue?:
|
case Section.fetching.rawValue?:
|
||||||
cell.textLabel?.text = self.fetchingItems[indexPath.row].title
|
cell.textLabel?.text = self.fetchingItems[indexPath.row].title
|
||||||
|
|
||||||
case Section.Querying.rawValue?:
|
case Section.querying.rawValue?:
|
||||||
cell.textLabel?.text = self.queryingItems[indexPath.row].title
|
cell.textLabel?.text = self.queryingItems[indexPath.row].title
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -141,10 +141,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
|
|||||||
|
|
||||||
switch self.segmentedControl?.selectedSegmentIndex {
|
switch self.segmentedControl?.selectedSegmentIndex {
|
||||||
|
|
||||||
case Section.Fetching.rawValue?:
|
case Section.fetching.rawValue?:
|
||||||
self.performSegue(withIdentifier: "FetchingResultsViewController", sender: indexPath)
|
self.performSegue(withIdentifier: "FetchingResultsViewController", sender: indexPath)
|
||||||
|
|
||||||
case Section.Querying.rawValue?:
|
case Section.querying.rawValue?:
|
||||||
self.performSegue(withIdentifier: "QueryingResultsViewController", sender: indexPath)
|
self.performSegue(withIdentifier: "QueryingResultsViewController", sender: indexPath)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -157,8 +157,8 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
|
|||||||
|
|
||||||
private enum Section: Int {
|
private enum Section: Int {
|
||||||
|
|
||||||
case Fetching
|
case fetching
|
||||||
case Querying
|
case querying
|
||||||
}
|
}
|
||||||
|
|
||||||
private let fetchingItems = [
|
private let fetchingItems = [
|
||||||
|
|||||||
@@ -201,12 +201,12 @@ class ListObserverDemoViewController: UITableViewController, ListSectionObserver
|
|||||||
self.tableView.endUpdates()
|
self.tableView.endUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
func listMonitorWillRefetch(monitor: ListMonitor<Palette>) {
|
func listMonitorWillRefetch(_ monitor: ListMonitor<Palette>) {
|
||||||
|
|
||||||
self.setTable(enabled: false)
|
self.setTable(enabled: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func listMonitorDidRefetch(monitor: ListMonitor<Palette>) {
|
func listMonitorDidRefetch(_ monitor: ListMonitor<Palette>) {
|
||||||
|
|
||||||
self.filterBarButton?.title = Static.filter.rawValue
|
self.filterBarButton?.title = Static.filter.rawValue
|
||||||
self.tableView.reloadData()
|
self.tableView.reloadData()
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver {
|
|||||||
|
|
||||||
CoreStore.beginSynchronous { (transaction) -> Void in
|
CoreStore.beginSynchronous { (transaction) -> Void in
|
||||||
|
|
||||||
let palette = transaction.create(Into(Palette))
|
let palette = transaction.create(Into(Palette.self))
|
||||||
palette.setInitialValues()
|
palette.setInitialValues()
|
||||||
|
|
||||||
transaction.commitAndWait()
|
_ = transaction.commitAndWait()
|
||||||
}
|
}
|
||||||
|
|
||||||
let palette = CoreStore.fetchOne(From<Palette>(), OrderBy(.ascending("hue")))!
|
let palette = CoreStore.fetchOne(From<Palette>(), OrderBy(.ascending("hue")))!
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class MigrationsDemoViewController: UIViewController {
|
|||||||
@IBOutlet private dynamic weak var progressView: UIProgressView?
|
@IBOutlet private dynamic weak var progressView: UIProgressView?
|
||||||
@IBOutlet private dynamic weak var tableView: UITableView?
|
@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 {
|
guard let index = self.segmentedControl?.selectedSegmentIndex else {
|
||||||
|
|
||||||
@@ -275,8 +275,8 @@ class MigrationsDemoViewController: UIViewController {
|
|||||||
private func reloadTableHeaderWithProgress(_ progress: Progress) {
|
private func reloadTableHeaderWithProgress(_ progress: Progress) {
|
||||||
|
|
||||||
self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true)
|
self.progressView?.setProgress(Float(progress.fractionCompleted), animated: true)
|
||||||
self.titleLabel?.text = "Migrating: \(progress.localizedDescription)"
|
self.titleLabel?.text = "Migrating: \(progress.localizedDescription ?? "")"
|
||||||
self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription)"
|
self.organismLabel?.text = "Progressive step \(progress.localizedAdditionalDescription ?? "")"
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateDisplay(reloadData: Bool, scrollToSelection: Bool, animated: Bool) {
|
private func updateDisplay(reloadData: Bool, scrollToSelection: Bool, animated: Bool) {
|
||||||
@@ -311,7 +311,8 @@ class MigrationsDemoViewController: UIViewController {
|
|||||||
|
|
||||||
tableView.layoutIfNeeded()
|
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,
|
tableView.selectRow(at: indexPath,
|
||||||
animated: scrollToSelection && animated,
|
animated: scrollToSelection && animated,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?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">
|
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV1" syncable="YES">
|
||||||
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasHead" optional="YES" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasHead" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasTail" optional="YES" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasTail" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Organism" positionX="-36" positionY="9" width="128" height="90"/>
|
<element name="Organism" positionX="-36" positionY="9" width="128" height="90"/>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?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">
|
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV2" syncable="YES">
|
||||||
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasHead" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasHead" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasTail" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasTail" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="numberOfFlippers" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
|
<attribute name="numberOfFlippers" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Organism" positionX="-36" positionY="9" width="128" height="105"/>
|
<element name="Organism" positionX="-36" positionY="9" width="128" height="105"/>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?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">
|
<entity name="Organism" representedClassName="CoreStoreDemo.OrganismV3" syncable="YES">
|
||||||
<attribute name="dna" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
<attribute name="dna" optional="YES" attributeType="Integer 64" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasHead" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasHead" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasTail" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasTail" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="hasVertebrae" attributeType="Boolean" syncable="YES"/>
|
<attribute name="hasVertebrae" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<attribute name="numberOfLimbs" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
|
<attribute name="numberOfLimbs" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Organism" positionX="-36" positionY="9" width="128" height="120"/>
|
<element name="Organism" positionX="-36" positionY="9" width="128" height="120"/>
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ private struct Static {
|
|||||||
class StackSetupDemoViewController: UITableViewController {
|
class StackSetupDemoViewController: UITableViewController {
|
||||||
|
|
||||||
let accounts = [
|
let accounts = [
|
||||||
Static.facebookStack.fetchAll(From(UserAccount)) ?? [],
|
Static.facebookStack.fetchAll(From(UserAccount.self)) ?? [],
|
||||||
Static.twitterStack.fetchAll(From(UserAccount)) ?? []
|
Static.twitterStack.fetchAll(From(UserAccount.self)) ?? []
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec
|
|||||||
|
|
||||||
// MARK: MKMapViewDelegate
|
// MARK: MKMapViewDelegate
|
||||||
|
|
||||||
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
|
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
|
||||||
|
|
||||||
let identifier = "MKAnnotationView"
|
let identifier = "MKAnnotationView"
|
||||||
var annotationView: MKPinAnnotationView! = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKPinAnnotationView
|
var annotationView: MKPinAnnotationView! = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as? MKPinAnnotationView
|
||||||
@@ -162,7 +162,9 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec
|
|||||||
|
|
||||||
@IBAction dynamic func longPressGestureRecognized(_ sender: AnyObject?) {
|
@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(
|
let coordinate = mapView.convert(
|
||||||
gesture.location(in: mapView),
|
gesture.location(in: mapView),
|
||||||
|
|||||||
@@ -96,14 +96,14 @@ private final class ProgressObserver: NSObject {
|
|||||||
|
|
||||||
self.progress.addObserver(
|
self.progress.addObserver(
|
||||||
self,
|
self,
|
||||||
forKeyPath: "fractionCompleted",
|
forKeyPath: #keyPath(Progress.fractionCompleted),
|
||||||
options: [.initial, .new],
|
options: [.initial, .new],
|
||||||
context: nil
|
context: nil
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else {
|
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 {
|
if let _ = self.progressHandler {
|
||||||
|
|
||||||
self.progressHandler = nil
|
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>?) {
|
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 {
|
guard let progress = object as? Progress,
|
||||||
|
progress == self.progress,
|
||||||
return
|
keyPath == #keyPath(Progress.fractionCompleted) else {
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
GCDQueue.main.async { [weak self] () -> Void in
|
GCDQueue.main.async { [weak self] () -> Void in
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public struct From<T: NSManagedObject> {
|
|||||||
```
|
```
|
||||||
let people = transaction.fetchAll(From<MyPersonEntity>())
|
let people = transaction.fetchAll(From<MyPersonEntity>())
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` type
|
- parameter entity: the associated `NSManagedObject` type
|
||||||
*/
|
*/
|
||||||
public init(_ entity: T.Type) {
|
public init(_ entity: T.Type) {
|
||||||
@@ -81,7 +80,6 @@ public struct From<T: NSManagedObject> {
|
|||||||
```
|
```
|
||||||
let people = transaction.fetchAll(From<MyPersonEntity>())
|
let people = transaction.fetchAll(From<MyPersonEntity>())
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the associated `NSManagedObject` entity class
|
- parameter entityClass: the associated `NSManagedObject` entity class
|
||||||
*/
|
*/
|
||||||
public init(_ entityClass: AnyClass) {
|
public init(_ entityClass: AnyClass) {
|
||||||
@@ -98,7 +96,6 @@ public struct From<T: NSManagedObject> {
|
|||||||
```
|
```
|
||||||
let people = transaction.fetchAll(From<MyPersonEntity>(nil, "Configuration1"))
|
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 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)
|
- 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"]))
|
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.
|
- 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?]) {
|
public init(_ configurations: [String?]) {
|
||||||
@@ -125,7 +121,6 @@ public struct From<T: NSManagedObject> {
|
|||||||
```
|
```
|
||||||
let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))
|
let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` type
|
- 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 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)
|
- 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"]))
|
let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` type
|
- 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.
|
- 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"))
|
let people = transaction.fetchAll(From(MyPersonEntity.self, nil, "Configuration1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` entity class
|
- 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 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)
|
- 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"]))
|
let people = transaction.fetchAll(From(MyPersonEntity.self, ["Configuration1", "Configuration1"]))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` entity class
|
- 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.
|
- 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public struct GroupBy: QueryClause, Hashable {
|
|||||||
|
|
||||||
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
|
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(
|
CoreStore.log(
|
||||||
.warning,
|
.warning,
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public struct OrderBy: FetchClause, QueryClause, DeleteClause, Hashable {
|
|||||||
|
|
||||||
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
|
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(
|
CoreStore.log(
|
||||||
.warning,
|
.warning,
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
|
|||||||
Where("employeeID", isEqualTo: 1111)
|
Where("employeeID", isEqualTo: 1111)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- parameter keyPath: the attribute name
|
||||||
- returns: a `SelectTerm` to a `Select` clause for querying an entity attribute
|
- 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"))
|
Select<Int>(.average("age"))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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"))
|
Select<Int>(.count("employeeID"))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- returns: a `SelectTerm` to a `Select` clause for a count query
|
||||||
@@ -146,7 +143,6 @@ public enum SelectTerm: StringLiteralConvertible, Hashable {
|
|||||||
Select<Int>(.maximum("age"))
|
Select<Int>(.maximum("age"))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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"))
|
Select<Int>(.minimum("age"))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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"))
|
Select<Int>(.sum("age"))
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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)
|
Where("employeeID", isEqualTo: 1111)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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.includesPendingChanges = false
|
||||||
fetchRequest.resultType = .dictionaryResultType
|
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 {
|
switch components.count {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
@@ -761,9 +754,9 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return attributeDescriptionForKeyPath(
|
return attributeDescription(
|
||||||
components.dropFirst().joinWithSeparator("."),
|
for: components.dropFirst().joined(separator: "."),
|
||||||
inEntity: relationship.entity
|
in: relationship.entity
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -775,7 +768,7 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
|
|
||||||
case ._attribute(let keyPath):
|
case ._attribute(let keyPath):
|
||||||
let entityDescription = fetchRequest.entity!
|
let entityDescription = fetchRequest.entity!
|
||||||
if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) {
|
if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) {
|
||||||
|
|
||||||
propertiesToFetch.append(attributeDescription)
|
propertiesToFetch.append(attributeDescription)
|
||||||
}
|
}
|
||||||
@@ -789,7 +782,7 @@ internal extension Collection where Iterator.Element == SelectTerm {
|
|||||||
|
|
||||||
case ._aggregate(let function, let keyPath, let alias, let nativeType):
|
case ._aggregate(let function, let keyPath, let alias, let nativeType):
|
||||||
let entityDescription = fetchRequest.entity!
|
let entityDescription = fetchRequest.entity!
|
||||||
if let attributeDescription = attributeDescriptionForKeyPath(keyPath, inEntity: entityDescription) {
|
if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) {
|
||||||
|
|
||||||
let expressionDescription = NSExpressionDescription()
|
let expressionDescription = NSExpressionDescription()
|
||||||
expressionDescription.name = alias
|
expressionDescription.name = alias
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public struct Where: FetchClause, QueryClause, DeleteClause, Hashable {
|
|||||||
|
|
||||||
public func applyToFetchRequest<ResultType: NSFetchRequestResult>(_ fetchRequest: NSFetchRequest<ResultType>) {
|
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(
|
CoreStore.log(
|
||||||
.warning,
|
.warning,
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ public extension BaseDataTransaction {
|
|||||||
|
|
||||||
let uniqueIDValue = object.uniqueIDValue
|
let uniqueIDValue = object.uniqueIDValue
|
||||||
|
|
||||||
guard let source = mapping.removeValue(forKey: uniqueIDValue)
|
guard let source = mapping.removeValue(forKey: uniqueIDValue),
|
||||||
where T.shouldUpdateFromImportSource(source, inTransaction: self) else {
|
T.shouldUpdateFromImportSource(source, inTransaction: self) else {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
// 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/9998#9998
|
||||||
// https://forums.developer.apple.com/message/31849#31849
|
// 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 {
|
switch actualType {
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ internal extension NSManagedObjectContext {
|
|||||||
}
|
}
|
||||||
context.mergeChanges(fromContextDidSave: note)
|
context.mergeChanges(fromContextDidSave: note)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rootContext.isSavingSynchronously == true {
|
if rootContext.isSavingSynchronously == true {
|
||||||
|
|
||||||
context.performAndWait(mergeChanges)
|
context.performAndWait(mergeChanges)
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ internal extension NSManagedObjectContext {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
|
if let parentContext = self.parent, self.shouldCascadeSavesToParent {
|
||||||
|
|
||||||
switch parentContext.saveSynchronously() {
|
switch parentContext.saveSynchronously() {
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ internal extension NSManagedObjectContext {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if let parentContext = self.parent where self.shouldCascadeSavesToParent {
|
if self.shouldCascadeSavesToParent, let parentContext = self.parent {
|
||||||
|
|
||||||
parentContext.saveAsynchronouslyWithCompletion(completion)
|
parentContext.saveAsynchronouslyWithCompletion(completion)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ internal extension NSManagedObjectModel {
|
|||||||
|
|
||||||
let modelVersions = Set(versionHashes.keys)
|
let modelVersions = Set(versionHashes.keys)
|
||||||
let currentModelVersion: String
|
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
|
currentModelVersion = plistModelVersion
|
||||||
}
|
}
|
||||||
@@ -183,8 +184,8 @@ internal extension NSManagedObjectModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
guard let modelFileURL = self.modelFileURL,
|
guard let modelFileURL = self.modelFileURL,
|
||||||
let modelVersions = self.modelVersions
|
let modelVersions = self.modelVersions,
|
||||||
where modelVersions.contains(modelVersion) else {
|
modelVersions.contains(modelVersion) else {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -210,7 +211,7 @@ internal extension NSManagedObjectModel {
|
|||||||
}
|
}
|
||||||
for modelVersion in self.modelVersions ?? [] {
|
for modelVersion in self.modelVersions ?? [] {
|
||||||
|
|
||||||
if let versionModel = self[modelVersion] where modelHashes == versionModel.entityVersionHashesByName {
|
if let versionModel = self[modelVersion], modelHashes == versionModel.entityVersionHashesByName {
|
||||||
|
|
||||||
return versionModel
|
return versionModel
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public extension CoreStore {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the storage type
|
- 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.
|
- 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 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.
|
- 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 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.
|
- 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.
|
- 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 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.
|
- 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.
|
- 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 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.
|
- 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public extension DataStack {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the storage type
|
- 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.
|
- 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 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.
|
- 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 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.
|
- 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.
|
- 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 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.
|
- 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.
|
- 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 persistentStore = self.coordinator.persistentStore(for: fileURL as URL) {
|
||||||
|
|
||||||
if let existingStorage = persistentStore.storageInterface as? T
|
if let existingStorage = persistentStore.storageInterface as? T,
|
||||||
where storage.matchesPersistentStore(persistentStore) {
|
storage.matchesPersistentStore(persistentStore) {
|
||||||
|
|
||||||
GCDQueue.main.async {
|
GCDQueue.main.async {
|
||||||
|
|
||||||
@@ -316,7 +312,6 @@ public extension DataStack {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the cloud storage
|
- 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.
|
- 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 persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) {
|
||||||
|
|
||||||
if let existingStorage = persistentStore.storageInterface as? T
|
if let existingStorage = persistentStore.storageInterface as? T,
|
||||||
where storage.matchesPersistentStore(persistentStore) {
|
storage.matchesPersistentStore(persistentStore) {
|
||||||
|
|
||||||
GCDQueue.main.async {
|
GCDQueue.main.async {
|
||||||
|
|
||||||
@@ -608,7 +603,7 @@ public extension DataStack {
|
|||||||
operations.append(
|
operations.append(
|
||||||
BlockOperation { [weak self] in
|
BlockOperation { [weak self] in
|
||||||
|
|
||||||
guard let `self` = self where !cancelled else {
|
guard let `self` = self, !cancelled else {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -684,7 +679,8 @@ public extension DataStack {
|
|||||||
|
|
||||||
while let nextVersion = migrationChain.nextVersionFrom(currentVersion),
|
while let nextVersion = migrationChain.nextVersionFrom(currentVersion),
|
||||||
let sourceModel = model[currentVersion],
|
let sourceModel = model[currentVersion],
|
||||||
let destinationModel = model[nextVersion] where sourceModel != model {
|
sourceModel != model,
|
||||||
|
let destinationModel = model[nextVersion] {
|
||||||
|
|
||||||
if let mappingModel = NSMappingModel(
|
if let mappingModel = NSMappingModel(
|
||||||
from: storage.mappingModelBundles,
|
from: storage.mappingModelBundles,
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
|
|||||||
|
|
||||||
var checklist: Set<String> = [start]
|
var checklist: Set<String> = [start]
|
||||||
var version = start
|
var version = start
|
||||||
while let nextVersion = versionTree[version] where nextVersion != version {
|
while let nextVersion = versionTree[version], nextVersion != version {
|
||||||
|
|
||||||
if checklist.contains(nextVersion) {
|
if checklist.contains(nextVersion) {
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
|
|||||||
|
|
||||||
internal func nextVersionFrom(_ version: String) -> String? {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,6 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
|
|||||||
|
|
||||||
// MARK: - MigrationChain: Equatable
|
// MARK: - MigrationChain: Equatable
|
||||||
|
|
||||||
@warn_unused_result
|
|
||||||
public func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool {
|
public func == (lhs: MigrationChain, rhs: MigrationChain) -> Bool {
|
||||||
|
|
||||||
return lhs.versionTree == rhs.versionTree
|
return lhs.versionTree == rhs.versionTree
|
||||||
|
|||||||
@@ -135,48 +135,3 @@ public func == <T: StorageInterface, U: StorageInterface>(lhs: SetupResult<T>, r
|
|||||||
return false
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -58,7 +57,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -78,7 +76,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
||||||
|
|
||||||
return objects.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0.objectID) }
|
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
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
||||||
|
|
||||||
return objectIDs.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0) }
|
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
|
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -123,7 +118,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -141,7 +135,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -159,7 +152,6 @@ public extension CSBaseDataTransaction {
|
|||||||
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||||
|
|
||||||
CoreStore.assert(
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
||||||
|
|
||||||
CoreStore.assert(
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public extension CSCoreStore {
|
|||||||
}
|
}
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSInMemoryStore` instance
|
- 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.
|
- 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];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSSQLiteStore` instance
|
- 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 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
|
- 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.
|
- 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
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
|
public static func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
|
||||||
|
|
||||||
return self.defaultStack.requiredMigrationsForSQLiteStore(storage, error: error)
|
return self.defaultStack.requiredMigrationsForSQLiteStore(storage, error: error)
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public extension CSCoreStore {
|
|||||||
- returns: a `CSObjectMonitor` that monitors changes to `object`
|
- returns: a `CSObjectMonitor` that monitors changes to `object`
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
|
public static func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
|
||||||
|
|
||||||
return self.defaultStack.monitorObject(object)
|
return self.defaultStack.monitorObject(object)
|
||||||
@@ -54,7 +53,6 @@ public extension CSCoreStore {
|
|||||||
- returns: a `CSListMonitor` instance that monitors changes to the list
|
- returns: a `CSListMonitor` instance that monitors changes to the list
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
public static func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
||||||
|
|
||||||
return self.defaultStack.monitorListFrom(from, fetchClauses: fetchClauses)
|
return self.defaultStack.monitorListFrom(from, fetchClauses: fetchClauses)
|
||||||
@@ -86,7 +84,6 @@ public extension CSCoreStore {
|
|||||||
- returns: a `CSListMonitor` instance that monitors changes to the list
|
- returns: a `CSListMonitor` instance that monitors changes to the list
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
public static func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
||||||
|
|
||||||
return self.defaultStack.monitorSectionedListFrom(
|
return self.defaultStack.monitorSectionedListFrom(
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public extension CSCoreStore {
|
|||||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
public static func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
||||||
|
|
||||||
return self.defaultStack.fetchExistingObject(object)
|
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.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
||||||
|
|
||||||
return self.defaultStack.fetchExistingObjectWithID(objectID)
|
return self.defaultStack.fetchExistingObjectWithID(objectID)
|
||||||
@@ -64,7 +62,6 @@ public extension CSCoreStore {
|
|||||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
||||||
|
|
||||||
return self.defaultStack.fetchExistingObjects(objects)
|
return self.defaultStack.fetchExistingObjects(objects)
|
||||||
@@ -77,7 +74,6 @@ public extension CSCoreStore {
|
|||||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
||||||
|
|
||||||
return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs)
|
return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs)
|
||||||
@@ -91,7 +87,6 @@ public extension CSCoreStore {
|
|||||||
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||||
|
|
||||||
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
|
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
|
||||||
@@ -105,7 +100,6 @@ public extension CSCoreStore {
|
|||||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
||||||
|
|
||||||
return self.defaultStack.fetchAllFrom(from, fetchClauses: fetchClauses)
|
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
|
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
public static func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||||
|
|
||||||
return self.defaultStack.fetchCountFrom(from, fetchClauses: fetchClauses)
|
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
|
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
public static func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||||
|
|
||||||
return self.defaultStack.fetchObjectIDFrom(from, fetchClauses: fetchClauses)
|
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
|
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
public static func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||||
|
|
||||||
return self.defaultStack.fetchObjectIDsFrom(from, fetchClauses: fetchClauses)
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
||||||
|
|
||||||
return self.defaultStack.queryValueFrom(from, selectClause: selectClause, queryClauses: queryClauses)
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
||||||
|
|
||||||
return self.defaultStack.queryAttributesFrom(from, selectClause: selectClause, queryClauses: queryClauses)
|
return self.defaultStack.queryAttributesFrom(from, selectClause: selectClause, queryClauses: queryClauses)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public extension CSCoreStore {
|
|||||||
@objc
|
@objc
|
||||||
public static func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
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];
|
CSSQLiteStore *storage = [CSCoreStore addInMemoryStorageAndWaitAndReturnError:&error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSInMemoryStore` added to the `defaultStack`
|
- returns: the `CSInMemoryStore` added to the `defaultStack`
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +90,6 @@ public extension CSCoreStore {
|
|||||||
```
|
```
|
||||||
CSSQLiteStore *storage = [CSCoreStore addSQLiteStorageAndWaitAndReturnError:&error];
|
CSSQLiteStore *storage = [CSCoreStore addSQLiteStorageAndWaitAndReturnError:&error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSSQLiteStore` added to the `defaultStack`
|
- returns: the `CSSQLiteStore` added to the `defaultStack`
|
||||||
*/
|
*/
|
||||||
@@ -110,7 +108,6 @@ public extension CSCoreStore {
|
|||||||
addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"]
|
addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"]
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSInMemoryStore`
|
- parameter storage: the `CSInMemoryStore`
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSInMemoryStore` added to the `defaultStack`
|
- returns: the `CSInMemoryStore` added to the `defaultStack`
|
||||||
@@ -130,7 +127,6 @@ public extension CSCoreStore {
|
|||||||
addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"]
|
addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"]
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSSQLiteStore`
|
- parameter storage: the `CSSQLiteStore`
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSSQLiteStore` added to the `defaultStack`
|
- returns: the `CSSQLiteStore` added to the `defaultStack`
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ public extension CSCoreStore {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func beginUnsafe() -> CSUnsafeDataTransaction {
|
public static func beginUnsafe() -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
@@ -86,7 +85,6 @@ public extension CSCoreStore {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public static func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
public static func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public extension CSDataStack {
|
|||||||
}
|
}
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSInMemoryStore` instance
|
- 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.
|
- 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];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSSQLiteStore` instance
|
- 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 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
|
- 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.
|
- 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
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
|
public func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
|
||||||
|
|
||||||
return bridge(error) {
|
return bridge(error) {
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public extension CSDataStack {
|
|||||||
- returns: a `ObjectMonitor` that monitors changes to `object`
|
- returns: a `ObjectMonitor` that monitors changes to `object`
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
|
public func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
@@ -57,7 +56,6 @@ public extension CSDataStack {
|
|||||||
- returns: a `CSListMonitor` instance that monitors changes to the list
|
- returns: a `CSListMonitor` instance that monitors changes to the list
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
public func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -124,7 +122,6 @@ public extension CSDataStack {
|
|||||||
- returns: a `CSListMonitor` instance that monitors changes to the list
|
- returns: a `CSListMonitor` instance that monitors changes to the list
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
public func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public extension CSDataStack {
|
|||||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -58,7 +57,6 @@ public extension CSDataStack {
|
|||||||
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -78,7 +76,6 @@ public extension CSDataStack {
|
|||||||
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
|
||||||
|
|
||||||
return objects.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0.objectID) }
|
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
|
- returns: the `NSManagedObject` array for objects that exists in the transaction
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
|
||||||
|
|
||||||
return objectIDs.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0) }
|
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
|
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -123,7 +118,6 @@ public extension CSDataStack {
|
|||||||
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -141,7 +135,6 @@ public extension CSDataStack {
|
|||||||
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
- returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -159,7 +152,6 @@ public extension CSDataStack {
|
|||||||
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
- returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -177,7 +169,6 @@ public extension CSDataStack {
|
|||||||
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
- returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
public func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
|
||||||
|
|
||||||
CoreStore.assert(
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
|
||||||
|
|
||||||
CoreStore.assert(
|
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.
|
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ public extension CSDataStack {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func beginUnsafe() -> CSUnsafeDataTransaction {
|
public func beginUnsafe() -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
@@ -86,7 +85,6 @@ public extension CSDataStack {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
|||||||
@objc
|
@objc
|
||||||
public func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
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];
|
CSSQLiteStore *storage = [dataStack addInMemoryStorageAndWaitAndReturnError:&error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSInMemoryStore` added to the stack
|
- returns: the `CSInMemoryStore` added to the stack
|
||||||
*/
|
*/
|
||||||
@@ -180,7 +179,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
|||||||
```
|
```
|
||||||
CSSQLiteStore *storage = [dataStack addSQLiteStorageAndWaitAndReturnError:&error];
|
CSSQLiteStore *storage = [dataStack addSQLiteStorageAndWaitAndReturnError:&error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSSQLiteStore` added to the stack
|
- returns: the `CSSQLiteStore` added to the stack
|
||||||
*/
|
*/
|
||||||
@@ -202,7 +200,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
|||||||
addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"]
|
addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"]
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSInMemoryStore`
|
- parameter storage: the `CSInMemoryStore`
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSInMemoryStore` added to the stack
|
- returns: the `CSInMemoryStore` added to the stack
|
||||||
@@ -225,7 +222,6 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
|||||||
addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"]
|
addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"]
|
||||||
error: &error];
|
error: &error];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `CSSQLiteStore`
|
- parameter storage: the `CSSQLiteStore`
|
||||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||||
- returns: the `CSSQLiteStore` added to the stack
|
- returns: the `CSSQLiteStore` added to the stack
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
|
|||||||
```
|
```
|
||||||
MyPersonEntity *people = [transaction fetchAllFrom:CSFromClass([MyPersonEntity class])];
|
MyPersonEntity *people = [transaction fetchAllFrom:CSFromClass([MyPersonEntity class])];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@@ -83,7 +82,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
|
|||||||
MyPersonEntity *people = [transaction fetchAllFrom:
|
MyPersonEntity *people = [transaction fetchAllFrom:
|
||||||
CSFromClass([MyPersonEntity class], @"Config1")];
|
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.
|
- 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
|
@objc
|
||||||
@@ -109,7 +107,6 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
|
|||||||
CSFromClass([MyPersonEntity class],
|
CSFromClass([MyPersonEntity class],
|
||||||
@[[NSNull null], @"Config1"])];
|
@[[NSNull null], @"Config1"])];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the associated `NSManagedObject` entity class
|
- 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.
|
- 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
|
|||||||
MyPersonEntity *person = [transaction createInto:
|
MyPersonEntity *person = [transaction createInto:
|
||||||
CSIntoClass([MyPersonEntity class])];
|
CSIntoClass([MyPersonEntity class])];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@@ -77,7 +76,6 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
|
|||||||
MyPersonEntity *person = [transaction createInto:
|
MyPersonEntity *person = [transaction createInto:
|
||||||
CSIntoClass([MyPersonEntity class])];
|
CSIntoClass([MyPersonEntity class])];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
- 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.
|
- 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: `YES` if at least one object in any section exists, `NO` otherwise
|
- returns: `YES` if at least one object in any section exists, `NO` otherwise
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func hasObjects() -> Bool {
|
public func hasObjects() -> Bool {
|
||||||
|
|
||||||
return self.bridgeToSwift.hasObjects()
|
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
|
- returns: `YES` if at least one object in the specified section exists, `NO` otherwise
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func hasObjectsInSection(_ section: Int) -> Bool {
|
public func hasObjectsInSection(_ section: Int) -> Bool {
|
||||||
|
|
||||||
return self.bridgeToSwift.hasObjectsInSection(section)
|
return self.bridgeToSwift.hasObjectsInSection(section)
|
||||||
@@ -146,7 +144,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: all objects in all sections
|
- returns: all objects in all sections
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func objectsInAllSections() -> [NSManagedObject] {
|
public func objectsInAllSections() -> [NSManagedObject] {
|
||||||
|
|
||||||
return self.bridgeToSwift.objectsInAllSections()
|
return self.bridgeToSwift.objectsInAllSections()
|
||||||
@@ -159,7 +156,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: all objects in the specified section
|
- returns: all objects in the specified section
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func objectsInSection(_ section: Int) -> [NSManagedObject] {
|
public func objectsInSection(_ section: Int) -> [NSManagedObject] {
|
||||||
|
|
||||||
return self.bridgeToSwift.objectsInSection(section)
|
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
|
- returns: all objects in the specified section, or `nil` if out of bounds
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func objectsInSafeSection(safeSectionIndex section: Int) -> [NSManagedObject]? {
|
public func objectsInSafeSection(safeSectionIndex section: Int) -> [NSManagedObject]? {
|
||||||
|
|
||||||
return self.bridgeToSwift.objectsInSection(safeSectionIndex: section)
|
return self.bridgeToSwift.objectsInSection(safeSectionIndex: section)
|
||||||
@@ -184,7 +179,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: the number of sections
|
- returns: the number of sections
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func numberOfSections() -> Int {
|
public func numberOfSections() -> Int {
|
||||||
|
|
||||||
return self.bridgeToSwift.numberOfSections()
|
return self.bridgeToSwift.numberOfSections()
|
||||||
@@ -196,7 +190,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: the number of objects in all sections
|
- returns: the number of objects in all sections
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func numberOfObjects() -> Int {
|
public func numberOfObjects() -> Int {
|
||||||
|
|
||||||
return self.bridgeToSwift.numberOfObjects()
|
return self.bridgeToSwift.numberOfObjects()
|
||||||
@@ -209,7 +202,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: the number of objects in the specified section
|
- returns: the number of objects in the specified section
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func numberOfObjectsInSection(_ section: Int) -> Int {
|
public func numberOfObjectsInSection(_ section: Int) -> Int {
|
||||||
|
|
||||||
return self.bridgeToSwift.numberOfObjectsInSection(section)
|
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
|
- returns: the number of objects in the specified section, or `nil` if out of bounds
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func numberOfObjectsInSafeSection(safeSectionIndex section: Int) -> NSNumber? {
|
public func numberOfObjectsInSafeSection(safeSectionIndex section: Int) -> NSNumber? {
|
||||||
|
|
||||||
return self.bridgeToSwift.numberOfObjectsInSection(safeSectionIndex: section)
|
return self.bridgeToSwift.numberOfObjectsInSection(safeSectionIndex: section)
|
||||||
@@ -235,7 +226,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: the `NSFetchedResultsSectionInfo` for the specified section
|
- returns: the `NSFetchedResultsSectionInfo` for the specified section
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func sectionInfoAtIndex(_ section: Int) -> NSFetchedResultsSectionInfo {
|
public func sectionInfoAtIndex(_ section: Int) -> NSFetchedResultsSectionInfo {
|
||||||
|
|
||||||
return self.bridgeToSwift.sectionInfoAtIndex(section)
|
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.
|
- returns: the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if the section index is out of bounds.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func sectionInfoAtSafeSectionIndex(safeSectionIndex section: Int) -> NSFetchedResultsSectionInfo? {
|
public func sectionInfoAtSafeSectionIndex(safeSectionIndex section: Int) -> NSFetchedResultsSectionInfo? {
|
||||||
|
|
||||||
return self.bridgeToSwift.sectionInfoAtIndex(safeSectionIndex: section)
|
return self.bridgeToSwift.sectionInfoAtIndex(safeSectionIndex: section)
|
||||||
@@ -260,7 +249,6 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
|||||||
- returns: the `NSFetchedResultsSectionInfo`s for all sections
|
- returns: the `NSFetchedResultsSectionInfo`s for all sections
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func sections() -> [NSFetchedResultsSectionInfo] {
|
public func sections() -> [NSFetchedResultsSectionInfo] {
|
||||||
|
|
||||||
return self.bridgeToSwift.sections()
|
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.
|
- returns: the target section for the specified "Section Index" title and index.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func targetSectionForSectionIndexTitle(title: String, index: Int) -> Int {
|
public func targetSectionForSectionIndexTitle(title: String, index: Int) -> Int {
|
||||||
|
|
||||||
return self.bridgeToSwift.targetSectionForSectionIndex(title: title, index: index)
|
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
|
- returns: the section index titles for all sections
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func sectionIndexTitles() -> [String] {
|
public func sectionIndexTitles() -> [String] {
|
||||||
|
|
||||||
return self.bridgeToSwift.sectionIndexTitles()
|
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.
|
- returns: the index of the `NSManagedObject` if it exists in the `CSListMonitor`'s fetched objects, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func indexOf(_ object: NSManagedObject) -> NSNumber? {
|
public func indexOf(_ object: NSManagedObject) -> NSNumber? {
|
||||||
|
|
||||||
return self.bridgeToSwift.indexOf(object)
|
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.
|
- returns: the `NSIndexPath` of the `NSManagedObject` if it exists in the `ListMonitor`'s fetched objects, or `nil` if not found.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func indexPathOf(_ object: NSManagedObject) -> IndexPath? {
|
public func indexPathOf(_ object: NSManagedObject) -> IndexPath? {
|
||||||
|
|
||||||
return self.bridgeToSwift.indexPathOf(object)
|
return self.bridgeToSwift.indexPathOf(object)
|
||||||
|
|||||||
@@ -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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
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.
|
- parameter success: the block to execute on success. The block passes an array of `CSMigrationType`s that indicates the migration steps completed.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
guard case .failure(let error) = self.bridgeToSwift else {
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
|
|||||||
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
||||||
fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]];
|
fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter sortDescriptor: a `NSSortDescriptor`
|
- parameter sortDescriptor: a `NSSortDescriptor`
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@@ -69,7 +68,6 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
|
|||||||
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
||||||
fetchClauses:@[CSOrderByKeys(CSSortAscending(@"fullname"), CSSortDescending(@"age"), nil))]]];
|
fetchClauses:@[CSOrderByKeys(CSSortAscending(@"fullname"), CSSortDescending(@"age"), nil))]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter sortDescriptors: an array of `NSSortDescriptor`s
|
- parameter sortDescriptors: an array of `NSSortDescriptor`s
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
|
|||||||
@@ -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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
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.
|
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
guard case .failure(let error) = self.bridgeToSwift else {
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
|
|||||||
select:CSSelectString(CSAttribute(@"fullname"))
|
select:CSSelectString(CSAttribute(@"fullname"))
|
||||||
fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
|
fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- parameter keyPath: the attribute name
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@@ -61,7 +60,6 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
|
|||||||
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect numberForTerm:[CSSelectTerm average:@"age" as:nil]]];
|
select:[CSSelect numberForTerm:[CSSelectTerm average:@"age" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect numberForTerm:[CSSelectTerm count:@"employeeID" as:nil]]];
|
select:[CSSelect numberForTerm:[CSSelectTerm count:@"employeeID" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect numberForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
|
select:[CSSelect numberForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect numberForTerm:[CSSelectTerm minimum:@"age" as:nil]]];
|
select:[CSSelect numberForTerm:[CSSelectTerm minimum:@"age" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect numberForTerm:[CSSelectTerm sum:@"age" as:nil]]];
|
select:[CSSelect numberForTerm:[CSSelectTerm sum:@"age" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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]]
|
select:[CSSelect objectIDForTerm:[CSSelectTerm objectIDAs:nil]]
|
||||||
fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
|
fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter keyPath: the attribute name
|
- 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
|
- 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
|
- 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"))
|
select:CSSelectNumber(CSAggregateMax(@"age"))
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(numberTerm: CSSelectTerm) {
|
public convenience init(numberTerm: CSSelectTerm) {
|
||||||
@@ -237,7 +229,6 @@ public final class CSSelect: NSObject {
|
|||||||
select:CSSelectDecimal(CSAggregateAverage(@"price"))
|
select:CSSelectDecimal(CSAggregateAverage(@"price"))
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(decimalTerm: CSSelectTerm) {
|
public convenience init(decimalTerm: CSSelectTerm) {
|
||||||
@@ -253,7 +244,6 @@ public final class CSSelect: NSObject {
|
|||||||
select:CSSelectString(CSAttribute(@"fullname"))
|
select:CSSelectString(CSAttribute(@"fullname"))
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(stringTerm: CSSelectTerm) {
|
public convenience init(stringTerm: CSSelectTerm) {
|
||||||
@@ -269,7 +259,6 @@ public final class CSSelect: NSObject {
|
|||||||
select:CSSelectDate(CSAggregateMax(@"updatedDate"))
|
select:CSSelectDate(CSAggregateMax(@"updatedDate"))
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(dateTerm: CSSelectTerm) {
|
public convenience init(dateTerm: CSSelectTerm) {
|
||||||
@@ -285,7 +274,6 @@ public final class CSSelect: NSObject {
|
|||||||
select:CSSelectData(CSAttribute(@"imageData"))
|
select:CSSelectData(CSAttribute(@"imageData"))
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(dataTerm: CSSelectTerm) {
|
public convenience init(dataTerm: CSSelectTerm) {
|
||||||
@@ -301,7 +289,6 @@ public final class CSSelect: NSObject {
|
|||||||
select:CSSelectObjectID()
|
select:CSSelectObjectID()
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
*/
|
*/
|
||||||
public convenience init(objectIDTerm: ()) {
|
public convenience init(objectIDTerm: ()) {
|
||||||
@@ -316,7 +303,6 @@ public final class CSSelect: NSObject {
|
|||||||
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
|
||||||
select:[CSSelect dictionaryForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
|
select:[CSSelect dictionaryForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
- parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
|
||||||
- returns: a `CSSelect` clause for querying an entity attribute
|
- returns: a `CSSelect` clause for querying an entity attribute
|
||||||
*/
|
*/
|
||||||
@@ -335,7 +321,6 @@ public final class CSSelect: NSObject {
|
|||||||
[CSSelectTerm attribute:@"age" as:nil]
|
[CSSelectTerm attribute:@"age" as:nil]
|
||||||
]]];
|
]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter terms: the `CSSelectTerm`s specifying the attribute/aggregate values to query
|
- parameter terms: the `CSSelectTerm`s specifying the attribute/aggregate values to query
|
||||||
- returns: a `CSSelect` clause for querying an entity attribute
|
- returns: a `CSSelect` clause for querying an entity attribute
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@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 {
|
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.
|
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
public func handleSuccess(@noescape _ success: (storage: CSStorageInterface) -> Void) {
|
public func handleSuccess(_ success: @noescape (storage: CSStorageInterface) -> Void) {
|
||||||
|
|
||||||
guard let storage = self.storage else {
|
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.
|
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
public func handleFailure(@noescape _ failure: (error: NSError) -> Void) {
|
public func handleFailure(_ failure: @noescape (error: NSError) -> Void) {
|
||||||
|
|
||||||
guard let error = self.error else {
|
guard let error = self.error else {
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func beginUnsafe() -> CSUnsafeDataTransaction {
|
public func beginUnsafe() -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
@@ -141,7 +140,6 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
|||||||
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
- returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
|
||||||
|
|
||||||
return bridge {
|
return bridge {
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
|||||||
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
||||||
fetchClauses:@[CSWhereValue(YES)]]];
|
fetchClauses:@[CSWhereValue(YES)]]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter value: the boolean value for the predicate
|
- parameter value: the boolean value for the predicate
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@@ -70,7 +69,6 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
|||||||
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
fetchAllFrom:CSFromClass([MyPersonEntity class])
|
||||||
fetchClauses:@[CSWherePredicate(predicate)]];
|
fetchClauses:@[CSWherePredicate(predicate)]];
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter format: the format string for the predicate
|
- parameter format: the format string for the predicate
|
||||||
- parameter argumentArray: the arguments for `format`
|
- parameter argumentArray: the arguments for `format`
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public extension NSManagedObject {
|
|||||||
- returns: the primitive value for the KVC key
|
- returns: the primitive value for the KVC key
|
||||||
*/
|
*/
|
||||||
@objc
|
@objc
|
||||||
@warn_unused_result
|
|
||||||
public func cs_accessValueForKVCKey(_ KVCKey: KeyPath) -> AnyObject? {
|
public func cs_accessValueForKVCKey(_ KVCKey: KeyPath) -> AnyObject? {
|
||||||
|
|
||||||
return self.accessValueForKVCKey(KVCKey)
|
return self.accessValueForKVCKey(KVCKey)
|
||||||
|
|||||||
@@ -311,10 +311,9 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
guard let sections = self.fetchedResultsController.sections
|
guard let sections = self.fetchedResultsController.sections, section < sections.count else {
|
||||||
where section < sections.count else {
|
|
||||||
|
return nil
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return sections[section]
|
return sections[section]
|
||||||
}
|
}
|
||||||
@@ -1105,8 +1104,8 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
|
|||||||
|
|
||||||
self.isPersistentStoreChanging = true
|
self.isPersistentStoreChanging = true
|
||||||
|
|
||||||
guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init)
|
guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init),
|
||||||
where !Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else {
|
!Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,7 +341,8 @@ extension ObjectMonitor: FetchedResultsControllerHandler {
|
|||||||
userInfo: [String(NSManagedObject.self): anObject]
|
userInfo: [String(NSManagedObject.self): anObject]
|
||||||
)
|
)
|
||||||
|
|
||||||
case .update:
|
case .update,
|
||||||
|
.move where indexPath == newIndexPath:
|
||||||
NotificationCenter.default.post(
|
NotificationCenter.default.post(
|
||||||
name: Notification.Name.objectMonitorDidUpdateObject,
|
name: Notification.Name.objectMonitorDidUpdateObject,
|
||||||
object: self,
|
object: self,
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ public extension CoreStore {
|
|||||||
/**
|
/**
|
||||||
Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from `defaultStack`'s model.
|
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()
|
try CoreStore.addStorageAndWait()
|
||||||
```
|
```
|
||||||
|
|
||||||
- returns: the local SQLite storage added to the `defaultStack`
|
- returns: the local SQLite storage added to the `defaultStack`
|
||||||
*/
|
*/
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@@ -77,7 +76,6 @@ public extension CoreStore {
|
|||||||
```
|
```
|
||||||
try CoreStore.addStorageAndWait(InMemoryStore.self)
|
try CoreStore.addStorageAndWait(InMemoryStore.self)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the `StorageInterface` type
|
- parameter storeType: the `StorageInterface` type
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the `StorageInterface` added to the `defaultStack`
|
- returns: the `StorageInterface` added to the `defaultStack`
|
||||||
@@ -93,7 +91,6 @@ public extension CoreStore {
|
|||||||
```
|
```
|
||||||
try CoreStore.addStorageAndWait(InMemoryStore(configuration: "Config1"))
|
try CoreStore.addStorageAndWait(InMemoryStore(configuration: "Config1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `StorageInterface`
|
- parameter storage: the `StorageInterface`
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the `StorageInterface` added to the `defaultStack`
|
- returns: the `StorageInterface` added to the `defaultStack`
|
||||||
@@ -109,7 +106,6 @@ public extension CoreStore {
|
|||||||
```
|
```
|
||||||
try CoreStore.addStorageAndWait(SQLiteStore.self)
|
try CoreStore.addStorageAndWait(SQLiteStore.self)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the `LocalStorageface` type
|
- parameter storeType: the `LocalStorageface` type
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the local storage added to the `defaultStack`
|
- returns: the local storage added to the `defaultStack`
|
||||||
@@ -125,7 +121,6 @@ public extension CoreStore {
|
|||||||
```
|
```
|
||||||
try CoreStore.addStorageAndWait(SQLiteStore(configuration: "Config1"))
|
try CoreStore.addStorageAndWait(SQLiteStore(configuration: "Config1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the local storage
|
- parameter storage: the local storage
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- 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.
|
- 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)
|
try CoreStore.addStorageAndWait(storage)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the local storage
|
- parameter storage: the local storage
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- 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.
|
- 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)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public final class DataStack {
|
|||||||
/**
|
/**
|
||||||
Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass.
|
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(
|
return NSEntityDescription.entity(
|
||||||
forEntityName: self.model.entityNameForClass(type),
|
forEntityName: self.model.entityNameForClass(type),
|
||||||
@@ -116,7 +116,6 @@ public final class DataStack {
|
|||||||
```
|
```
|
||||||
try dataStack.addStorageAndWait()
|
try dataStack.addStorageAndWait()
|
||||||
```
|
```
|
||||||
|
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the local SQLite storage added to the stack
|
- returns: the local SQLite storage added to the stack
|
||||||
*/
|
*/
|
||||||
@@ -131,7 +130,6 @@ public final class DataStack {
|
|||||||
```
|
```
|
||||||
try dataStack.addStorageAndWait(InMemoryStore.self)
|
try dataStack.addStorageAndWait(InMemoryStore.self)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the `StorageInterface` type
|
- parameter storeType: the `StorageInterface` type
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the `StorageInterface` added to the stack
|
- returns: the `StorageInterface` added to the stack
|
||||||
@@ -147,7 +145,6 @@ public final class DataStack {
|
|||||||
```
|
```
|
||||||
try dataStack.addStorageAndWait(InMemoryStore(configuration: "Config1"))
|
try dataStack.addStorageAndWait(InMemoryStore(configuration: "Config1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the `StorageInterface`
|
- parameter storage: the `StorageInterface`
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the `StorageInterface` added to the stack
|
- returns: the `StorageInterface` added to the stack
|
||||||
@@ -187,7 +184,6 @@ public final class DataStack {
|
|||||||
```
|
```
|
||||||
try dataStack.addStorageAndWait(SQLiteStore.self)
|
try dataStack.addStorageAndWait(SQLiteStore.self)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storeType: the `LocalStorageface` type
|
- parameter storeType: the `LocalStorageface` type
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- throws: a `CoreStoreError` value indicating the failure
|
||||||
- returns: the local storage added to the stack
|
- returns: the local storage added to the stack
|
||||||
@@ -203,7 +199,6 @@ public final class DataStack {
|
|||||||
```
|
```
|
||||||
try dataStack.addStorageAndWait(SQLiteStore(configuration: "Config1"))
|
try dataStack.addStorageAndWait(SQLiteStore(configuration: "Config1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the local storage
|
- parameter storage: the local storage
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- 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.
|
- 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 persistentStore = self.coordinator.persistentStore(for: fileURL as URL) {
|
||||||
|
|
||||||
if let existingStorage = persistentStore.storageInterface as? T
|
if let existingStorage = persistentStore.storageInterface as? T,
|
||||||
where storage.matchesPersistentStore(persistentStore) {
|
storage.matchesPersistentStore(persistentStore) {
|
||||||
|
|
||||||
return existingStorage
|
return existingStorage
|
||||||
}
|
}
|
||||||
@@ -304,7 +299,6 @@ public final class DataStack {
|
|||||||
}
|
}
|
||||||
try dataStack.addStorageAndWait(storage)
|
try dataStack.addStorageAndWait(storage)
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter storage: the local storage
|
- parameter storage: the local storage
|
||||||
- throws: a `CoreStoreError` value indicating the failure
|
- 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.
|
- 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
|
let cacheFileURL = storage.cacheFileURL
|
||||||
if let persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) {
|
if let persistentStore = self.coordinator.persistentStore(for: cacheFileURL as URL) {
|
||||||
|
|
||||||
if let existingStorage = persistentStore.storageInterface as? T
|
if let existingStorage = persistentStore.storageInterface as? T,
|
||||||
where storage.matchesPersistentStore(persistentStore) {
|
storage.matchesPersistentStore(persistentStore) {
|
||||||
|
|
||||||
return existingStorage
|
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
|
// MARK: - DataStack: Equatable
|
||||||
|
|
||||||
@warn_unused_result
|
|
||||||
public func == (lhs: DataStack, rhs: DataStack) -> Bool {
|
public func == (lhs: DataStack, rhs: DataStack) -> Bool {
|
||||||
|
|
||||||
return lhs === rhs
|
return lhs === rhs
|
||||||
|
|||||||
@@ -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 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 ubiquitousContentTransactionLogsSubdirectory: an optional subdirectory path for the transaction logs
|
||||||
- parameter ubiquitousContainerID: a container if your app has multiple ubiquity container identifiers in its entitlements
|
- 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,
|
guard let `self` = self,
|
||||||
let observer = observer,
|
let observer = observer,
|
||||||
let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack
|
let dataStack = note.userInfo?[String(DataStack.self)] as? DataStack,
|
||||||
where self.dataStack === dataStack else {
|
self.dataStack === dataStack else {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import CoreData
|
import CoreData
|
||||||
|
#if USE_FRAMEWORKS
|
||||||
|
import GCDKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// MARK: - LegacySQLiteStore
|
// MARK: - LegacySQLiteStore
|
||||||
@@ -180,7 +183,29 @@ public final class LegacySQLiteStore: LocalStorage, DefaultInitializableStore {
|
|||||||
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
||||||
)
|
)
|
||||||
try journalUpdatingCoordinator.remove(store)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import CoreData
|
import CoreData
|
||||||
|
#if USE_FRAMEWORKS
|
||||||
|
import GCDKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// MARK: - SQLiteStore
|
// MARK: - SQLiteStore
|
||||||
@@ -177,7 +180,29 @@ public final class SQLiteStore: LocalStorage, DefaultInitializableStore {
|
|||||||
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
options: [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
|
||||||
)
|
)
|
||||||
try journalUpdatingCoordinator.remove(store)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public struct Into<T: NSManagedObject>: Hashable {
|
|||||||
```
|
```
|
||||||
let person = transaction.create(Into(MyPersonEntity.self))
|
let person = transaction.create(Into(MyPersonEntity.self))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the `NSManagedObject` type to be created
|
- parameter entity: the `NSManagedObject` type to be created
|
||||||
*/
|
*/
|
||||||
public init(_ entity: T.Type) {
|
public init(_ entity: T.Type) {
|
||||||
@@ -81,7 +80,6 @@ public struct Into<T: NSManagedObject>: Hashable {
|
|||||||
```
|
```
|
||||||
let person = transaction.create(Into(MyPersonEntity.self))
|
let person = transaction.create(Into(MyPersonEntity.self))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
- parameter entityClass: the `NSManagedObject` class type to be created
|
||||||
*/
|
*/
|
||||||
public init(_ entityClass: AnyClass) {
|
public init(_ entityClass: AnyClass) {
|
||||||
@@ -98,7 +96,6 @@ public struct Into<T: NSManagedObject>: Hashable {
|
|||||||
```
|
```
|
||||||
let person = transaction.create(Into<MyPersonEntity>("Configuration1"))
|
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.
|
- 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?) {
|
public init(_ configuration: String?) {
|
||||||
@@ -111,7 +108,6 @@ public struct Into<T: NSManagedObject>: Hashable {
|
|||||||
```
|
```
|
||||||
let person = transaction.create(Into(MyPersonEntity.self, "Configuration1"))
|
let person = transaction.create(Into(MyPersonEntity.self, "Configuration1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entity: the `NSManagedObject` type to be created
|
- 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.
|
- 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"))
|
let person = transaction.create(Into(MyPersonEntity.self, "Configuration1"))
|
||||||
```
|
```
|
||||||
|
|
||||||
- parameter entityClass: the `NSManagedObject` class type to be created
|
- 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.
|
- 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user