mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-24 18:31:41 +01:00
removed deprecated functions in unit tests and demo app
This commit is contained in:
@@ -22,8 +22,8 @@ private struct Static {
|
|||||||
localStorageOptions: .recreateStoreOnModelMismatch
|
localStorageOptions: .recreateStoreOnModelMismatch
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
_ = try? dataStack.perform(
|
||||||
_ = dataStack.beginSynchronous { (transaction) -> Void in
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
transaction.deleteAll(From<TimeZone>())
|
transaction.deleteAll(From<TimeZone>())
|
||||||
|
|
||||||
@@ -38,10 +38,8 @@ private struct Static {
|
|||||||
cachedTimeZone.hasDaylightSavingTime = rawTimeZone.isDaylightSavingTime
|
cachedTimeZone.hasDaylightSavingTime = rawTimeZone.isDaylightSavingTime
|
||||||
cachedTimeZone.daylightSavingTimeOffset = rawTimeZone.daylightSavingTimeOffset
|
cachedTimeZone.daylightSavingTimeOffset = rawTimeZone.daylightSavingTimeOffset
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
return dataStack
|
return dataStack
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,11 +172,13 @@ class ListObserverDemoViewController: UITableViewController, ListSectionObserver
|
|||||||
|
|
||||||
case .delete:
|
case .delete:
|
||||||
let palette = Static.palettes[indexPath]
|
let palette = Static.palettes[indexPath]
|
||||||
CoreStore.beginAsynchronous{ (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
transaction.delete(palette)
|
transaction.delete(palette)
|
||||||
transaction.commit { (result) -> Void in }
|
},
|
||||||
}
|
completion: { _ in }
|
||||||
|
)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@@ -263,11 +265,13 @@ class ListObserverDemoViewController: UITableViewController, ListSectionObserver
|
|||||||
|
|
||||||
@IBAction private dynamic func resetBarButtonItemTouched(_ sender: AnyObject?) {
|
@IBAction private dynamic func resetBarButtonItemTouched(_ sender: AnyObject?) {
|
||||||
|
|
||||||
CoreStore.beginAsynchronous { (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
transaction.deleteAll(From<Palette>())
|
transaction.deleteAll(From<Palette>())
|
||||||
transaction.commit()
|
},
|
||||||
}
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction private dynamic func filterBarButtonItemTouched(_ sender: AnyObject?) {
|
@IBAction private dynamic func filterBarButtonItemTouched(_ sender: AnyObject?) {
|
||||||
@@ -277,13 +281,14 @@ class ListObserverDemoViewController: UITableViewController, ListSectionObserver
|
|||||||
|
|
||||||
@IBAction private dynamic func addBarButtonItemTouched(_ sender: AnyObject?) {
|
@IBAction private dynamic func addBarButtonItemTouched(_ sender: AnyObject?) {
|
||||||
|
|
||||||
CoreStore.beginAsynchronous { (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
let palette = transaction.create(Into<Palette>())
|
let palette = transaction.create(Into<Palette>())
|
||||||
palette.setInitialValues()
|
palette.setInitialValues()
|
||||||
|
},
|
||||||
transaction.commit()
|
completion: { _ in }
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setTable(enabled: Bool) {
|
private func setTable(enabled: Bool) {
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
CoreStore.beginSynchronous { (transaction) -> Void in
|
_ = try? CoreStore.perform(
|
||||||
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
let palette = transaction.create(Into(Palette.self))
|
let palette = transaction.create(Into(Palette.self))
|
||||||
palette.setInitialValues()
|
palette.setInitialValues()
|
||||||
|
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
let palette = CoreStore.fetchOne(From<Palette>(), OrderBy(.ascending(#keyPath(Palette.hue))))!
|
let palette = CoreStore.fetchOne(From<Palette>(), OrderBy(.ascending(#keyPath(Palette.hue))))!
|
||||||
self.monitor = CoreStore.monitorObject(palette)
|
self.monitor = CoreStore.monitorObject(palette)
|
||||||
@@ -121,49 +121,57 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver {
|
|||||||
@IBAction dynamic func hueSliderValueDidChange(_ sender: AnyObject?) {
|
@IBAction dynamic func hueSliderValueDidChange(_ sender: AnyObject?) {
|
||||||
|
|
||||||
let hue = self.hueSlider?.value ?? 0
|
let hue = self.hueSlider?.value ?? 0
|
||||||
CoreStore.beginAsynchronous { [weak self] (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { [weak self] (transaction) in
|
||||||
|
|
||||||
if let palette = transaction.edit(self?.monitor?.object) {
|
if let palette = transaction.edit(self?.monitor?.object) {
|
||||||
|
|
||||||
palette.hue = Int32(hue)
|
palette.hue = Int32(hue)
|
||||||
transaction.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction dynamic func saturationSliderValueDidChange(_ sender: AnyObject?) {
|
@IBAction dynamic func saturationSliderValueDidChange(_ sender: AnyObject?) {
|
||||||
|
|
||||||
let saturation = self.saturationSlider?.value ?? 0
|
let saturation = self.saturationSlider?.value ?? 0
|
||||||
CoreStore.beginAsynchronous { [weak self] (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { [weak self] (transaction) in
|
||||||
|
|
||||||
if let palette = transaction.edit(self?.monitor?.object) {
|
if let palette = transaction.edit(self?.monitor?.object) {
|
||||||
|
|
||||||
palette.saturation = saturation
|
palette.saturation = saturation
|
||||||
transaction.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction dynamic func brightnessSliderValueDidChange(_ sender: AnyObject?) {
|
@IBAction dynamic func brightnessSliderValueDidChange(_ sender: AnyObject?) {
|
||||||
|
|
||||||
let brightness = self.brightnessSlider?.value ?? 0
|
let brightness = self.brightnessSlider?.value ?? 0
|
||||||
CoreStore.beginAsynchronous { [weak self] (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { [weak self] (transaction) in
|
||||||
|
|
||||||
if let palette = transaction.edit(self?.monitor?.object) {
|
if let palette = transaction.edit(self?.monitor?.object) {
|
||||||
|
|
||||||
palette.brightness = brightness
|
palette.brightness = brightness
|
||||||
transaction.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction dynamic func deleteBarButtonTapped(_ sender: AnyObject?) {
|
@IBAction dynamic func deleteBarButtonTapped(_ sender: AnyObject?) {
|
||||||
|
|
||||||
CoreStore.beginAsynchronous { [weak self] (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { [weak self] (transaction) in
|
||||||
|
|
||||||
transaction.delete(self?.monitor?.object)
|
transaction.delete(self?.monitor?.object)
|
||||||
transaction.commit()
|
},
|
||||||
}
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func reloadPaletteInfo(_ palette: Palette, changedKeys: Set<String>?) {
|
func reloadPaletteInfo(_ palette: Palette, changedKeys: Set<String>?) {
|
||||||
|
|||||||
@@ -98,10 +98,9 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
|
|||||||
switch self.segmentedControl?.selectedSegmentIndex {
|
switch self.segmentedControl?.selectedSegmentIndex {
|
||||||
|
|
||||||
case 0?:
|
case 0?:
|
||||||
self.dataStack.beginAsynchronous { (transaction) -> Void in
|
let request = NSFetchRequest<NSFetchRequestResult>()
|
||||||
|
Where(true).applyToFetchRequest(request)
|
||||||
_ = transaction.create(Into<Palette>())
|
Where(false).applyToFetchRequest(request)
|
||||||
}
|
|
||||||
|
|
||||||
case 1?:
|
case 1?:
|
||||||
_ = try? dataStack.addStorageAndWait(
|
_ = try? dataStack.addStorageAndWait(
|
||||||
@@ -112,10 +111,9 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
|
|||||||
)
|
)
|
||||||
|
|
||||||
case 2?:
|
case 2?:
|
||||||
self.dataStack.beginAsynchronous { (transaction) -> Void in
|
DispatchQueue.global(qos: .background).async {
|
||||||
|
|
||||||
transaction.commit()
|
_ = self.dataStack.fetchOne(From<Palette>())
|
||||||
transaction.commit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -115,16 +115,17 @@ class MigrationsDemoViewController: UIViewController, ListObserver, UITableViewD
|
|||||||
|
|
||||||
self.setSelectedIndexPath(indexPath, scrollToSelection: false)
|
self.setSelectedIndexPath(indexPath, scrollToSelection: false)
|
||||||
self.setEnabled(false)
|
self.setEnabled(false)
|
||||||
dataStack.beginAsynchronous { [weak self] (transaction) -> Void in
|
dataStack.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
let organism = transaction.edit(organism) as! OrganismProtocol
|
let organism = transaction.edit(organism) as! OrganismProtocol
|
||||||
organism.mutate()
|
organism.mutate()
|
||||||
|
},
|
||||||
transaction.commit { _ -> Void in
|
completion: { [weak self] _ in
|
||||||
|
|
||||||
self?.setEnabled(true)
|
self?.setEnabled(true)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
@@ -250,7 +251,8 @@ class MigrationsDemoViewController: UIViewController, ListObserver, UITableViewD
|
|||||||
|
|
||||||
for i: Int64 in 0 ..< 20 {
|
for i: Int64 in 0 ..< 20 {
|
||||||
|
|
||||||
dataStack.beginAsynchronous { (transaction) -> Void in
|
dataStack.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
for j: Int64 in 0 ..< 500 {
|
for j: Int64 in 0 ..< 500 {
|
||||||
|
|
||||||
@@ -258,17 +260,17 @@ class MigrationsDemoViewController: UIViewController, ListObserver, UITableViewD
|
|||||||
organism.dna = (i * 500) + j + 1
|
organism.dna = (i * 500) + j + 1
|
||||||
organism.mutate()
|
organism.mutate()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
transaction.commit()
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
dataStack.perform(
|
||||||
dataStack.beginAsynchronous { [weak self] (transaction) -> Void in
|
asynchronous: { _ in },
|
||||||
|
completion: { [weak self] _ in
|
||||||
transaction.commit { _ in
|
|
||||||
|
|
||||||
self?.setEnabled(true)
|
self?.setEnabled(true)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ private struct Static {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = dataStack.beginSynchronous { (transaction) -> Void in
|
_ = try? dataStack.perform(
|
||||||
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
transaction.deleteAll(From<UserAccount>())
|
transaction.deleteAll(From<UserAccount>())
|
||||||
|
|
||||||
@@ -46,9 +47,8 @@ private struct Static {
|
|||||||
account2.accountType = "Facebook"
|
account2.accountType = "Facebook"
|
||||||
account2.name = "Jane Doe HCD"
|
account2.name = "Jane Doe HCD"
|
||||||
account2.friends = 314
|
account2.friends = 314
|
||||||
|
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return dataStack
|
return dataStack
|
||||||
}()
|
}()
|
||||||
@@ -71,7 +71,8 @@ private struct Static {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = dataStack.beginSynchronous { (transaction) -> Void in
|
_ = try? dataStack.perform(
|
||||||
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
transaction.deleteAll(From<UserAccount>())
|
transaction.deleteAll(From<UserAccount>())
|
||||||
|
|
||||||
@@ -84,10 +85,8 @@ private struct Static {
|
|||||||
account2.accountType = "Twitter"
|
account2.accountType = "Twitter"
|
||||||
account2.name = "#janedoe_hcd"
|
account2.name = "#janedoe_hcd"
|
||||||
account2.friends = 100
|
account2.friends = 100
|
||||||
|
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
return dataStack
|
return dataStack
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ private struct Static {
|
|||||||
var place = CoreStore.fetchOne(From<Place>())
|
var place = CoreStore.fetchOne(From<Place>())
|
||||||
if place == nil {
|
if place == nil {
|
||||||
|
|
||||||
_ = CoreStore.beginSynchronous { (transaction) -> Void in
|
_ = try? CoreStore.perform(
|
||||||
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
let place = transaction.create(Into<Place>())
|
let place = transaction.create(Into<Place>())
|
||||||
place.setInitialValues()
|
place.setInitialValues()
|
||||||
|
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
place = CoreStore.fetchOne(From<Place>())
|
place = CoreStore.fetchOne(From<Place>())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,23 +169,26 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec
|
|||||||
gesture.location(in: mapView),
|
gesture.location(in: mapView),
|
||||||
toCoordinateFrom: mapView
|
toCoordinateFrom: mapView
|
||||||
)
|
)
|
||||||
CoreStore.beginAsynchronous { (transaction) -> Void in
|
CoreStore.perform(
|
||||||
|
asynchronous: { (transaction) in
|
||||||
|
|
||||||
let place = transaction.edit(Static.placeController.object)
|
let place = transaction.edit(Static.placeController.object)
|
||||||
place?.coordinate = coordinate
|
place?.coordinate = coordinate
|
||||||
transaction.commit { (_) -> Void in }
|
},
|
||||||
}
|
completion: { _ in }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction dynamic func refreshButtonTapped(_ sender: AnyObject?) {
|
@IBAction dynamic func refreshButtonTapped(_ sender: AnyObject?) {
|
||||||
|
|
||||||
_ = CoreStore.beginSynchronous { (transaction) -> Void in
|
_ = try? CoreStore.perform(
|
||||||
|
synchronous: { (transaction) in
|
||||||
|
|
||||||
let place = transaction.edit(Static.placeController.object)
|
let place = transaction.edit(Static.placeController.object)
|
||||||
place?.setInitialValues()
|
place?.setInitialValues()
|
||||||
_ = transaction.commitAndWait()
|
|
||||||
}
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func geocode(place: Place) {
|
func geocode(place: Place) {
|
||||||
|
|||||||
@@ -213,12 +213,15 @@
|
|||||||
XCTAssertNotNil(transaction);
|
XCTAssertNotNil(transaction);
|
||||||
XCTAssert([transaction isKindOfClass:[CSUnsafeDataTransaction class]]);
|
XCTAssert([transaction isKindOfClass:[CSUnsafeDataTransaction class]]);
|
||||||
NSError *error;
|
NSError *error;
|
||||||
XCTAssertTrue([transaction commitAndWaitWithError:&error]);
|
BOOL result = [transaction commitAndWaitWithError:&error];
|
||||||
|
XCTAssertTrue(result);
|
||||||
XCTAssertNil(error);
|
XCTAssertNil(error);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"sync"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"sync"];
|
||||||
[CSCoreStore beginSynchronous:^(CSSynchronousDataTransaction * _Nonnull transaction) {
|
NSError *error;
|
||||||
|
BOOL result = [CSCoreStore
|
||||||
|
beginSynchronous:^(CSSynchronousDataTransaction * _Nonnull transaction) {
|
||||||
|
|
||||||
XCTAssertNotNil(transaction);
|
XCTAssertNotNil(transaction);
|
||||||
XCTAssert([transaction isKindOfClass:[CSSynchronousDataTransaction class]]);
|
XCTAssert([transaction isKindOfClass:[CSSynchronousDataTransaction class]]);
|
||||||
@@ -226,7 +229,10 @@
|
|||||||
XCTAssertTrue([transaction commitAndWaitWithError:&error]);
|
XCTAssertTrue([transaction commitAndWaitWithError:&error]);
|
||||||
XCTAssertNil(error);
|
XCTAssertNil(error);
|
||||||
[expectation fulfill];
|
[expectation fulfill];
|
||||||
}];
|
}
|
||||||
|
error:&error];
|
||||||
|
XCTAssertTrue(result);
|
||||||
|
XCTAssertNil(error);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"async"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"async"];
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
public func internalContext() -> NSManagedObjectContext {
|
public func internalContext() -> NSManagedObjectContext {
|
||||||
|
|
||||||
return self.unsafeContext()
|
return self.unsafeContext()
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ extension DataStack: FetchableSource, QueryableSource {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
public func internalContext() -> NSManagedObjectContext {
|
public func internalContext() -> NSManagedObjectContext {
|
||||||
|
|
||||||
return self.unsafeContext()
|
return self.unsafeContext()
|
||||||
|
|||||||
@@ -164,6 +164,6 @@ public protocol FetchableSource: class {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
func internalContext() -> NSManagedObjectContext
|
func internalContext() -> NSManagedObjectContext
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,6 @@ public protocol QueryableSource: class {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
func internalContext() -> NSManagedObjectContext
|
func internalContext() -> NSManagedObjectContext
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,13 +95,13 @@ public extension ImportableObject {
|
|||||||
|
|
||||||
// MARK: Obsolete
|
// MARK: Obsolete
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "shouldInsert(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "shouldInsert(from:in:)")
|
||||||
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
||||||
|
|
||||||
return Self.shouldInsert(from: source, in: transaction)
|
return Self.shouldInsert(from: source, in: transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "didInsert(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "didInsert(from:in:)")
|
||||||
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
||||||
|
|
||||||
try self.didInsert(from: source, in: transaction)
|
try self.didInsert(from: source, in: transaction)
|
||||||
|
|||||||
@@ -157,31 +157,31 @@ public extension ImportableUniqueObject {
|
|||||||
|
|
||||||
// MARK: Obsolete
|
// MARK: Obsolete
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "shouldInsert(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "shouldInsert(from:in:)")
|
||||||
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
static func shouldInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
||||||
|
|
||||||
return Self.shouldInsert(from: source, in: transaction)
|
return Self.shouldInsert(from: source, in: transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "shouldUpdate(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "shouldUpdate(from:in:)")
|
||||||
static func shouldUpdateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
static func shouldUpdateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) -> Bool {
|
||||||
|
|
||||||
return Self.shouldUpdate(from: source, in: transaction)
|
return Self.shouldUpdate(from: source, in: transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "uniqueID(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "uniqueID(from:in:)")
|
||||||
static func uniqueIDFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws -> UniqueIDType? {
|
static func uniqueIDFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws -> UniqueIDType? {
|
||||||
|
|
||||||
return try Self.uniqueID(from: source, in: transaction)
|
return try Self.uniqueID(from: source, in: transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "didInsert(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "didInsert(from:in:)")
|
||||||
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
func didInsertFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
||||||
|
|
||||||
try self.didInsert(from: source, in: transaction)
|
try self.didInsert(from: source, in: transaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "update(from:in:)")
|
@available(*, obsoleted: 3.0.0, renamed: "update(from:in:)")
|
||||||
func updateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
func updateFromImportSource(_ source: ImportSource, inTransaction transaction: BaseDataTransaction) throws {
|
||||||
|
|
||||||
try self.update(from: source, in: transaction)
|
try self.update(from: source, in: transaction)
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ extension NSManagedObjectContext: FetchableSource, QueryableSource {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
public func internalContext() -> NSManagedObjectContext {
|
public func internalContext() -> NSManagedObjectContext {
|
||||||
|
|
||||||
return self.unsafeContext()
|
return self.unsafeContext()
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ extension OrderBy: CustomDebugStringConvertible, CoreStoreDebugStringConvertible
|
|||||||
|
|
||||||
// MARK: - SaveResult
|
// MARK: - SaveResult
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
@available(*, deprecated, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
||||||
extension SaveResult: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
|
extension SaveResult: CustomDebugStringConvertible, CoreStoreDebugStringConvertible {
|
||||||
|
|
||||||
// MARK: CustomDebugStringConvertible
|
// MARK: CustomDebugStringConvertible
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
|||||||
|
|
||||||
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new -[CSAsynchronousDataTransaction commitWithSuccess:failure:] method.")
|
@available(*, deprecated, message: "Use the new -[CSAsynchronousDataTransaction commitWithSuccess:failure:] method.")
|
||||||
@objc
|
@objc
|
||||||
public func commitWithCompletion(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
public func commitWithCompletion(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Secondary tasks spawned from CSAsynchronousDataTransactions and CSSynchronousDataTransactions are no longer supported. ")
|
@available(*, deprecated, message: "Secondary tasks spawned from CSAsynchronousDataTransactions and CSSynchronousDataTransactions are no longer supported. ")
|
||||||
@objc
|
@objc
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public extension CSCoreStore {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new +[CSCoreStore beginSynchronous:error:] API that reports failure using an error instance.")
|
@available(*, deprecated, message: "Use the new +[CSCoreStore beginSynchronous:error:] API that reports failure using an error instance.")
|
||||||
@objc
|
@objc
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public static func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
public static func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public extension CSDataStack {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new -[CSDataStack beginSynchronous:error:] API that reports failure using an error instance.")
|
@available(*, deprecated, message: "Use the new -[CSDataStack beginSynchronous:error:] API that reports failure using an error instance.")
|
||||||
@objc
|
@objc
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import CoreData
|
|||||||
|
|
||||||
- SeeAlso: `SaveResult`
|
- SeeAlso: `SaveResult`
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use APIs that report failures with `CSError`s instead.")
|
@available(*, deprecated, message: "Use APIs that report failures with `CSError`s instead.")
|
||||||
@objc
|
@objc
|
||||||
public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
|||||||
|
|
||||||
// MARK: - SaveResult
|
// MARK: - SaveResult
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
@available(*, deprecated, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
||||||
extension SaveResult: CoreStoreSwiftType {
|
extension SaveResult: CoreStoreSwiftType {
|
||||||
|
|
||||||
// MARK: CoreStoreSwiftType
|
// MARK: CoreStoreSwiftType
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
|||||||
|
|
||||||
- returns: a `CSSaveResult` containing the success or failure information
|
- returns: a `CSSaveResult` containing the success or failure information
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new -[CSSynchronousDataTransaction commitAndWaitWithError:] method")
|
@available(*, deprecated, message: "Use the new -[CSSynchronousDataTransaction commitAndWaitWithError:] method")
|
||||||
@objc
|
@objc
|
||||||
public func commitAndWait() -> CSSaveResult {
|
public func commitAndWait() -> CSSaveResult {
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `CSSaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Secondary tasks spawned from CSAsynchronousDataTransactions and CSSynchronousDataTransactions are no longer supported. ")
|
@available(*, deprecated, message: "Secondary tasks spawned from CSAsynchronousDataTransactions and CSSynchronousDataTransactions are no longer supported. ")
|
||||||
@objc
|
@objc
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
|||||||
|
|
||||||
// MARK: Deprecated
|
// MARK: Deprecated
|
||||||
|
|
||||||
@available(*, deprecated: 4.0.0, renamed: "unsafeContext()")
|
@available(*, deprecated, renamed: "unsafeContext()")
|
||||||
@objc
|
@objc
|
||||||
public var internalContext: NSManagedObjectContext {
|
public var internalContext: NSManagedObjectContext {
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
|||||||
|
|
||||||
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new -[CSUnsafeDataTransaction commitWithSuccess:failure:] method")
|
@available(*, deprecated, message: "Use the new -[CSUnsafeDataTransaction commitWithSuccess:failure:] method")
|
||||||
@objc
|
@objc
|
||||||
public func commit(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
public func commit(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
|||||||
|
|
||||||
- returns: a `CSSaveResult` containing the success or failure information
|
- returns: a `CSSaveResult` containing the success or failure information
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new -[CSUnsafeDataTransaction commitAndWaitWithError:] method")
|
@available(*, deprecated, message: "Use the new -[CSUnsafeDataTransaction commitAndWaitWithError:] method")
|
||||||
@objc
|
@objc
|
||||||
public func commitAndWait() -> CSSaveResult {
|
public func commitAndWait() -> CSSaveResult {
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public extension CoreStore {
|
|||||||
|
|
||||||
// MARK: Obsolete
|
// MARK: Obsolete
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "entityDescription(for:)")
|
@available(*, obsoleted: 3.0.0, renamed: "entityDescription(for:)")
|
||||||
public static func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
public static func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
||||||
|
|
||||||
return self.entityDescription(for: type)
|
return self.entityDescription(for: type)
|
||||||
|
|||||||
@@ -530,13 +530,13 @@ public final class DataStack: Equatable {
|
|||||||
|
|
||||||
// MARK: Obsolete
|
// MARK: Obsolete
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "entityDescription(for:)")
|
@available(*, obsoleted: 3.0.0, renamed: "entityDescription(for:)")
|
||||||
public func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
public func entityDescriptionForType(_ type: NSManagedObject.Type) -> NSEntityDescription? {
|
||||||
|
|
||||||
return self.entityDescription(for: type)
|
return self.entityDescription(for: type)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, obsoleted: 4.0.0, renamed: "objectID(forURIRepresentation:)")
|
@available(*, obsoleted: 3.0.0, renamed: "objectID(forURIRepresentation:)")
|
||||||
public func objectIDForURIRepresentation(_ url: URL) -> NSManagedObjectID? {
|
public func objectIDForURIRepresentation(_ url: URL) -> NSManagedObjectID? {
|
||||||
|
|
||||||
return self.objectID(forURIRepresentation: url)
|
return self.objectID(forURIRepresentation: url)
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
|
|||||||
|
|
||||||
- parameter completion: the block executed after the save completes. Success or failure is reported by the `SaveResult` argument of the block.
|
- parameter completion: the block executed after the save completes. Success or failure is reported by the `SaveResult` argument of the block.
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commiting methods `DataStack.perform(asynchronous:completion:)` or `DataStack.perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
@available(*, deprecated, message: "Use the new auto-commiting methods `DataStack.perform(asynchronous:completion:)` or `DataStack.perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
||||||
public func commit(_ completion: @escaping (_ result: SaveResult) -> Void = { _ in }) {
|
public func commit(_ completion: @escaping (_ result: SaveResult) -> Void = { _ in }) {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -235,7 +235,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Secondary tasks spawned from AsynchronousDataTransactions and SynchronousDataTransactions are no longer supported. ")
|
@available(*, deprecated, message: "Secondary tasks spawned from AsynchronousDataTransactions and SynchronousDataTransactions are no longer supported. ")
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public extension CoreStore {
|
|||||||
|
|
||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commiting methods `perform(asynchronous:completion:)` or `perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
@available(*, deprecated, message: "Use the new auto-commiting methods `perform(asynchronous:completion:)` or `perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
||||||
public static func beginAsynchronous(_ closure: @escaping (_ transaction: AsynchronousDataTransaction) -> Void) {
|
public static func beginAsynchronous(_ closure: @escaping (_ transaction: AsynchronousDataTransaction) -> Void) {
|
||||||
|
|
||||||
self.defaultStack.beginAsynchronous(closure)
|
self.defaultStack.beginAsynchronous(closure)
|
||||||
@@ -105,7 +105,7 @@ public extension CoreStore {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commiting method `perform(synchronous:)`. Please read the documentation on the behavior of the new methods.")
|
@available(*, deprecated, message: "Use the new auto-commiting method `perform(synchronous:)`. Please read the documentation on the behavior of the new methods.")
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public static func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
public static func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public extension DataStack {
|
|||||||
|
|
||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commiting methods `perform(asynchronous:completion:)` or `perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
@available(*, deprecated, message: "Use the new auto-commiting methods `perform(asynchronous:completion:)` or `perform(asynchronous:success:failure:)`. Please read the documentation on the behavior of the new methods.")
|
||||||
public func beginAsynchronous(_ closure: @escaping (_ transaction: AsynchronousDataTransaction) -> Void) {
|
public func beginAsynchronous(_ closure: @escaping (_ transaction: AsynchronousDataTransaction) -> Void) {
|
||||||
|
|
||||||
let transaction = AsynchronousDataTransaction(
|
let transaction = AsynchronousDataTransaction(
|
||||||
@@ -192,7 +192,7 @@ public extension DataStack {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commiting method `perform(synchronous:)`. Please read the documentation on the behavior of the new methods.")
|
@available(*, deprecated, message: "Use the new auto-commiting method `perform(synchronous:)`. Please read the documentation on the behavior of the new methods.")
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
@available(*, deprecated, message: "Use the new DataStack.perform(asynchronous:...) and DataStack.perform(synchronous:...) family of APIs")
|
||||||
public enum SaveResult: Hashable {
|
public enum SaveResult: Hashable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
|||||||
|
|
||||||
- returns: a `SaveResult` containing the success or failure information
|
- returns: a `SaveResult` containing the success or failure information
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commit method DataStack.perform(synchronous:waitForAllObservers:)")
|
@available(*, deprecated, message: "Use the new auto-commit method DataStack.perform(synchronous:waitForAllObservers:)")
|
||||||
public func commitAndWait() -> SaveResult {
|
public func commitAndWait() -> SaveResult {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -194,7 +194,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
|||||||
|
|
||||||
- returns: a `SaveResult` containing the success or failure information
|
- returns: a `SaveResult` containing the success or failure information
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Use the new auto-commit method DataStack.perform(synchronous:waitForAllObservers:)")
|
@available(*, deprecated, message: "Use the new auto-commit method DataStack.perform(synchronous:waitForAllObservers:)")
|
||||||
public func commit() -> SaveResult {
|
public func commit() -> SaveResult {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -218,7 +218,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
|||||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||||
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
|
||||||
*/
|
*/
|
||||||
@available(*, deprecated: 4.0.0, message: "Secondary tasks spawned from AsynchronousDataTransactions and SynchronousDataTransactions are no longer supported. ")
|
@available(*, deprecated, message: "Secondary tasks spawned from AsynchronousDataTransactions and SynchronousDataTransactions are no longer supported. ")
|
||||||
@discardableResult
|
@discardableResult
|
||||||
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
public func beginSynchronous(_ closure: @escaping (_ transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user