-* **Swift 5.4:** iOS 11+ / macOS 10.13+ / watchOS 4.0+ / tvOS 11.0+
-* Previously supported Swift versions: [Swift 3.2](https://github.com/JohnEstropia/CoreStore/tree/4.2.3), [Swift 4.2](https://github.com/JohnEstropia/CoreStore/tree/6.2.1), [Swift 5.0](https://github.com/JohnEstropia/CoreStore/tree/6.3.2), [Swift 5.1](https://github.com/JohnEstropia/CoreStore/tree/7.0.4), [Swift 5.3](https://github.com/JohnEstropia/CoreStore/tree/7.3.1)
+* **Swift 5.5:** iOS 11+ / macOS 10.13+ / watchOS 4.0+ / tvOS 11.0+
+* Previously supported Swift versions: [Swift 5.4](https://github.com/JohnEstropia/CoreStore/tree/8.0.1), [Swift 5.3](https://github.com/JohnEstropia/CoreStore/tree/7.3.1), [Swift 5.1](https://github.com/JohnEstropia/CoreStore/tree/7.0.4), [Swift 5.0](https://github.com/JohnEstropia/CoreStore/tree/6.3.2), [Swift 4.2](https://github.com/JohnEstropia/CoreStore/tree/6.2.1), [Swift 3.2](https://github.com/JohnEstropia/CoreStore/tree/4.2.3)
Upgrading from previous CoreStore versions? Check out the [🆕 features](#features) and make sure to read the [Change logs](https://github.com/JohnEstropia/CoreStore/releases).
@@ -67,7 +68,6 @@ CoreStore is part of the [Swift Source Compatibility projects](https://swift.org
- [Observe a single object's per-property updates](#observe-a-single-objects-per-property-updates)
- [Observe a diffable list](#observe-a-diffable-list)
- [Observe detailed list changes](#observe-detailed-list-changes)
- - [Objective-C support](#objective-c-support)
- [Type-safe `CoreStoreObject`s](#type-safe-corestoreobjects)
- [New `@Field` Property Wrapper syntax](#new-field-property-wrapper-syntax)
- [`@Field.Stored` ](#fieldstored)
@@ -198,7 +198,6 @@ CoreStore was (and is) heavily shaped by real-world needs of developing data-dep
- **🎯Free to name entities and their class names independently.** CoreStore gets around a restriction with other Core Data wrappers where the entity name should be the same as the `NSManagedObject` subclass name. CoreStore loads entity-to-class mappings from the managed object model file, so you can assign independent names for the entities and their class names.
- **📙Full Documentation.** No magic here; all public classes, functions, properties, etc. have detailed *Apple Docs*. This *README* also introduces a lot of concepts and explains a lot of CoreStore's behavior.
- **ℹ️Informative (and pretty) logs.** All CoreStore and Core Data-related types now have very informative and pretty print outputs! *(See [Logging and error reporting](#logging-and-error-reporting))*
-- **🎗Objective-C support!** Is your project transitioning from Objective-C to Swift but still can't quite fully convert some huge classes to Swift yet? CoreStore adjusts to the ever-increasing Swift adoption. While still written in pure Swift, all CoreStore types have their corresponding Objective-C-visible "bridging classes". *(See [Objective-C support](#objective-c-support))*
- **🛡More extensive Unit Tests.** Extending CoreStore is safe without having to worry about breaking old behavior.
*Have ideas that may benefit other Core Data users? [Feature Request](https://github.com/JohnEstropia/CoreStore/issues)s are welcome!*
@@ -1676,111 +1675,6 @@ let person2 = self.monitor[1, 2]
// person1 and person2 are the same object
```
-## Objective-C support
-> ⚠️Objective-C support is planned to be deprecated in a future CoreStore version.
-
-All CoreStore types are still written in pure Swift, but most core types have Objective-C "bridging classes" that are visible to Objective-C code. To show a couple of usage examples:
-
-
-
-All of these `CS`-prefixed bridging classes have very similar usage to the existing CoreStore APIs, and ironically *none of them are written in Objective-C*. This is very different to the common approach where apps and libraries write Objective-C APIs just to support both Objective-C and Swift. The advantage with CoreStore's approach is that your Swift codebase can already use the purely-Swift API without further changes in the future, but your "hybrid" codebase can still bridge instances back and forth from Objective-C to Swift.
-
-For example, you may have a new, modern Swift class that holds a `ListMonitor`:
-```swift
-class MyViewController: UIViewController {
- let monitor = dataStack.monitorList(From(), ...)
- // ...
-}
-```
-Now let's say you have a legacy Objective-C class that previously uses `NSFetchedResultsController`. It's easy to switch from `NSFetchedResultsController` to `CSListMonitor`, but converting the rest of this huge class is impractical. You end up with
-```objc
-@interface MYOldViewController: UIViewController
-@property (nonatomic, readonly, strong) CSListMonitor* monitor;
-- (instancetype)initWithMonitor:(CSListMonitor *)monitor;
-@end
-```
-When you need to instantiate this class from Swift, you just call `bridgeToObjectiveC`:
-```swift
-class MyViewController: UIViewController {
- let monitor = dataStack.monitorList(From(), ...)
- func showOldController() {
- let controller = MYOldViewController(monitor: self.monitor.bridgeToObjectiveC)
- self.presentViewController(controller, animated: true, completion: nil)
- }
-}
-```
-Note that the `CSListMonitor` holds the exact same `ListMonitor` instance, which means that no copies and no extra fetching occur.
-
-### Objective-C syntax sugars
-Objective-C tends to be verbose, so some method calls are long and unreadable. For example, fetching looks like this:
-```objc
-NSArray *objects =
-[CSCoreStore
- fetchAllFrom:[[CSFrom alloc] initWithEntityClass:[MYPerson class]]
- fetchClauses:@[[[CSWhere alloc] initWithFormat:@"%K == %@", @"isHidden", @NO],
- [[CSOrderBy alloc] initWithSortDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"lastName" ascending:YES],
- [NSSortDescriptor sortDescriptorWithKey:@"firstName" ascending:YES]]]]];
-```
-Although it works, it looks terrible. For this, CoreStore provides *CoreStoreBridge.h* where these Objective-C calls are wrapped in readable, convenient macros and global functions. The call above becomes
-```objc
-NSArray *objects =
-[CSCoreStore
- fetchAllFrom:CSFromClass([MYPerson class])
- fetchClauses:@[CSWhereFormat(@"%K == %@", @"isHidden", @NO),
- CSOrderByKeys(CSSortAscending(@"lastName"),
- CSSortAscending(@"firstName"), nil)]];
-```
-That's much shorter now. But we can still do better. Notice that we have strings being used as key paths. The `CSKeyPath(...)` macro gives us compile-time checking so keys that don't exist in a class will generate errors. Our key-safe code now looks like this:
-```objc
-NSArray *objects =
-[CSCoreStore
- fetchAllFrom:CSFromClass([MYPerson class])
- fetchClauses:@[CSWhereFormat(@"%K == %@", CSKeyPath(MYPerson, isHidden), @NO),
- CSOrderByKeys(CSSortAscending(CSKeyPath(MYPerson, lastName)),
- CSSortAscending(CSKeyPath(MYPerson, firstName)), nil)]];
-```
-
-To use these syntax sugars, include *CoreStoreBridge.h* in your Objective-C source files.
-
-
## Type-safe `CoreStoreObject`s
Starting CoreStore 4.0, we can now create persisted objects without depending on *.xcdatamodeld* Core Data files. The new `CoreStoreObject` subclass replaces `NSManagedObject`, and specially-typed properties declared on these classes will be synthesized as Core Data attributes.
```swift
@@ -2593,13 +2487,9 @@ From the **File** - **Swift Packages** - **Add Package Dependency…** menu, sea
```
CoreStore
```
-where `JohnEstropia` is the *Owner* (forks may appear as well). Then add to your project.
+where `JohnEstropia` is the *Owner* (forks may appear as well). Then add to your project
-### Objective-C support
-
-To use the Objective-C syntax sugars, import *CoreStoreBridge.h* in your *.m* source files.
-
# Changesets
For the full Changelog, refer to the [Releases](https://github.com/JohnEstropia/CoreStore/releases) page.
diff --git a/Sources/AsynchronousDataTransaction.swift b/Sources/AsynchronousDataTransaction.swift
index 874f098..fd6f304 100644
--- a/Sources/AsynchronousDataTransaction.swift
+++ b/Sources/AsynchronousDataTransaction.swift
@@ -158,9 +158,19 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
// MARK: Internal
- internal init(mainContext: NSManagedObjectContext, queue: DispatchQueue) {
+ internal init(
+ mainContext: NSManagedObjectContext,
+ queue: DispatchQueue,
+ sourceIdentifier: Any?
+ ) {
- super.init(mainContext: mainContext, queue: queue, supportsUndo: false, bypassesQueueing: false)
+ super.init(
+ mainContext: mainContext,
+ queue: queue,
+ supportsUndo: false,
+ bypassesQueueing: false,
+ sourceIdentifier: sourceIdentifier
+ )
}
internal func autoCommit(_ completion: @escaping (_ hasChanges: Bool, _ error: CoreStoreError?) -> Void) {
@@ -168,12 +178,15 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
self.isCommitted = true
let group = DispatchGroup()
group.enter()
- self.context.saveAsynchronouslyWithCompletion { (hasChanges, error) -> Void in
-
- completion(hasChanges, error)
- self.result = (hasChanges, error)
- group.leave()
- }
+ self.context.saveAsynchronously(
+ sourceIdentifier: self.sourceIdentifier,
+ completion: { (hasChanges, error) -> Void in
+
+ completion(hasChanges, error)
+ self.result = (hasChanges, error)
+ group.leave()
+ }
+ )
group.wait()
self.context.reset()
}
diff --git a/Sources/BaseDataTransaction.swift b/Sources/BaseDataTransaction.swift
index 66279ef..8dc6b0a 100644
--- a/Sources/BaseDataTransaction.swift
+++ b/Sources/BaseDataTransaction.swift
@@ -412,6 +412,11 @@ public /*abstract*/ class BaseDataTransaction {
// MARK: 3rd Party Utilities
+ /**
+ An arbitrary value that identifies the source of this transaction. Callers of the transaction can provide this value through the `DataStack.perform(...)` methods.
+ */
+ public let sourceIdentifier: Any?
+
/**
Allow external libraries to store custom data in the transaction. App code should rarely have a need for this.
```
@@ -438,7 +443,13 @@ public /*abstract*/ class BaseDataTransaction {
internal var isCommitted = false
internal var result: (hasChanges: Bool, error: CoreStoreError?)?
- internal init(mainContext: NSManagedObjectContext, queue: DispatchQueue, supportsUndo: Bool, bypassesQueueing: Bool) {
+ internal init(
+ mainContext: NSManagedObjectContext,
+ queue: DispatchQueue,
+ supportsUndo: Bool,
+ bypassesQueueing: Bool,
+ sourceIdentifier: Any?
+ ) {
let context = mainContext.temporaryContextInTransactionWithConcurrencyType(
queue == .main
@@ -449,6 +460,7 @@ public /*abstract*/ class BaseDataTransaction {
self.context = context
self.supportsUndo = supportsUndo
self.bypassesQueueing = bypassesQueueing
+ self.sourceIdentifier = sourceIdentifier
context.parentTransaction = self
context.isTransactionContext = true
diff --git a/Sources/CSAsynchronousDataTransaction.swift b/Sources/CSAsynchronousDataTransaction.swift
index 9e39fb3..388a860 100644
--- a/Sources/CSAsynchronousDataTransaction.swift
+++ b/Sources/CSAsynchronousDataTransaction.swift
@@ -29,113 +29,55 @@ import CoreData
// MARK: - CSAsynchronousDataTransaction
-/**
- The `CSAsynchronousDataTransaction` serves as the Objective-C bridging type for `AsynchronousDataTransaction`.
-
- - SeeAlso: `AsynchronousDataTransaction`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSAsynchronousDataTransaction: CSBaseDataTransaction, CoreStoreObjectiveCType {
-
- /**
- Saves the transaction changes. This method should not be used after the `-commitWithCompletion:` method was already called once.
-
- - parameter success: the block executed if the save succeeds.
- - parameter failure: the block executed if the save fails. A `CSError` is reported as the argument of the block.
- */
+
@objc
public func commitWithSuccess(_ success: (() -> Void)?, failure: ((CSError) -> Void)?) {
-
- Internals.assert(
- self.bridgeToSwift.transactionQueue.cs_isCurrentExecutionContext(),
- "Attempted to commit a \(Internals.typeName(self)) outside its designated queue."
- )
- Internals.assert(
- !self.bridgeToSwift.isCommitted,
- "Attempted to commit a \(Internals.typeName(self)) more than once."
- )
- self.bridgeToSwift.autoCommit { (_, error) in
-
- if let error = error {
-
- failure?(error.bridgeToObjectiveC)
- }
- else {
-
- success?()
- }
- }
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
// MARK: BaseDataTransaction
-
- /**
- Creates a new `NSManagedObject` with the specified entity type.
-
- - parameter into: the `CSInto` clause indicating the destination `NSManagedObject` entity type and the destination configuration
- - returns: a new `NSManagedObject` instance of the specified entity type.
- */
+
@objc
public override func createInto(_ into: CSInto) -> Any {
-
- return self.bridgeToSwift.create(into.bridgeToSwift)
+
+ fatalError()
}
-
- /**
- Returns an editable proxy of a specified `NSManagedObject`. This method should not be used after the `-commitWithCompletion:` method was already called once.
-
- - parameter object: the `NSManagedObject` type to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
+
@objc
public override func editObject(_ object: NSManagedObject?) -> Any? {
-
- return self.bridgeToSwift.edit(object)
+
+ fatalError()
}
-
- /**
- Returns an editable proxy of the object with the specified `NSManagedObjectID`. This method should not be used after the `-commitWithCompletion:` method was already called once.
-
- - parameter into: a `CSInto` clause specifying the entity type
- - parameter objectID: the `NSManagedObjectID` for the object to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
+
@objc
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
-
- return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
+
+ fatalError()
}
-
- /**
- Deletes a specified `NSManagedObject`. This method should not be used after the `-commitWithCompletion:` method was already called once.
-
- - parameter object: the `NSManagedObject` type to be deleted
- */
+
@objc
public override func deleteObject(_ object: NSManagedObject?) {
-
- self.bridgeToSwift.delete(object)
+
+ fatalError()
}
-
- /**
- Deletes the specified `NSManagedObject`s.
-
- - parameter objects: the `NSManagedObject`s type to be deleted
- */
+
@objc
public override func deleteObjects(_ objects: [NSManagedObject]) {
-
- self.bridgeToSwift.delete(objects)
+
+ fatalError()
}
@@ -144,31 +86,26 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction, CoreSto
public typealias SwiftType = AsynchronousDataTransaction
public var bridgeToSwift: AsynchronousDataTransaction {
-
- return super.swiftTransaction as! AsynchronousDataTransaction
+
+ fatalError()
}
public required init(_ swiftValue: AsynchronousDataTransaction) {
-
- super.init(swiftValue as BaseDataTransaction)
- }
-
- public required override init(_ swiftValue: BaseDataTransaction) {
-
- super.init(swiftValue)
+
+ fatalError()
}
}
// MARK: - AsynchronousDataTransaction
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension AsynchronousDataTransaction: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSAsynchronousDataTransaction {
-
- return CSAsynchronousDataTransaction(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSBaseDataTransaction+Querying.swift b/Sources/CSBaseDataTransaction+Querying.swift
index d993df4..a664900 100644
--- a/Sources/CSBaseDataTransaction+Querying.swift
+++ b/Sources/CSBaseDataTransaction+Querying.swift
@@ -29,167 +29,66 @@ import CoreData
// MARK: - CSBaseDataTransaction
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CSBaseDataTransaction {
-
- /**
- Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
-
- - parameter object: a reference to the object created/fetched outside the transaction
- - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
- */
+
@objc
public func fetchExistingObject(_ object: NSManagedObject) -> Any? {
-
- return self.swiftTransaction.context.fetchExisting(object) as NSManagedObject?
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instance in the transaction's context from an `NSManagedObjectID`.
-
- - parameter objectID: the `NSManagedObjectID` for the object
- - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
- */
+
@objc
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any? {
-
- return self.swiftTransaction.context.fetchExisting(objectID) as NSManagedObject?
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instances in the transaction's context from references created from a transaction or from a different managed object context.
-
- - parameter objects: an array of `NSManagedObject`s created/fetched outside the transaction
- - returns: the `NSManagedObject` array for objects that exists in the transaction
- */
+
@objc
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any] {
-
- return self.swiftTransaction.context.fetchExisting(objects) as [NSManagedObject]
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instances in the transaction's context from a list of `NSManagedObjectID`.
-
- - parameter objectIDs: the `NSManagedObjectID` array for the objects
- - returns: the `NSManagedObject` array for objects that exists in the transaction
- */
+
@objc
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any] {
-
- return self.swiftTransaction.context.fetchExisting(objectIDs) as [NSManagedObject]
+
+ fatalError()
}
-
- /**
- Fetches the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `From` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
- */
+
@objc
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to fetch from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.fetchOne(from, fetchClauses))?
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Fetches all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
- */
+
@objc
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to fetch from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.fetchAll(from, fetchClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Fetches the number of `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
- */
+
@objc
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to fetch from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.fetchCount(from, fetchClauses))
- .flatMap({ NSNumber(value: $0) })
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
- */
+
@objc
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to fetch from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.fetchObjectID(from, fetchClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Queries aggregate values as specified by the `CSQueryClause`s. Requires at least a `CSSelect` clause, and optional `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
-
- A "query" differs from a "fetch" in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter selectClause: a `CSSelect` clause indicating the properties to fetch, and with the generic type indicating the return type.
- - parameter queryClauses: a series of `CSQueryClause` instances for the query request. Accepts `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
- - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
- */
+
@objc
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to query from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.queryValue(from, selectClause, queryClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Queries a dictionary of attribute values as specified by the `CSQueryClause`s. Requires at least a `CSSelect` clause, and optional `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
-
- A "query" differs from a "fetch" in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter selectClause: a `CSSelect` clause indicating the properties to fetch, and with the generic type indicating the return type.
- - parameter queryClauses: a series of `CSQueryClause` instances for the query request. Accepts `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
- - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
- */
+
@objc
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String: Any]]? {
-
- Internals.assert(
- self.swiftTransaction.isRunningInAllowedQueue(),
- "Attempted to query from a \(Internals.typeName(self)) outside its designated queue."
- )
- return (try? self.swiftTransaction.context.queryAttributes(from, selectClause, queryClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
}
diff --git a/Sources/CSBaseDataTransaction.swift b/Sources/CSBaseDataTransaction.swift
index c909e4b..483ecfc 100644
--- a/Sources/CSBaseDataTransaction.swift
+++ b/Sources/CSBaseDataTransaction.swift
@@ -29,226 +29,121 @@ import CoreData
// MARK: - CSBaseDataTransaction
-/**
- The `CSBaseDataTransaction` serves as the Objective-C bridging type for `BaseDataTransaction`.
-
- - SeeAlso: `BaseDataTransaction`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public class CSBaseDataTransaction: NSObject {
// MARK: Object management
-
- /**
- Indicates if the transaction has pending changes
- */
+
@objc
public var hasChanges: Bool {
-
- return self.swiftTransaction.hasChanges
- }
-
- /**
- Creates a new `NSManagedObject` with the specified entity type.
-
- - parameter into: the `CSInto` clause indicating the destination `NSManagedObject` entity type and the destination configuration
- - returns: a new `NSManagedObject` instance of the specified entity type.
- */
- @objc
- public func createInto(_ into: CSInto) -> Any {
-
- return self.swiftTransaction.create(into.bridgeToSwift)
- }
-
- /**
- Returns an editable proxy of a specified `NSManagedObject`.
-
- - parameter object: the `NSManagedObject` type to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
- @objc
- public func editObject(_ object: NSManagedObject?) -> Any? {
-
- return self.swiftTransaction.edit(object)
- }
-
- /**
- Returns an editable proxy of the object with the specified `NSManagedObjectID`.
-
- - parameter into: a `CSInto` clause specifying the entity type
- - parameter objectID: the `NSManagedObjectID` for the object to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
- @objc
- public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
-
- return self.swiftTransaction.edit(into.bridgeToSwift, objectID)
+
+ fatalError()
+ }
+
+ @objc
+ public func createInto(_ into: CSInto) -> Any {
+
+ fatalError()
+ }
+
+ @objc
+ public func editObject(_ object: NSManagedObject?) -> Any? {
+
+ fatalError()
+ }
+
+ @objc
+ public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
+
+ fatalError()
}
- /**
- Deletes a specified `NSManagedObject`.
-
- - parameter object: the `NSManagedObject` to be deleted
- */
@objc
public func deleteObject(_ object: NSManagedObject?) {
-
- self.swiftTransaction.delete(object)
+
+ fatalError()
}
-
- /**
- Deletes the specified `NSManagedObject`s.
-
- - parameter objects: the `NSManagedObject`s to be deleted
- */
+
@objc
public func deleteObjects(_ objects: [NSManagedObject]) {
-
- self.swiftTransaction.delete(objects)
+
+ fatalError()
}
-
- /**
- Refreshes all registered objects `NSManagedObject`s in the transaction.
- */
+
@objc
public func refreshAndMergeAllObjects() {
-
- self.swiftTransaction.refreshAndMergeAllObjects()
+
+ fatalError()
}
// MARK: Inspecting Pending Objects
-
- /**
- Returns all pending `NSManagedObject`s of the specified type that were inserted to the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: an `NSSet` of pending `NSManagedObject`s of the specified type that were inserted to the transaction.
- */
+
@objc
public func insertedObjectsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.insertedObjects(entity)
- }
-
- /**
- Returns all pending `NSManagedObjectID`s that were inserted to the transaction. This method should not be called after the `-commit*:` method was called.
-
- - returns: an `NSSet` of pending `NSManagedObjectID`s that were inserted to the transaction.
- */
- @objc
- public func insertedObjectIDs() -> Set {
-
- return self.swiftTransaction.insertedObjectIDs()
- }
-
- /**
- Returns all pending `NSManagedObjectID`s of the specified type that were inserted to the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: an `NSSet` of pending `NSManagedObjectID`s of the specified type that were inserted to the transaction.
- */
- @objc
- public func insertedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.insertedObjectIDs(entity)
- }
-
- /**
- Returns all pending `NSManagedObject`s of the specified type that were updated in the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: an `NSSet` of pending `NSManagedObject`s of the specified type that were updated in the transaction.
- */
- @objc
- public func updatedObjectsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.updatedObjects(entity)
- }
-
- /**
- Returns all pending `NSManagedObjectID`s that were updated in the transaction. This method should not be called after the `-commit*:` method was called.
-
- - returns: an `NSSet` of pending `NSManagedObjectID`s that were updated in the transaction.
- */
- @objc
- public func updatedObjectIDs() -> Set {
-
- return self.swiftTransaction.updatedObjectIDs()
- }
-
- /**
- Returns all pending `NSManagedObjectID`s of the specified type that were updated in the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: an `NSSet` of pending `NSManagedObjectID`s of the specified type that were updated in the transaction.
- */
- @objc
- public func updatedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.updatedObjectIDs(entity)
- }
-
- /**
- Returns all pending `NSManagedObject`s of the specified type that were deleted from the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: an `NSSet` of pending `NSManagedObject`s of the specified type that were deleted from the transaction.
- */
- @objc
- public func deletedObjectsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.deletedObjects(entity)
- }
-
- /**
- Returns all pending `NSManagedObjectID`s of the specified type that were deleted from the transaction. This method should not be called after the `-commit*:` method was called.
-
- - returns: an `NSSet` of pending `NSManagedObjectID`s of the specified type that were deleted from the transaction.
- */
- @objc
- public func deletedObjectIDs() -> Set {
-
- return self.swiftTransaction.deletedObjectIDs()
+
+ fatalError()
+ }
+
+ @objc
+ public func insertedObjectIDs() -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func insertedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func updatedObjectsOfType(_ entity: NSManagedObject.Type) -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func updatedObjectIDs() -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func updatedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func deletedObjectsOfType(_ entity: NSManagedObject.Type) -> Set {
+
+ fatalError()
+ }
+
+ @objc
+ public func deletedObjectIDs() -> Set {
+
+ fatalError()
}
- /**
- Returns all pending `NSManagedObjectID`s of the specified type that were deleted from the transaction. This method should not be called after the `-commit*:` method was called.
-
- - parameter entity: the `NSManagedObject` subclass to filter
- - returns: a `Set` of pending `NSManagedObjectID`s of the specified type that were deleted from the transaction.
- */
@objc
public func deletedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set {
-
- return self.swiftTransaction.deletedObjectIDs(entity)
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.swiftTransaction).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSBaseDataTransaction else {
-
- return false
- }
- return self.swiftTransaction === object.swiftTransaction
- }
-
-
- // MARK: Internal
-
- internal let swiftTransaction: BaseDataTransaction
-
- internal init(_ swiftValue: BaseDataTransaction) {
-
- self.swiftTransaction = swiftValue
- super.init()
+
+ fatalError()
}
}
diff --git a/Sources/CSClauseTypes.swift b/Sources/CSClauseTypes.swift
index c73a5c4..a5a5e71 100644
--- a/Sources/CSClauseTypes.swift
+++ b/Sources/CSClauseTypes.swift
@@ -29,11 +29,7 @@ import CoreData
// MARK: - CSFetchClause
-/**
- The `CSFetchClause` implement clauses used to configure `NSFetchRequest`s.
-
- - SeeAlso: `FetchClause`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSFetchClause {
@@ -44,11 +40,7 @@ public protocol CSFetchClause {
// MARK: - CSQueryClause
-/**
- The `CSQueryClause` implement clauses used to configure `NSFetchRequest`s.
-
- - SeeAlso: `QueryClause`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSQueryClause {
@@ -59,11 +51,7 @@ public protocol CSQueryClause {
// MARK: - CSDeleteClause
-/**
- The `CSDeleteClause` implement clauses used to configure `NSFetchRequest`s.
-
- - SeeAlso: `DeleteClause`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSDeleteClause {
diff --git a/Sources/CSCoreStore.swift b/Sources/CSCoreStore.swift
index c07e675..fe3a41b 100644
--- a/Sources/CSCoreStore.swift
+++ b/Sources/CSCoreStore.swift
@@ -28,33 +28,14 @@ import Foundation
// MARK: - CSCoreStore
-/**
- The `CSCoreStore` serves as the Objective-C bridging type for `CoreStore`.
-
- - SeeAlso: `CoreStore`
- */
-@available(*, deprecated, message: "Call methods directly from the CSDataStack instead")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSCoreStore: NSObject {
-
- /**
- The default `CSDataStack` instance to be used. If `defaultStack` is not set before the first time accessed, a default-configured `CSDataStack` will be created.
-
- - SeeAlso: `CSDataStack`
- - Note: Changing the `defaultStack` is thread safe, but it is recommended to setup `CSDataStacks` on a common queue (e.g. the main queue).
- */
+
@objc
public static var defaultStack: CSDataStack {
- get { return CoreStoreDefaults.dataStack.bridgeToObjectiveC }
- set { CoreStoreDefaults.dataStack = newValue.bridgeToSwift }
- }
-
-
- // MARK: Private
-
- private override init() {
-
- fatalError()
+ get { fatalError() }
+ set { fatalError() }
}
}
diff --git a/Sources/CSDataStack+Migrating.swift b/Sources/CSDataStack+Migrating.swift
index b3e95f2..047217e 100644
--- a/Sources/CSDataStack+Migrating.swift
+++ b/Sources/CSDataStack+Migrating.swift
@@ -29,99 +29,30 @@ import CoreData
// MARK: - CSDataStack
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CSDataStack {
- /**
- Asynchronously adds a `CSInMemoryStore` to the stack. Migrations are also initiated by default.
- ```
- NSError *error;
- NSProgress *migrationProgress = [dataStack
- addInMemoryStorage:[CSInMemoryStore new]
- completion:^(CSSetupResult *result) {
- if (result.isSuccess) {
- // ...
- }
- }
- error: &error];
- ```
- - parameter storage: the `CSInMemoryStore` instance
- - parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `CSSetupResult` argument indicates the result. This closure is NOT executed if an error is thrown, but will be executed with a failure `CSSetupResult` result if an error occurs asynchronously.
- */
@objc
public func addInMemoryStorage(_ storage: CSInMemoryStore, completion: @escaping (CSSetupResult) -> Void) {
-
- self.bridgeToSwift.addStorage(
- storage.bridgeToSwift,
- completion: { completion($0.bridgeToObjectiveC) }
- )
+
+ fatalError()
}
-
- /**
- Asynchronously adds a `CSSQLiteStore` to the stack. Migrations are also initiated by default.
- ```
- NSError *error;
- NSProgress *migrationProgress = [dataStack
- addInMemoryStorage:[[CSSQLiteStore alloc]
- initWithFileName:@"core_data.sqlite"
- configuration:@"Config1"]
- completion:^(CSSetupResult *result) {
- if (result.isSuccess) {
- // ...
- }
- }
- error: &error];
- ```
- - parameter storage: the `CSSQLiteStore` instance
- - parameter completion: the closure to be executed on the main queue when the process completes, either due to success or failure. The closure's `CSSetupResult` argument indicates the result. This closure is NOT executed if an error is thrown, but will be executed with a failure `CSSetupResult` result if an error occurs asynchronously. Note that the `CSLocalStorage` associated to the `-[CSSetupResult storage]` may not always be the same instance as the parameter argument if a previous `CSLocalStorage` was already added at the same URL and with the same configuration.
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
- */
+
@objc
public func addSQLiteStorage(_ storage: CSSQLiteStore, completion: @escaping (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
-
- return bridge(error) {
-
- self.bridgeToSwift.addStorage(
- storage.bridgeToSwift,
- completion: { completion($0.bridgeToObjectiveC) }
- )
- }
+
+ fatalError()
}
-
- /**
- Migrates a `CSSQLiteStore` to match the `CSDataStack`'s managed object model version. This method does NOT add the migrated store to the data stack.
-
- - parameter storage: the `CSSQLiteStore` instance
- - parameter completion: the closure to be executed on the main queue when the migration completes, either due to success or failure. The closure's `CSMigrationResult` 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 error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
- */
+
@objc
public func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: @escaping (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.upgradeStorageIfNeeded(
- storage.bridgeToSwift,
- completion: { completion($0.bridgeToObjectiveC) }
- )
- }
+
+ fatalError()
}
-
- /**
- Checks the migration steps required for the `CSSQLiteStore` to match the `CSDataStack`'s managed object model version.
-
- - parameter storage: the `CSSQLiteStore` instance
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - 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
public func requiredMigrationsForSQLiteStore(_ storage: CSSQLiteStore, error: NSErrorPointer) -> [CSMigrationType]? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.requiredMigrationsForStorage(storage.bridgeToSwift)
- }
+
+ fatalError()
}
}
diff --git a/Sources/CSDataStack+Observing.swift b/Sources/CSDataStack+Observing.swift
index d0c2ff4..5b6d9cc 100644
--- a/Sources/CSDataStack+Observing.swift
+++ b/Sources/CSDataStack+Observing.swift
@@ -29,143 +29,35 @@ import CoreData
// MARK: - CSDataStack
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CSDataStack {
- /**
- Creates a `CSObjectMonitor` for the specified `NSManagedObject`. Multiple `ObjectObserver`s may then register themselves to be notified when changes are made to the `NSManagedObject`.
-
- - parameter object: the `NSManagedObject` to observe changes from
- - returns: an `ObjectMonitor` that monitors changes to `object`
- */
@objc
public func monitorObject(_ object: NSManagedObject) -> CSObjectMonitor {
-
- return self.bridgeToSwift.monitorObject(object).bridgeToObjectiveC
+
+ fatalError()
}
-
- /**
- Creates a `CSListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `CSListObserver`s may then register themselves to be notified when changes are made to the list.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: a `CSListMonitor` instance that monitors changes to the list
- */
+
@objc
public func monitorListFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> CSListMonitor {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
- )
- Internals.assert(
- fetchClauses.contains { $0 is CSOrderBy },
- "A CSListMonitor requires a CSOrderBy clause."
- )
- return ListMonitor(
- dataStack: self.bridgeToSwift,
- from: from.bridgeToSwift,
- sectionBy: nil,
- applyFetchClauses: { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- }
- ).bridgeToObjectiveC
+
+ fatalError()
}
-
- /**
- Asynchronously creates a `CSListMonitor` for a list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `CSListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
-
- - parameter createAsynchronously: the closure that receives the created `CSListMonitor` instance
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- */
+
@objc
public func monitorListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
- )
- Internals.assert(
- fetchClauses.contains { $0 is CSOrderBy },
- "A CSListMonitor requires an CSOrderBy clause."
- )
- _ = ListMonitor(
- dataStack: self.bridgeToSwift,
- from: from.bridgeToSwift,
- sectionBy: nil,
- applyFetchClauses: { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- },
- createAsynchronously: {
-
- createAsynchronously($0.bridgeToObjectiveC)
- }
- )
+
+ fatalError()
}
-
- /**
- Creates a `CSListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `ListObserver`s may then register themselves to be notified when changes are made to the list.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter sectionBy: a `CSSectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: a `CSListMonitor` instance that monitors changes to the list
- */
+
@objc
public func monitorSectionedListFrom(_ from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) -> CSListMonitor {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
- )
- Internals.assert(
- fetchClauses.contains { $0 is CSOrderBy },
- "A CSListMonitor requires an CSOrderBy clause."
- )
- return ListMonitor(
- dataStack: self.bridgeToSwift,
- from: from.bridgeToSwift,
- sectionBy: sectionBy.bridgeToSwift,
- applyFetchClauses: { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- }
- ).bridgeToObjectiveC
+
+ fatalError()
}
-
- /**
- Asynchronously creates a `CSListMonitor` for a sectioned list of `NSManagedObject`s that satisfy the specified fetch clauses. Multiple `CSListObserver`s may then register themselves to be notified when changes are made to the list. Since `NSFetchedResultsController` greedily locks the persistent store on initial fetch, you may prefer this method instead of the synchronous counterpart to avoid deadlocks while background updates/saves are being executed.
-
- - parameter createAsynchronously: the closure that receives the created `CSListMonitor` instance
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter sectionBy: a `CSSectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- - parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- */
+
public func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
- )
- Internals.assert(
- fetchClauses.contains { $0 is CSOrderBy },
- "A CSListMonitor requires an CSOrderBy clause."
- )
- _ = ListMonitor(
- dataStack: self.bridgeToSwift,
- from: from.bridgeToSwift,
- sectionBy: sectionBy.bridgeToSwift,
- applyFetchClauses: { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- },
- createAsynchronously: {
-
- createAsynchronously($0.bridgeToObjectiveC)
- }
- )
+
+ fatalError()
}
}
diff --git a/Sources/CSDataStack+Querying.swift b/Sources/CSDataStack+Querying.swift
index 1c1a440..6877d92 100644
--- a/Sources/CSDataStack+Querying.swift
+++ b/Sources/CSDataStack+Querying.swift
@@ -29,186 +29,72 @@ import CoreData
// MARK: - CSDataStack
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CSDataStack {
-
- /**
- Fetches the `NSManagedObject` instance in the transaction's context from a reference created from a transaction or from a different managed object context.
-
- - parameter object: a reference to the object created/fetched outside the transaction
- - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
- */
+
@objc
public func fetchExistingObject(_ object: NSManagedObject) -> Any? {
-
- return self.bridgeToSwift.mainContext.fetchExisting(object) as NSManagedObject?
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instance in the transaction's context from an `NSManagedObjectID`.
-
- - parameter objectID: the `NSManagedObjectID` for the object
- - returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
- */
+
@objc
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any? {
-
- return self.bridgeToSwift.mainContext.fetchExisting(objectID) as NSManagedObject?
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instances in the transaction's context from references created from a transaction or from a different managed object context.
-
- - parameter objects: an array of `NSManagedObject`s created/fetched outside the transaction
- - returns: the `NSManagedObject` array for objects that exists in the transaction
- */
+
@objc
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any] {
-
- return self.bridgeToSwift.mainContext.fetchExisting(objects) as [NSManagedObject]
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObject` instances in the transaction's context from a list of `NSManagedObjectID`.
-
- - parameter objectIDs: the `NSManagedObjectID` array for the objects
- - returns: the `NSManagedObject` array for objects that exists in the transaction
- */
+
@objc
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any] {
-
- return self.bridgeToSwift.mainContext.fetchExisting(objectIDs) as [NSManagedObject]
+
+ fatalError()
}
-
- /**
- Fetches the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `From` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
- */
+
@objc
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to fetch from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.fetchOne(from, fetchClauses))?
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Fetches all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
- */
+
@objc
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to fetch from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.fetchAll(from, fetchClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Fetches the number of `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the number `NSManagedObject`s that satisfy the specified `CSFetchClause`s
- */
+
@objc
public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to fetch from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.fetchCount(from, fetchClauses))
- .flatMap({ NSNumber(value: $0) })
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `CSFetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the `NSManagedObjectID` for the first `NSManagedObject` that satisfies the specified `CSFetchClause`s
- */
+
@objc
public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to fetch from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.fetchObjectID(from, fetchClauses))?
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Fetches the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
- - returns: the `NSManagedObjectID` for all `NSManagedObject`s that satisfy the specified `CSFetchClause`s
- */
+
@objc
public func fetchObjectIDsFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [NSManagedObjectID]? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to fetch from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.fetchObjectIDs(from, fetchClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Queries aggregate values as specified by the `CSQueryClause`s. Requires at least a `CSSelect` clause, and optional `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
-
- A "query" differs from a "fetch" in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter selectClause: a `CSSelect` clause indicating the properties to fetch, and with the generic type indicating the return type.
- - parameter queryClauses: a series of `CSQueryClause` instances for the query request. Accepts `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
- - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
- */
+
@objc
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to query from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.queryValue(from, selectClause, queryClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
-
- /**
- Queries a dictionary of attribute values as specified by the `CSQueryClause`s. Requires at least a `CSSelect` clause, and optional `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
-
- A "query" differs from a "fetch" in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.
-
- - parameter from: a `CSFrom` clause indicating the entity type
- - parameter selectClause: a `CSSelect` clause indicating the properties to fetch, and with the generic type indicating the return type.
- - parameter queryClauses: a series of `CSQueryClause` instances for the query request. Accepts `CSWhere`, `CSOrderBy`, `CSGroupBy`, and `CSTweak` clauses.
- - returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
- */
+
@objc
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String: Any]]? {
-
- Internals.assert(
- Thread.isMainThread,
- "Attempted to query from a \(Internals.typeName(self)) outside the main thread."
- )
- return (try? self.bridgeToSwift.mainContext.queryAttributes(from, selectClause, queryClauses))
- .flatMap({ $0 })
+
+ fatalError()
}
}
diff --git a/Sources/CSDataStack+Transaction.swift b/Sources/CSDataStack+Transaction.swift
index e652e33..c8fc145 100644
--- a/Sources/CSDataStack+Transaction.swift
+++ b/Sources/CSDataStack+Transaction.swift
@@ -28,108 +28,36 @@ import Foundation
// MARK: - CSDataStack
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CSDataStack {
-
- /**
- Begins a transaction asynchronously where `NSManagedObject` creates, updates, and deletes can be made.
-
- - parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
- */
+
@objc
public func beginAsynchronous(_ closure: @escaping (_ transaction: CSAsynchronousDataTransaction) -> Void) {
-
- self.bridgeToSwift.perform(
- asynchronous: { (transaction) in
-
- let csTransaction = transaction.bridgeToObjectiveC
- closure(csTransaction)
- if !transaction.isCommitted && transaction.hasChanges {
-
- Internals.log(
- .warning,
- message: "The closure for the \(Internals.typeName(csTransaction)) completed without being committed. All changes made within the transaction were discarded."
- )
- }
- try transaction.cancel()
- },
- completion: { _ in }
- )
+
+ fatalError()
}
-
- /**
- Begins a transaction synchronously where `NSManagedObject` creates, updates, and deletes can be made.
-
- - 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 error: the `CSError` pointer that indicates the reason in case of an failure
- - returns: `YES` if the commit succeeded, `NO` if the commit failed. If `NO`, the `error` argument will hold error information.
- */
+
@objc
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void, error: NSErrorPointer) -> Bool {
-
- return bridge(error) {
-
- do {
-
- try self.bridgeToSwift.perform(
- synchronous: { (transaction) in
-
- let csTransaction = transaction.bridgeToObjectiveC
- closure(csTransaction)
- if !transaction.isCommitted && transaction.hasChanges {
-
- Internals.log(
- .warning,
- message: "The closure for the \(Internals.typeName(csTransaction)) completed without being committed. All changes made within the transaction were discarded."
- )
- }
- try transaction.cancel()
- }
- )
- }
- catch CoreStoreError.userCancelled {
-
- return
- }
- }
+
+ fatalError()
}
-
- /**
- Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
-
- To support "undo" methods such as `-undo`, `-redo`, and `-rollback`, use the `-beginSafeWithSupportsUndo:` method passing `YES` to the argument. Without "undo" support, calling those methods will raise an exception.
- - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
- */
+
@objc
public func beginUnsafe() -> CSUnsafeDataTransaction {
-
- return bridge {
-
- self.bridgeToSwift.beginUnsafe()
- }
+
+ fatalError()
}
-
- /**
- Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
-
- - prameter supportsUndo: `-undo`, `-redo`, and `-rollback` methods are only available when this parameter is `YES`, otherwise those method will raise an exception. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
- - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
- */
+
@objc
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
-
- return bridge {
-
- self.bridgeToSwift.beginUnsafe(supportsUndo: supportsUndo)
- }
+
+ fatalError()
}
-
- /**
- Refreshes all registered objects `NSManagedObject`s in the `DataStack`.
- */
+
@objc
public func refreshAndMergeAllObjects() {
-
- self.bridgeToSwift.refreshAndMergeAllObjects()
+
+ fatalError()
}
}
diff --git a/Sources/CSDataStack.swift b/Sources/CSDataStack.swift
index d4878a1..b53c057 100644
--- a/Sources/CSDataStack.swift
+++ b/Sources/CSDataStack.swift
@@ -29,170 +29,84 @@ import CoreData
// MARK: - CSDataStack
-/**
- The `CSDataStack` serves as the Objective-C bridging type for `DataStack`.
-
- - SeeAlso: `DataStack`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
-
- /**
- Initializes a `CSDataStack` with default settings. CoreStore searches for .xcdatamodeld from the main `NSBundle` and loads an `NSManagedObjectModel` from it. An assertion is raised if the model could not be found.
- */
+
@objc
public convenience override init() {
- self.init(DataStack())
+ fatalError()
}
-
- /**
- Initializes a `CSDataStack` from the model with the specified `modelName` in the specified `bundle`.
-
- - parameter xcodeModelName: the name of the (.xcdatamodeld) model file. If not specified, the application name (CFBundleName) will be used if it exists, or "CoreData" if it the bundle name was not set.
- - parameter bundle: an optional bundle to load .xcdatamodeld models from. If not specified, the main bundle will be used.
- - parameter versionChain: the version strings that indicate the sequence of model versions to be used as the order for progressive migrations. If not specified, will default to a non-migrating data stack.
- */
+
@objc
public convenience init(xcodeModelName: XcodeDataModelFileName?, bundle: Bundle?, versionChain: [String]?) {
-
- self.init(
- DataStack(
- xcodeModelName: xcodeModelName ?? DataStack.applicationName,
- bundle: bundle ?? Bundle.main,
- migrationChain: versionChain.flatMap { MigrationChain($0) } ?? nil
- )
- )
+
+ fatalError()
}
-
- /**
- Returns the stack's model version. The version string is the same as the name of the version-specific .xcdatamodeld file.
- */
+
@objc
public var modelVersion: String {
-
- return self.bridgeToSwift.modelVersion
+
+ fatalError()
}
-
- /**
- Returns the entity name-to-class type mapping from the `CSDataStack`'s model.
- */
+
@objc
public func entityTypesByNameForType(_ type: NSManagedObject.Type) -> [EntityName: NSManagedObject.Type] {
-
- return self.bridgeToSwift.entityTypesByName(for: type)
+
+ fatalError()
}
-
- /**
- Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass from stack's model.
- */
+
@objc
public func entityDescriptionForClass(_ type: NSManagedObject.Type) -> NSEntityDescription? {
-
- return self.bridgeToSwift.entityDescription(for: type)
+
+ fatalError()
}
-
- /**
- Creates an `CSInMemoryStore` with default parameters and adds it to the stack. This method blocks until completion.
- ```
- CSSQLiteStore *storage = [dataStack addInMemoryStorageAndWaitAndReturnError:&error];
- ```
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: the `CSInMemoryStore` added to the stack
- */
+
@objc
@discardableResult
public func addInMemoryStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSInMemoryStore? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.addStorageAndWait(InMemoryStore())
- }
+
+ fatalError()
}
-
- /**
- Creates an `CSSQLiteStore` with default parameters and adds it to the stack. This method blocks until completion.
- ```
- CSSQLiteStore *storage = [dataStack addSQLiteStorageAndWaitAndReturnError:&error];
- ```
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: the `CSSQLiteStore` added to the stack
- */
+
@objc
@discardableResult
public func addSQLiteStorageAndWaitAndReturnError(_ error: NSErrorPointer) -> CSSQLiteStore? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.addStorageAndWait(SQLiteStore())
- }
+
+ fatalError()
}
-
- /**
- Adds a `CSInMemoryStore` to the stack and blocks until completion.
- ```
- NSError *error;
- CSInMemoryStore *storage = [dataStack
- addStorageAndWait: [[CSInMemoryStore alloc] initWithConfiguration: @"Config1"]
- error: &error];
- ```
- - parameter storage: the `CSInMemoryStore`
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: the `CSInMemoryStore` added to the stack
- */
+
@objc
@discardableResult
public func addInMemoryStorageAndWait(_ storage: CSInMemoryStore, error: NSErrorPointer) -> CSInMemoryStore? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.addStorageAndWait(storage.bridgeToSwift)
- }
+
+ fatalError()
}
-
- /**
- Adds a `CSSQLiteStore` to the stack and blocks until completion.
- ```
- NSError *error;
- CSSQLiteStore *storage = [dataStack
- addStorageAndWait: [[CSSQLiteStore alloc] initWithConfiguration: @"Config1"]
- error: &error];
- ```
- - parameter storage: the `CSSQLiteStore`
- - parameter error: the `NSError` pointer that indicates the reason in case of an failure
- - returns: the `CSSQLiteStore` added to the stack
- */
+
@objc
@discardableResult
public func addSQLiteStorageAndWait(_ storage: CSSQLiteStore, error: NSErrorPointer) -> CSSQLiteStore? {
-
- return bridge(error) {
-
- try self.bridgeToSwift.addStorageAndWait(storage.bridgeToSwift)
- }
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.bridgeToSwift).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSDataStack else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -201,22 +115,21 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
public let bridgeToSwift: DataStack
public init(_ swiftValue: DataStack) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - DataStack
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension DataStack: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSDataStack {
-
- return CSDataStack(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSDynamicSchema.swift b/Sources/CSDynamicSchema.swift
index 735b0e0..43299b4 100644
--- a/Sources/CSDynamicSchema.swift
+++ b/Sources/CSDynamicSchema.swift
@@ -29,23 +29,13 @@ import Foundation
// MARK: - CSDynamicSchema
-/**
- The `CSDynamicSchema` serves as the Objective-C bridging type for `DynamicSchema`.
-
- - SeeAlso: `DynamicSchema`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSDynamicSchema {
-
- /**
- The version string for this model schema.
- */
+
@objc
var modelVersion: ModelVersion { get }
- /**
- Do not call this directly. The `NSManagedObjectModel` for this schema may be created lazily and using this method directly may affect the integrity of the model.
- */
@objc
func rawModel() -> NSManagedObjectModel
}
diff --git a/Sources/CSError.swift b/Sources/CSError.swift
index 96b5ad0..ff8954e 100644
--- a/Sources/CSError.swift
+++ b/Sources/CSError.swift
@@ -29,281 +29,75 @@ import CoreData
// MARK: - CSError
-/**
- All errors thrown from CoreStore are expressed in `CSError`s.
-
- - SeeAlso: `CoreStoreError`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSError: NSError {
-
- /**
- The `NSError` error domain for `CSError`.
-
- - SeeAlso: `CoreStoreErrorErrorDomain`
- */
+
+ // MARK: Public
+
@objc
public static let errorDomain = CoreStoreErrorDomain
public var bridgeToSwift: CoreStoreError {
- if let swift = self.swiftError {
-
- return swift
- }
- let swift = CoreStoreError(_bridgedNSError: self) ?? .unknown
- self.swiftError = swift
- return swift
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSError else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
-
- /**
- Do not call directly!
- */
+
public init(_ swiftValue: CoreStoreError) {
-
- self.swiftError = swiftValue
- super.init(domain: CoreStoreError.errorDomain, code: swiftValue.errorCode, userInfo: swiftValue.errorUserInfo)
+
+ fatalError()
}
public required init?(coder aDecoder: NSCoder) {
-
- super.init(coder: aDecoder)
- }
-
-
- // MARK: Private
-
- private var swiftError: CoreStoreError?
-}
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-extension CSError: CoreStoreObjectiveCType {}
+ fatalError()
+ }
+}
// MARK: - CSErrorCode
-/**
- The `NSError` error codes for `CSError.Domain`.
-
- - SeeAlso: `CSError`
- - SeeAlso: `CoreStoreError`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public enum CSErrorCode: Int {
-
- /**
- A failure occured because of an unknown error.
- */
+
case unknownError
-
- /**
- The `NSPersistentStore` could note be initialized because another store existed at the specified `NSURL`.
- */
case differentStorageExistsAtURL
-
- /**
- An `NSMappingModel` could not be found for a specific source and destination model versions.
- */
case mappingModelNotFound
-
- /**
- Progressive migrations are disabled for a store, but an `NSMappingModel` could not be found for a specific source and destination model versions.
- */
case progressiveMigrationRequired
-
- /**
- An internal SDK call failed with the specified "NSError" userInfo key.
- */
case internalError
-
- /**
- The transaction was terminated by a user-thrown error with the specified "Error" userInfo key.
- */
case userError
-
- /**
- The transaction was cancelled by the user.
- */
case userCancelled
}
// MARK: - CoreStoreError
-extension CoreStoreError: _ObjectiveCBridgeableError {
-
- // MARK: _ObjectiveCBridgeableError
-
- public init?(_bridgedNSError error: NSError) {
-
- guard error.domain == CoreStoreErrorDomain else {
-
- if error is CSError {
-
- self = .internalError(NSError: error)
- return
- }
- return nil
- }
-
- guard let code = CoreStoreErrorCode(rawValue: error.code) else {
-
- if error is CSError {
-
- self = .unknown
- return
- }
- return nil
- }
-
- let info = error.userInfo
- switch code {
-
- case .unknownError:
- self = .unknown
-
- case .differentStorageExistsAtURL:
- guard case let existingPersistentStoreURL as URL = info["existingPersistentStoreURL"] else {
-
- self = .unknown
- return
- }
- self = .differentStorageExistsAtURL(existingPersistentStoreURL: existingPersistentStoreURL)
-
- case .mappingModelNotFound:
- guard let localStoreURL = info["localStoreURL"] as? URL,
- let targetModel = info["targetModel"] as? NSManagedObjectModel,
- let targetModelVersion = info["targetModelVersion"] as? String else {
-
- self = .unknown
- return
- }
- self = .mappingModelNotFound(localStoreURL: localStoreURL, targetModel: targetModel, targetModelVersion: targetModelVersion)
-
- case .progressiveMigrationRequired:
- guard let localStoreURL = info["localStoreURL"] as? URL else {
-
- self = .unknown
- return
- }
- self = .progressiveMigrationRequired(localStoreURL: localStoreURL)
-
- case .asynchronousMigrationRequired:
- guard
- let localStoreURL = info["localStoreURL"] as? URL,
- case let nsError as NSError = info["NSError"]
- else {
-
- self = .unknown
- return
- }
- self = .asynchronousMigrationRequired(localStoreURL: localStoreURL, NSError: nsError)
-
- case .internalError:
- guard case let nsError as NSError = info["NSError"] else {
-
- self = .unknown
- return
- }
- self = .internalError(NSError: nsError)
-
- case .userError:
- guard case let error as Error = info["Error"] else {
-
- self = .unknown
- return
- }
- self = .userError(error: error)
-
- case .userCancelled:
- self = .userCancelled
-
- case .persistentStoreNotFound:
- guard let entity = info["entity"] as? DynamicObject.Type else {
-
- self = .unknown
- return
- }
- self = .persistentStoreNotFound(entity: entity)
- }
- }
-}
-
-
-// MARK: - Error
-
-extension Error {
-
- // MARK: Internal
-
- internal var bridgeToSwift: CoreStoreError {
-
- switch self {
-
- case let error as CoreStoreError:
- return error
-
- case let error as CSError:
- return error.bridgeToSwift
-
- case let error as NSError where Self.self is NSError.Type:
- return .internalError(NSError: error)
-
- default:
- return .unknown
- }
- }
-
- @available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
- internal var bridgeToObjectiveC: NSError {
-
- switch self {
-
- case let error as CoreStoreError:
- return error.bridgeToObjectiveC
-
- case let error as CSError:
- return error
-
- default:
- return self as NSError
- }
- }
-}
-
-
-// MARK: - CoreStoreError
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension CoreStoreError: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSError {
-
- return CSError(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSFrom.swift b/Sources/CSFrom.swift
index ced12dd..0023ab3 100644
--- a/Sources/CSFrom.swift
+++ b/Sources/CSFrom.swift
@@ -29,115 +29,46 @@ import CoreData
// MARK: - CSFrom
-/**
- The `CSFrom` serves as the Objective-C bridging type for `From`.
-
- - SeeAlso: `From`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSFrom: NSObject {
-
- /**
- The associated `NSManagedObject` entity class
- */
+
@objc
public var entityClass: AnyClass {
-
- return self.bridgeToSwift.entityClass
+
+ fatalError()
}
-
- /**
- The `NSPersistentStore` configuration names to associate objects from.
- May contain `NSString` instances to pertain to named configurations, or `NSNull` to pertain to the default configuration
- */
+
@objc
public var configurations: [Any]? {
-
- return self.bridgeToSwift.configurations?.map {
-
- switch $0 {
-
- case nil: return NSNull()
- case let string as NSString: return string
- }
- }
+
+ fatalError()
}
-
- /**
- Initializes a `CSFrom` clause with the specified entity class.
- ```
- MyPersonEntity *people = [transaction fetchAllFrom:CSFromClass([MyPersonEntity class])];
- ```
- - parameter entityClass: the `NSManagedObject` class type to be created
- */
+
@objc
public convenience init(entityClass: NSManagedObject.Type) {
-
- self.init(From(entityClass))
+
+ fatalError()
}
-
- /**
- Initializes a `CSFrom` clause with the specified configurations.
- ```
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class], @"Config1")];
- ```
- - parameter entityClass: 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 `[NSNull null]` to use the default configuration.
- */
+
@objc
public convenience init(entityClass: NSManagedObject.Type, configuration: Any) {
-
- switch configuration {
-
- case let string as String:
- self.init(From(entityClass, string))
-
- case is NSNull:
- self.init(From(entityClass, nil))
-
- default:
- Internals.abort("The configuration argument only accepts NSString and NSNull values")
- }
+
+ fatalError()
}
-
- /**
- Initializes a `CSFrom` clause with the specified configurations.
- ```
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class],
- @[[NSNull null], @"Config1"])];
- ```
- - parameter entityClass: 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.
- */
+
@objc
public convenience init(entityClass: NSManagedObject.Type, configurations: [Any]) {
-
- var arguments = [ModelConfiguration]()
- for configuration in configurations {
-
- switch configuration {
-
- case let string as String:
- arguments.append(string)
-
- case is NSNull:
- arguments.append(nil)
-
- default:
- Internals.abort("The configurations argument only accepts NSString and NSNull values")
- }
- }
- self.init(From(entityClass, arguments))
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -146,33 +77,21 @@ public final class CSFrom: NSObject {
public let bridgeToSwift: From
public init(_ swiftValue: From) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - From
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension From where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSFrom {
-
- return CSFrom(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> From {
-
- return From(
- entityClass: self.entityClass,
- configurations: self.configurations,
- findPersistentStores: self.findPersistentStores
- )
+
+ fatalError()
}
}
diff --git a/Sources/CSGroupBy.swift b/Sources/CSGroupBy.swift
index 9a7cff9..c39d9c0 100644
--- a/Sources/CSGroupBy.swift
+++ b/Sources/CSGroupBy.swift
@@ -29,65 +29,44 @@ import CoreData
// MARK: - CSGroupBy
-/**
- The `CSGroupBy` serves as the Objective-C bridging type for `GroupBy`.
-
- - SeeAlso: `GroupBy`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSGroupBy: NSObject, CSQueryClause {
- /**
- The list of key path strings to group results with
- */
@objc
public var keyPaths: [KeyPathString] {
-
- return self.bridgeToSwift.keyPaths
+
+ fatalError()
}
-
- /**
- Initializes a `CSGroupBy` clause with a key path string
-
- - parameter keyPath: a key path string to group results with
- */
+
@objc
public convenience init(keyPath: KeyPathString) {
-
- self.init(GroupBy(keyPath))
+
+ fatalError()
}
-
- /**
- Initializes a `CSGroupBy` clause with a list of key path strings
-
- - parameter keyPaths: a list of key path strings to group results with
- */
+
@objc
public convenience init(keyPaths: [KeyPathString]) {
-
- self.init(GroupBy(keyPaths))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSGroupBy else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -95,8 +74,8 @@ public final class CSGroupBy: NSObject, CSQueryClause {
@objc
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) {
-
- self.bridgeToSwift.applyToFetchRequest(fetchRequest)
+
+ fatalError()
}
@@ -105,29 +84,21 @@ public final class CSGroupBy: NSObject, CSQueryClause {
public let bridgeToSwift: GroupBy
public init(_ swiftValue: GroupBy) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - GroupBy
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension GroupBy where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSGroupBy {
-
- return CSGroupBy(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> GroupBy {
-
- return GroupBy(self.keyPaths)
+
+ fatalError()
}
}
diff --git a/Sources/CSInMemoryStore.swift b/Sources/CSInMemoryStore.swift
index 440c56d..7b12308 100644
--- a/Sources/CSInMemoryStore.swift
+++ b/Sources/CSInMemoryStore.swift
@@ -29,82 +29,56 @@ import CoreData
// MARK: - CSInMemoryStore
-/**
- The `CSInMemoryStore` serves as the Objective-C bridging type for `InMemoryStore`.
-
- - SeeAlso: `InMemoryStore`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjectiveCType {
-
- /**
- Initializes a `CSInMemoryStore` for the specified configuration
-
- - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration.
- */
+
@objc
public convenience init(configuration: ModelConfiguration) {
-
- self.init(InMemoryStore(configuration: configuration))
+
+ fatalError()
}
-
- /**
- Initializes a `CSInMemoryStore` with the "Default" configuration
- */
+
@objc
public convenience override init() {
-
- self.init(InMemoryStore())
+
+ fatalError()
}
// MARK: StorageInterface
-
- /**
- The string identifier for the `NSPersistentStore`'s `type` property. For `CSInMemoryStore`s, this is always set to `NSInMemoryStoreType`.
- */
+
@objc
public static let storeType = NSInMemoryStoreType
-
- /**
- The configuration name in the model file
- */
+
@objc
public var configuration: ModelConfiguration {
-
- return self.bridgeToSwift.configuration
+
+ fatalError()
}
- /**
- The options dictionary for the `NSPersistentStore`. For `CSInMemoryStore`s, this is always set to `nil`.
- */
@objc
public var storeOptions: [AnyHashable: Any]? {
-
- return self.bridgeToSwift.storeOptions
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.bridgeToSwift).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSInMemoryStore else {
-
- return false
- }
- return self.bridgeToSwift === object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -113,22 +87,21 @@ public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjec
public let bridgeToSwift: InMemoryStore
public required init(_ swiftValue: InMemoryStore) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - InMemoryStore
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension InMemoryStore: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSInMemoryStore {
-
- return CSInMemoryStore(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSInto.swift b/Sources/CSInto.swift
index a49e602..c9b8c3e 100644
--- a/Sources/CSInto.swift
+++ b/Sources/CSInto.swift
@@ -29,82 +29,50 @@ import CoreData
// MARK: - CSInto
-/**
- The `CSInto` serves as the Objective-C bridging type for `Into`.
-
- - SeeAlso: `Into`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSInto: NSObject {
-
- /**
- The associated `NSManagedObject` entity class
- */
+
@objc
public var entityClass: NSManagedObject.Type {
-
- return self.bridgeToSwift.entityClass
+
+ fatalError()
}
-
- /**
- The `NSPersistentStore` configuration name to associate objects from.
- May contain a `String` to pertain to a named configuration, or `nil` to pertain to the default configuration
- */
+
@objc
public var configuration: ModelConfiguration {
-
- return self.bridgeToSwift.configuration
+
+ fatalError()
}
-
- /**
- Initializes a `CSInto` clause with the specified entity class.
- ```
- MyPersonEntity *person = [transaction createInto:
- CSIntoClass([MyPersonEntity class])];
- ```
- - parameter entityClass: the `NSManagedObject` class type to be created
- */
+
@objc
public convenience init(entityClass: NSManagedObject.Type) {
-
- self.init(Into(entityClass))
+
+ fatalError()
}
-
- /**
- Initializes a `CSInto` clause with the specified configuration.
- ```
- MyPersonEntity *person = [transaction createInto:
- CSIntoClass([MyPersonEntity class])];
- ```
- - parameter entityClass: the `NSManagedObject` class type to be created
- - parameter configuration: the `NSPersistentStore` configuration name to associate the object to. This parameter is required if multiple configurations contain the created `NSManagedObject`'s entity type. Set to `nil` to use the default configuration.
- */
+
@objc
public convenience init(entityClass: NSManagedObject.Type, configuration: ModelConfiguration) {
-
- self.init(Into(entityClass, configuration))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSInto else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -113,9 +81,8 @@ public final class CSInto: NSObject {
public let bridgeToSwift: Into
public required init(_ swiftValue: Into) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
@@ -125,21 +92,10 @@ public final class CSInto: NSObject {
extension Into where O: NSManagedObject {
// MARK: CoreStoreSwiftType
-
+
+ @available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
public var bridgeToObjectiveC: CSInto {
-
- return CSInto(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> Into {
-
- return Into(
- entityClass: self.entityClass,
- configuration: self.configuration,
- inferStoreIfPossible: self.inferStoreIfPossible
- )
+
+ fatalError()
}
}
diff --git a/Sources/CSListMonitor.swift b/Sources/CSListMonitor.swift
index f4a5d67..eef9a04 100644
--- a/Sources/CSListMonitor.swift
+++ b/Sources/CSListMonitor.swift
@@ -29,503 +29,201 @@ import CoreData
// MARK: - CSListMonitor
-/**
- The `CSListMonitor` serves as the Objective-C bridging type for `ListMonitor`.
-
- - SeeAlso: `ListMonitor`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSListMonitor: NSObject {
// MARK: Public (Accessors)
- /**
- Returns the object at the given index within the first section. This subscript indexer is typically used for `CSListMonitor`s created without section groupings.
-
- - parameter index: the index of the object. Using an index above the valid range will raise an exception.
- - returns: the `NSManagedObject` at the specified index
- */
@objc
public subscript(index: Int) -> Any {
-
- return self.bridgeToSwift[index]
+
+ fatalError()
}
-
- /**
- Returns the object at the given index, or `nil` if out of bounds. This indexer is typically used for `CSListMonitor`s created without section groupings.
-
- - parameter index: the index for the object. Using an index above the valid range will return `nil`.
- - returns: the `NSManagedObject` at the specified index, or `nil` if out of bounds
- */
+
@objc
public func objectAtSafeIndex(_ index: Int) -> Any? {
-
- return self.bridgeToSwift[safeIndex: index]
+
+ fatalError()
}
-
- /**
- Returns the object at the given `sectionIndex` and `itemIndex`. This indexer is typically used for `CSListMonitor`s created as sectioned lists.
-
- - parameter sectionIndex: the section index for the object. Using a `sectionIndex` with an invalid range will raise an exception.
- - parameter itemIndex: the index for the object within the section. Using an `itemIndex` with an invalid range will raise an exception.
- - returns: the `NSManagedObject` at the specified section and item index
- */
+
@objc
public func objectAtSectionIndex(_ sectionIndex: Int, itemIndex: Int) -> Any {
-
- return self.bridgeToSwift[sectionIndex, itemIndex]
- } /**
- Returns the object at the given section and item index, or `nil` if out of bounds. This indexer is typically used for `CSListMonitor`s created as sectioned lists.
-
- - parameter sectionIndex: the section index for the object. Using a `sectionIndex` with an invalid range will return `nil`.
- - parameter itemIndex: the index for the object within the section. Using an `itemIndex` with an invalid range will return `nil`.
- - returns: the `NSManagedObject` at the specified section and item index, or `nil` if out of bounds
- */
+
+ fatalError()
+ }
+
@objc
public func objectAtSafeSectionIndex(_ sectionIndex: Int, safeItemIndex itemIndex: Int) -> Any? {
-
- return self.bridgeToSwift[safeSectionIndex: sectionIndex, safeItemIndex: itemIndex]
+
+ fatalError()
}
-
- /**
- Returns the object at the given `NSIndexPath`. This subscript indexer is typically used for `CSListMonitor`s created as sectioned lists.
-
- - parameter indexPath: the `NSIndexPath` for the object. Using an `indexPath` with an invalid range will raise an exception.
- - returns: the `NSManagedObject` at the specified index path
- */
+
@objc
public func objectAtIndexPath(_ indexPath: IndexPath) -> Any {
-
- return self.bridgeToSwift[indexPath]
+
+ fatalError()
}
-
- /**
- Returns the object at the given `NSIndexPath`, or `nil` if out of bounds. This subscript indexer is typically used for `CSListMonitor`s created as sectioned lists.
-
- - parameter indexPath: the `NSIndexPath` for the object. Using an `indexPath` with an invalid range will return `nil`.
- - returns: the `NSManagedObject` at the specified index path, or `nil` if out of bounds
- */
+
@objc
public func objectAtSafeIndexPath(_ indexPath: IndexPath) -> Any? {
-
- return self.bridgeToSwift[safeIndexPath: indexPath]
+
+ fatalError()
}
-
- /**
- Checks if the `CSListMonitor` has at least one object in any section.
-
- - returns: `YES` if at least one object in any section exists, `NO` otherwise
- */
+
@objc
public func hasObjects() -> Bool {
-
- return self.bridgeToSwift.hasObjects()
+
+ fatalError()
}
-
- /**
- Checks if the `CSListMonitor` has at least one object the specified section.
-
- - parameter section: the section index. Using an index outside the valid range will return `NO`.
- - returns: `YES` if at least one object in the specified section exists, `NO` otherwise
- */
+
@objc
public func hasObjectsInSection(_ section: Int) -> Bool {
-
- return self.bridgeToSwift.hasObjects(in: section)
+
+ fatalError()
}
-
- /**
- Returns all objects in all sections
-
- - returns: all objects in all sections
- */
+
@objc
public func objectsInAllSections() -> [NSManagedObject] {
-
- return self.bridgeToSwift.objectsInAllSections()
+
+ fatalError()
}
-
- /**
- Returns all objects in the specified section
-
- - parameter section: the section index. Using an index outside the valid range will raise an exception.
- - returns: all objects in the specified section
- */
+
@objc
public func objectsInSection(_ section: Int) -> [NSManagedObject] {
-
- return self.bridgeToSwift.objects(in: section)
+
+ fatalError()
}
-
- /**
- Returns all objects in the specified section, or `nil` if out of bounds.
-
- - parameter section: the section index. Using an index outside the valid range will return `nil`.
- - returns: all objects in the specified section, or `nil` if out of bounds
- */
+
@objc
public func objectsInSafeSection(safeSectionIndex section: Int) -> [NSManagedObject]? {
-
- return self.bridgeToSwift.objects(safelyIn: section)
+
+ fatalError()
}
- /**
- Returns the number of sections
-
- - returns: the number of sections
- */
@objc
public func numberOfSections() -> Int {
-
- return self.bridgeToSwift.numberOfSections()
- }
-
- /**
- Returns the number of objects in all sections
-
- - returns: the number of objects in all sections
- */
- @objc
- public func numberOfObjects() -> Int {
-
- return self.bridgeToSwift.numberOfObjects()
+
+ fatalError()
+ }
+
+ @objc
+ public func numberOfObjects() -> Int {
+
+ fatalError()
}
- /**
- Returns the number of objects in the specified section
-
- - parameter section: the section index. Using an index outside the valid range will raise an exception.
- - returns: the number of objects in the specified section
- */
@objc
public func numberOfObjectsInSection(_ section: Int) -> Int {
-
- return self.bridgeToSwift.numberOfObjects(in: section)
+
+ fatalError()
}
-
- /**
- Returns the number of objects in the specified section, or `nil` if out of bounds.
-
- - parameter section: the section index. Using an index outside the valid range will return `nil`.
- - returns: the number of objects in the specified section, or `nil` if out of bounds
- */
+
@objc
public func numberOfObjectsInSafeSection(safeSectionIndex section: Int) -> NSNumber? {
-
- return self.bridgeToSwift
- .numberOfObjects(safelyIn: section)
- .flatMap { NSNumber(value: $0) }
+
+ fatalError()
}
-
- /**
- Returns the `NSFetchedResultsSectionInfo` for the specified section
-
- - parameter section: the section index. Using an index outside the valid range will raise an exception.
- - returns: the `NSFetchedResultsSectionInfo` for the specified section
- */
+
@objc
public func sectionInfoAtIndex(_ section: Int) -> NSFetchedResultsSectionInfo {
-
- return self.bridgeToSwift.sectionInfo(at: section)
+
+ fatalError()
}
-
- /**
- Returns the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if out of bounds.
-
- - parameter section: the section index. Using an index outside the valid range will return `nil`.
- - returns: the `NSFetchedResultsSectionInfo` for the specified section, or `nil` if the section index is out of bounds.
- */
+
@objc
public func sectionInfoAtSafeSectionIndex(safeSectionIndex section: Int) -> NSFetchedResultsSectionInfo? {
-
- return self.bridgeToSwift.sectionInfo(safelyAt: section)
+
+ fatalError()
}
-
- /**
- Returns the `NSFetchedResultsSectionInfo`s for all sections
-
- - returns: the `NSFetchedResultsSectionInfo`s for all sections
- */
+
@objc
public func sections() -> [NSFetchedResultsSectionInfo] {
-
- return self.bridgeToSwift.sections()
+
+ fatalError()
}
-
- /**
- Returns the target section for a specified "Section Index" title and index.
-
- - parameter title: the title of the Section Index
- - parameter index: the index of the Section Index
- - returns: the target section for the specified "Section Index" title and index.
- */
+
@objc
public func targetSectionForSectionIndexTitle(title: String, index: Int) -> Int {
-
- return self.bridgeToSwift.targetSection(forSectionIndexTitle: title, at: index)
+
+ fatalError()
}
-
- /**
- Returns the section index titles for all sections
-
- - returns: the section index titles for all sections
- */
+
@objc
public func sectionIndexTitles() -> [String] {
-
- return self.bridgeToSwift.sectionIndexTitles()
+
+ fatalError()
}
-
- /**
- Returns the index of the `NSManagedObject` if it exists in the `CSListMonitor`'s fetched objects, or `nil` if not found.
-
- - parameter object: the `NSManagedObject` to search the index of
- - returns: the index of the `NSManagedObject` if it exists in the `CSListMonitor`'s fetched objects, or `nil` if not found.
- */
+
@objc
public func indexOf(_ object: NSManagedObject) -> NSNumber? {
-
- return self.bridgeToSwift
- .index(of: object)
- .flatMap { NSNumber(value: $0) }
+
+ fatalError()
}
-
- /**
- Returns the `NSIndexPath` of the `NSManagedObject` if it exists in the `CSListMonitor`'s fetched objects, or `nil` if not found.
-
- - parameter object: the `NSManagedObject` to search the index of
- - returns: the `NSIndexPath` of the `NSManagedObject` if it exists in the `ListMonitor`'s fetched objects, or `nil` if not found.
- */
+
@objc
public func indexPathOf(_ object: NSManagedObject) -> IndexPath? {
-
- return self.bridgeToSwift.indexPath(of: object)
+
+ fatalError()
}
// MARK: Public (Observers)
-
- /**
- Registers a `CSListObserver` to be notified when changes to the receiver's list occur.
-
- To prevent retain-cycles, `CSListMonitor` only keeps `weak` references to its observers.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- Calling `-addListObserver:` multiple times on the same observer is safe, as `CSListMonitor` unregisters previous notifications to the observer before re-registering them.
-
- - parameter observer: a `CSListObserver` to send change notifications to
- */
+
@objc
public func addListObserver(_ observer: CSListObserver) {
-
- let swift = self.bridgeToSwift
- swift.unregisterObserver(observer)
- swift.registerObserver(
- observer,
- willChange: { (observer, monitor) in
-
- observer.listMonitorWillChange?(monitor.bridgeToObjectiveC)
- },
- didChange: { (observer, monitor) in
-
- observer.listMonitorDidChange?(monitor.bridgeToObjectiveC)
- },
- willRefetch: { (observer, monitor) in
-
- observer.listMonitorWillRefetch?(monitor.bridgeToObjectiveC)
- },
- didRefetch: { (observer, monitor) in
-
- observer.listMonitorDidRefetch?(monitor.bridgeToObjectiveC)
- }
- )
+
+ fatalError()
}
-
- /**
- Registers a `CSListObjectObserver` to be notified when changes to the receiver's list occur.
-
- To prevent retain-cycles, `CSListMonitor` only keeps `weak` references to its observers.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- Calling `-addListObjectObserver:` multiple times on the same observer is safe, as `ListMonitor` unregisters previous notifications to the observer before re-registering them.
-
- - parameter observer: a `CSListObjectObserver` to send change notifications to
- */
+
public func addListObjectObserver(_ observer: CSListObjectObserver) {
-
- let swift = self.bridgeToSwift
- swift.unregisterObserver(observer)
- swift.registerObserver(
- observer,
- willChange: { (observer, monitor) in
-
- observer.listMonitorWillChange?(monitor.bridgeToObjectiveC)
- },
- didChange: { (observer, monitor) in
-
- observer.listMonitorDidChange?(monitor.bridgeToObjectiveC)
- },
- willRefetch: { (observer, monitor) in
-
- observer.listMonitorWillRefetch?(monitor.bridgeToObjectiveC)
- },
- didRefetch: { (observer, monitor) in
-
- observer.listMonitorDidRefetch?(monitor.bridgeToObjectiveC)
- }
- )
- swift.registerObserver(
- observer,
- didInsertObject: { (observer, monitor, object, toIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didInsertObject: object, toIndexPath: toIndexPath)
- },
- didDeleteObject: { (observer, monitor, object, fromIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didDeleteObject: object, fromIndexPath: fromIndexPath)
- },
- didUpdateObject: { (observer, monitor, object, atIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didUpdateObject: object, atIndexPath: atIndexPath)
- },
- didMoveObject: { (observer, monitor, object, fromIndexPath, toIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didMoveObject: object, fromIndexPath: fromIndexPath, toIndexPath: toIndexPath)
- }
- )
+
+ fatalError()
}
-
- /**
- Registers a `CSListSectionObserver` to be notified when changes to the receiver's list occur.
-
- To prevent retain-cycles, `CSListMonitor` only keeps `weak` references to its observers.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- Calling `-addListSectionObserver:` multiple times on the same observer is safe, as `ListMonitor` unregisters previous notifications to the observer before re-registering them.
-
- - parameter observer: a `CSListSectionObserver` to send change notifications to
- */
+
@objc
public func addListSectionObserver(_ observer: CSListSectionObserver) {
-
- let swift = self.bridgeToSwift
- swift.unregisterObserver(observer)
- swift.registerObserver(
- observer,
- willChange: { (observer, monitor) in
-
- observer.listMonitorWillChange?(monitor.bridgeToObjectiveC)
- },
- didChange: { (observer, monitor) in
-
- observer.listMonitorDidChange?(monitor.bridgeToObjectiveC)
- },
- willRefetch: { (observer, monitor) in
-
- observer.listMonitorWillRefetch?(monitor.bridgeToObjectiveC)
- },
- didRefetch: { (observer, monitor) in
-
- observer.listMonitorDidRefetch?(monitor.bridgeToObjectiveC)
- }
- )
- swift.registerObserver(
- observer,
- didInsertObject: { (observer, monitor, object, toIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didInsertObject: object, toIndexPath: toIndexPath)
- },
- didDeleteObject: { (observer, monitor, object, fromIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didDeleteObject: object, fromIndexPath: fromIndexPath)
- },
- didUpdateObject: { (observer, monitor, object, atIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didUpdateObject: object, atIndexPath: atIndexPath)
- },
- didMoveObject: { (observer, monitor, object, fromIndexPath, toIndexPath) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didMoveObject: object, fromIndexPath: fromIndexPath, toIndexPath: toIndexPath)
- }
- )
- swift.registerObserver(
- observer,
- didInsertSection: { (observer, monitor, sectionInfo, toIndex) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didInsertSection: sectionInfo, toSectionIndex: toIndex)
- },
- didDeleteSection: { (observer, monitor, sectionInfo, fromIndex) in
-
- observer.listMonitor?(monitor.bridgeToObjectiveC, didDeleteSection: sectionInfo, fromSectionIndex: fromIndex)
- }
- )
+
+ fatalError()
}
-
- /**
- Unregisters a `CSListObserver` from receiving notifications for changes to the receiver's list.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- - parameter observer: a `CSListObserver` to unregister notifications to
- */
+
@objc
public func removeListObserver(_ observer: CSListObserver) {
-
- self.bridgeToSwift.unregisterObserver(observer)
+
+ fatalError()
}
// MARK: Public (Refetching)
-
- /**
- Returns `YES` if a call to `-refetch:` was made to the `CSListMonitor` and is currently waiting for the fetching to complete. Returns `NO` otherwise.
- */
+
@objc
public var isPendingRefetch: Bool {
-
- return self.bridgeToSwift.isPendingRefetch
+
+ fatalError()
}
-
- /**
- Asks the `CSListMonitor` to refetch its objects using the specified series of `CSFetchClause`s. Note that this method does not execute the fetch immediately; the actual fetching will happen after the `NSFetchedResultsController`'s last `controllerDidChangeContent(_:)` notification completes.
-
- `refetch(...)` broadcasts `listMonitorWillRefetch(...)` to its observers immediately, and then `listMonitorDidRefetch(...)` after the new fetch request completes.
-
- - parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- - Important: Starting CoreStore 4.0, all `CSFetchClause`s required by the `CSListMonitor` should be provided in the arguments list of `refetch(...)`.
- */
+
@objc
public func refetch(_ fetchClauses: [CSFetchClause]) {
-
- self.bridgeToSwift.refetch { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- }
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSListMonitor else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -536,33 +234,21 @@ public final class CSListMonitor: NSObject {
@nonobjc
public required init(_ swiftValue: ListMonitor) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - ListMonitor
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension ListMonitor where ListMonitor.ObjectType: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSListMonitor {
-
- return CSListMonitor(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> ListMonitor {
-
- func noWarnUnsafeBitCast(_ x: T, to type: U.Type) -> U {
-
- return unsafeBitCast(x, to: type)
- }
- return noWarnUnsafeBitCast(self, to: ListMonitor.self)
+
+ fatalError()
}
}
diff --git a/Sources/CSListObserver.swift b/Sources/CSListObserver.swift
index 8c48e7f..2f1723a 100644
--- a/Sources/CSListObserver.swift
+++ b/Sources/CSListObserver.swift
@@ -29,49 +29,19 @@ import CoreData
// MARK: - CSListObserver
-/**
- Implement the `CSListObserver` protocol to observe changes to a list of `NSManagedObject`s. `CSListObserver`s may register themselves to a `CSListMonitor`'s `-addListObserver:` method:
- ```
- CSListMonitor *monitor = [CSCoreStore
- monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]]
- fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]];
- [monitor addListObserver:self];
- ```
-
- - SeeAlso: `ListObserver`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSListObserver: AnyObject {
-
- /**
- Handles processing just before a change to the observed list occurs
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- */
+
@objc
optional func listMonitorWillChange(_ monitor: CSListMonitor)
-
- /**
- Handles processing right after a change to the observed list occurs
-
- - parameter monitor: the `CSListMonitor` monitoring the object being observed
- */
+
@objc
optional func listMonitorDidChange(_ monitor: CSListMonitor)
-
- /**
- This method is broadcast from within the `CSListMonitor`'s `-refetchWithFetchClauses:` method to let observers prepare for the internal `NSFetchedResultsController`'s pending change to its predicate, sort descriptors, etc. Note that the actual refetch will happen after the `NSFetchedResultsController`'s last `-controllerDidChangeContent:` notification completes.
-
- - parameter monitor: the `CSListMonitor` monitoring the object being observed
- */
+
@objc
optional func listMonitorWillRefetch(_ monitor: CSListMonitor)
-
- /**
- After the `CSListMonitor`'s `-refetchWithFetchClauses:` method is called, this method is broadcast after the `NSFetchedResultsController`'s last `-controllerDidChangeContent:` notification completes.
-
- - parameter monitor: the `CSListMonitor` monitoring the object being observed
- */
+
@objc
optional func listMonitorDidRefetch(_ monitor: CSListMonitor)
}
@@ -79,58 +49,19 @@ public protocol CSListObserver: AnyObject {
// MARK: - ListObjectObserver
-/**
- Implement the `CSListObjectObserver` protocol to observe detailed changes to a list's object. `CSListObjectObserver`s may register themselves to a `CSListMonitor`'s `-addListObjectObserver(_:)` method:
- ```
- CSListMonitor *monitor = [CSCoreStore
- monitorListFrom:[CSFrom entityClass:[MyPersonEntity class]]
- fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]];
- [monitor addListObjectObserver:self];
- ```
-
- - SeeAlso: `ListObjectObserver`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSListObjectObserver: CSListObserver {
-
- /**
- Notifies that an object was inserted to the specified `NSIndexPath` in the list
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter object: the entity type for the inserted object
- - parameter indexPath: the new `NSIndexPath` for the inserted object
- */
+
@objc
optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: Any, toIndexPath indexPath: IndexPath)
-
- /**
- Notifies that an object was deleted from the specified `NSIndexPath` in the list
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter object: the entity type for the deleted object
- - parameter indexPath: the `NSIndexPath` for the deleted object
- */
+
@objc
optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: Any, fromIndexPath indexPath: IndexPath)
-
- /**
- Notifies that an object at the specified `NSIndexPath` was updated
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter object: the entity type for the updated object
- - parameter indexPath: the `NSIndexPath` for the updated object
- */
+
@objc
optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: Any, atIndexPath indexPath: IndexPath)
-
- /**
- Notifies that an object's index changed
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter object: the entity type for the moved object
- - parameter fromIndexPath: the previous `NSIndexPath` for the moved object
- - parameter toIndexPath: the new `NSIndexPath` for the moved object
- */
+
@objc
optional func listMonitor(_ monitor: CSListMonitor, didMoveObject object: Any, fromIndexPath: IndexPath, toIndexPath: IndexPath)
}
@@ -138,38 +69,13 @@ public protocol CSListObjectObserver: CSListObserver {
// MARK: - CSListSectionObserver
-/**
- Implement the `CSListSectionObserver` protocol to observe changes to a list's section info. `CSListSectionObserver`s may register themselves to a `CSListMonitor`'s `-addListSectionObserver:` method:
- ```
- CSListMonitor *monitor = [CSCoreStore
- monitorSectionedListFrom:[CSFrom entityClass:[MyPersonEntity class]]
- sectionBy:[CSSectionBy keyPath:@"age"]
- fetchClauses:@[[CSOrderBy sortDescriptor:[CSSortKey withKeyPath:@"lastName" ascending:YES]]]];
- [monitor addListSectionObserver:self];
- ```
-
- - SeeAlso: `ListSectionObserver`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSListSectionObserver: CSListObjectObserver {
-
- /**
- Notifies that a section was inserted at the specified index
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter sectionInfo: the `NSFetchedResultsSectionInfo` for the inserted section
- - parameter sectionIndex: the new section index for the new section
- */
+
@objc
optional func listMonitor(_ monitor: CSListMonitor, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int)
- /**
- Notifies that a section was inserted at the specified index
-
- - parameter monitor: the `CSListMonitor` monitoring the list being observed
- - parameter sectionInfo: the `NSFetchedResultsSectionInfo` for the deleted section
- - parameter sectionIndex: the previous section index for the deleted section
- */
@objc
optional func listMonitor(_ monitor: CSListMonitor, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int)
}
diff --git a/Sources/CSMigrationResult.swift b/Sources/CSMigrationResult.swift
index 54cea1e..2d1ac06 100644
--- a/Sources/CSMigrationResult.swift
+++ b/Sources/CSMigrationResult.swift
@@ -29,134 +29,68 @@ import CoreData
// MARK: - CSMigrationResult
-/**
- The `CSMigrationResult` serves as the Objective-C bridging type for `MigrationResult`.
-
- - SeeAlso: `MigrationResult`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
-
- /**
- `YES` if the migration succeeded, `NO` otherwise
- */
+
@objc
public var isSuccess: Bool {
-
- return (try? self.bridgeToSwift.get()) != nil
+
+ fatalError()
}
-
- /**
- `YES` if the migration failed, `NO` otherwise
- */
+
@objc
public var isFailure: Bool {
return !self.isSuccess
}
-
- /**
- `YES` if the migration succeeded, `NO` otherwise
- */
+
@objc
public var migrationTypes: [CSMigrationType]? {
-
- guard case .success(let migrationTypes) = self.bridgeToSwift else {
-
- return nil
- }
- return migrationTypes.map { $0.bridgeToObjectiveC }
+
+ fatalError()
}
-
- /**
- The `NSError` for a failed migration, or `nil` if the migration succeeded
- */
+
@objc
public var error: NSError? {
-
- guard case .failure(let error) = self.bridgeToSwift else {
-
- return nil
- }
- return error.bridgeToObjectiveC
+
+ fatalError()
}
-
- /**
- If the result was a success, the `success` block is executed with an array of `CSMigrationType`s that indicates the migration steps completed. If the result was a failure, the `failure` block is executed with an `NSError` argument pertaining to the actual error.
-
- The blocks are executed immediately as `@noescape` and will not be retained.
-
- - parameter success: the block to execute on success. The block passes an array of `CSMigrationType`s that indicates the migration steps completed.
- - parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
- */
+
@objc
public func handleSuccess(_ success: (_ migrationTypes: [CSMigrationType]) -> Void, failure: (_ error: NSError) -> Void) {
-
- switch self.bridgeToSwift {
-
- case .success(let migrationTypes):
- success(migrationTypes.map { $0.bridgeToObjectiveC })
-
- case .failure(let error):
- failure(error.bridgeToObjectiveC)
- }
+
+ fatalError()
}
-
- /**
- If the result was a success, the `success` block is executed with an array of `CSMigrationType`s that indicates the migration steps completed. If the result was a failure, this method does nothing.
-
- The block is executed immediately as `@noescape` and will not be retained.
-
- - parameter success: the block to execute on success. The block passes an array of `CSMigrationType`s that indicates the migration steps completed.
- */
+
@objc
public func handleSuccess(_ success: (_ migrationTypes: [CSMigrationType]) -> Void) {
-
- guard case .success(let migrationTypes) = self.bridgeToSwift else {
-
- return
- }
- success(migrationTypes.map { $0.bridgeToObjectiveC })
+
+ fatalError()
}
-
- /**
- If the result was a failure, the `failure` block is executed with an `NSError` argument pertaining to the actual error. If the result was a success, this method does nothing.
-
- The block is executed immediately as `@noescape` and will not be retained.
-
- - parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
- */
+
@objc
public func handleFailure(_ failure: (_ error: NSError) -> Void) {
-
- guard case .failure(let error) = self.bridgeToSwift else {
-
- return
- }
- failure(error.bridgeToObjectiveC)
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSMigrationResult else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -165,22 +99,21 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
public let bridgeToSwift: MigrationResult
public required init(_ swiftValue: MigrationResult) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - MigrationResult
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension MigrationResult {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSMigrationResult {
-
- return CSMigrationResult(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSMigrationType.swift b/Sources/CSMigrationType.swift
index 9669c32..129321a 100644
--- a/Sources/CSMigrationType.swift
+++ b/Sources/CSMigrationType.swift
@@ -29,80 +29,56 @@ import CoreData
// MARK: - CSMigrationType
-/**
- The `CSMigrationType` serves as the Objective-C bridging type for `MigrationType`.
-
- - SeeAlso: `MigrationType`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
-
- /**
- Returns `YES` if the `CSMigrationType`'s `sourceVersion` and `destinationVersion` do not match. Returns `NO` otherwise.
- */
+
@objc
public var needsMigration: Bool {
-
- return self.bridgeToSwift.hasMigration
+
+ fatalError()
}
-
- /**
- Returns the source model version for the migration type. If no migration is required, `sourceVersion` will be equal to the `destinationVersion`.
- */
+
@objc
public var sourceVersion: String {
-
- return self.bridgeToSwift.sourceVersion
+
+ fatalError()
}
-
- /**
- Returns the destination model version for the migration type. If no migration is required, `destinationVersion` will be equal to the `sourceVersion`.
- */
+
@objc
public var destinationVersion: String {
-
- return self.bridgeToSwift.destinationVersion
+
+ fatalError()
}
-
- /**
- Returns `YES` if the `CSMigrationType` is a lightweight migration. Used as syntactic sugar.
- */
+
@objc
public var isLightweightMigration: Bool {
-
- return self.bridgeToSwift.isLightweightMigration
+
+ fatalError()
}
-
- /**
- Returns `YES` if the `CSMigrationType` is a heavyweight migration. Used as syntactic sugar.
- */
+
@objc
public var isHeavyweightMigration: Bool {
-
- return self.bridgeToSwift.isHeavyweightMigration
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSMigrationType else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -111,22 +87,21 @@ public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
public let bridgeToSwift: MigrationType
public required init(_ swiftValue: MigrationType) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - MigrationType
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension MigrationType: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSMigrationType {
-
- return CSMigrationType(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSObjectMonitor.swift b/Sources/CSObjectMonitor.swift
index 41f78c5..e2d466d 100644
--- a/Sources/CSObjectMonitor.swift
+++ b/Sources/CSObjectMonitor.swift
@@ -29,72 +29,28 @@ import CoreData
// MARK: - CSObjectMonitor
-/**
- The `CSObjectMonitor` serves as the Objective-C bridging type for `ObjectMonitor`.
-
- - SeeAlso: `ObjectMonitor`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSObjectMonitor: NSObject {
- /**
- Returns the `NSManagedObject` instance being observed, or `nil` if the object was already deleted.
- */
public var object: Any? {
-
- return self.bridgeToSwift.object
+
+ fatalError()
}
-
- /**
- Returns `YES` if the `NSManagedObject` instance being observed still exists, or `NO` if the object was already deleted.
- */
+
public var isObjectDeleted: Bool {
-
- return self.bridgeToSwift.isObjectDeleted
+
+ fatalError()
}
-
- /**
- Registers a `CSObjectObserver` to be notified when changes to the receiver's `object` are made.
-
- To prevent retain-cycles, `CSObjectMonitor` only keeps `weak` references to its observers.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- Calling `-addObjectObserver:` multiple times on the same observer is safe, as `CSObjectMonitor` unregisters previous notifications to the observer before re-registering them.
-
- - parameter observer: an `CSObjectObserver` to send change notifications to
- */
+
public func addObjectObserver(_ observer: CSObjectObserver) {
-
- let swift = self.bridgeToSwift
- swift.unregisterObserver(observer)
- swift.registerObserver(
- observer,
- willChangeObject: { (observer, monitor, object) in
-
- observer.objectMonitor?(monitor.bridgeToObjectiveC, willUpdateObject: object)
- },
- didDeleteObject: { (observer, monitor, object) in
-
- observer.objectMonitor?(monitor.bridgeToObjectiveC, didDeleteObject: object)
- },
- didUpdateObject: { (observer, monitor, object, changedPersistentKeys) in
-
- observer.objectMonitor?(monitor.bridgeToObjectiveC, didUpdateObject: object, changedPersistentKeys: changedPersistentKeys)
- }
- )
+
+ fatalError()
}
-
- /**
- Unregisters an `CSObjectObserver` from receiving notifications for changes to the receiver's `object`.
-
- For thread safety, this method needs to be called from the main thread. An assertion failure will occur (on debug builds only) if called from any thread other than the main thread.
-
- - parameter observer: an `CSObjectObserver` to unregister notifications to
- */
+
public func removeObjectObserver(_ observer: CSObjectObserver) {
-
- self.bridgeToSwift.unregisterObserver(observer)
+
+ fatalError()
}
@@ -102,23 +58,17 @@ public final class CSObjectMonitor: NSObject {
public override var hash: Int {
- var hasher = Hasher()
- self.bridgeToSwift.hash(into: &hasher)
- return hasher.finalize()
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSObjectMonitor else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -129,33 +79,21 @@ public final class CSObjectMonitor: NSObject {
@nonobjc
public required init(_ swiftValue: ObjectMonitor) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - ObjectMonitor
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension ObjectMonitor where ObjectMonitor.ObjectType: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSObjectMonitor {
-
- return CSObjectMonitor(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> ObjectMonitor {
-
- func noWarnUnsafeBitCast(_ x: T, to type: U.Type) -> U {
-
- return unsafeBitCast(x, to: type)
- }
- return noWarnUnsafeBitCast(self, to: ObjectMonitor.self)
+
+ fatalError()
}
}
diff --git a/Sources/CSObjectObserver.swift b/Sources/CSObjectObserver.swift
index 3490882..5ad1006 100644
--- a/Sources/CSObjectObserver.swift
+++ b/Sources/CSObjectObserver.swift
@@ -29,43 +29,16 @@ import CoreData
// MARK: - CSObjectObserver
-/**
- Implement the `CSObjectObserver` protocol to observe changes to a single `NSManagedObject` instance. `CSObjectObserver`s may register themselves to a `CSObjectMonitor`'s `-addObjectObserver:` method:
- ```
- CSObjectMonitor *monitor = [CSCoreStore monitorObject:myObject];
- [monitor addObjectObserver:self];
- ```
-
- - SeeAlso: `ObjectObserver`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSObjectObserver: AnyObject {
- /**
- Handles processing just before a change to the observed `object` occurs
-
- - parameter monitor: the `CSObjectMonitor` monitoring the object being observed
- - parameter object: the `NSManagedObject` instance being observed
- */
@objc
optional func objectMonitor(_ monitor: CSObjectMonitor, willUpdateObject object: Any)
-
- /**
- Handles processing right after a change to the observed `object` occurs
-
- - parameter monitor: the `CSObjectMonitor` monitoring the object being observed
- - parameter object: the `NSManagedObject` instance being observed
- - parameter changedPersistentKeys: an `NSSet` of key paths for the attributes that were changed. Note that `changedPersistentKeys` only contains keys for attributes/relationships present in the persistent store, thus transient properties will not be reported.
- */
+
@objc
optional func objectMonitor(_ monitor: CSObjectMonitor, didUpdateObject object: Any, changedPersistentKeys: Set)
-
- /**
- Handles processing right after `object` is deleted
-
- - parameter monitor: the `CSObjectMonitor` monitoring the object being observed
- - parameter object: the `NSManagedObject` instance being observed
- */
+
@objc
optional func objectMonitor(_ monitor: CSObjectMonitor, didDeleteObject object: Any)
}
diff --git a/Sources/CSOrderBy.swift b/Sources/CSOrderBy.swift
index 7355596..ee74ce0 100644
--- a/Sources/CSOrderBy.swift
+++ b/Sources/CSOrderBy.swift
@@ -29,73 +29,44 @@ import CoreData
// MARK: - CSOrderBy
-/**
- The `CSOrderBy` serves as the Objective-C bridging type for `OrderBy`.
-
- - SeeAlso: `OrderBy`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause {
- /**
- The list of sort descriptors
- */
@objc
public var sortDescriptors: [NSSortDescriptor] {
-
- return self.bridgeToSwift.sortDescriptors
+
+ fatalError()
}
-
- /**
- Initializes a `CSOrderBy` clause with a single sort descriptor
- ```
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]];
- ```
- - parameter sortDescriptor: a `NSSortDescriptor`
- */
+
@objc
public convenience init(sortDescriptor: NSSortDescriptor) {
-
- self.init(OrderBy(sortDescriptor))
+
+ fatalError()
}
-
- /**
- Initializes a `CSOrderBy` clause with a list of sort descriptors
- ```
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKeys(CSSortAscending(@"fullname"), CSSortDescending(@"age"), nil))]]];
- ```
- - parameter sortDescriptors: an array of `NSSortDescriptor`s
- */
+
@objc
public convenience init(sortDescriptors: [NSSortDescriptor]) {
-
- self.init(OrderBy(sortDescriptors))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSOrderBy else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -103,8 +74,8 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
@objc
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) {
-
- self.bridgeToSwift.applyToFetchRequest(fetchRequest)
+
+ fatalError()
}
@@ -113,29 +84,21 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
public let bridgeToSwift: OrderBy
public init(_ swiftValue: OrderBy) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - OrderBy
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension OrderBy where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSOrderBy {
-
- return CSOrderBy(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> OrderBy {
-
- return OrderBy(self.sortDescriptors)
+
+ fatalError()
}
}
diff --git a/Sources/CSSQliteStore.swift b/Sources/CSSQliteStore.swift
index b786bf3..b6fdf5a 100644
--- a/Sources/CSSQliteStore.swift
+++ b/Sources/CSSQliteStore.swift
@@ -29,157 +29,88 @@ import CoreData
// MARK: - CSSQLiteStore
-/**
- The `CSSQLiteStore` serves as the Objective-C bridging type for `SQLiteStore`.
-
- - SeeAlso: `SQLiteStore`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCType {
-
- /**
- Initializes an SQLite store interface from the given SQLite file URL. When this instance is passed to the `CSDataStack`'s `-addStorage*:` methods, a new SQLite file will be created if it does not exist.
-
- - Important: Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.
- - parameter fileURL: the local file URL for the target SQLite persistent store. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileURL` explicitly for each of them.
- - parameter localStorageOptions: When the `CSSQLiteStore` is passed to the `CSDataStack`'s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `CSLocalStorageOptionsNone`.
- */
+
@objc
public convenience init(fileURL: URL, configuration: ModelConfiguration, localStorageOptions: Int) {
-
- self.init(
- SQLiteStore(
- fileURL: fileURL,
- configuration: configuration,
- localStorageOptions: LocalStorageOptions(rawValue: localStorageOptions)
- )
- )
+
+ fatalError()
}
-
- /**
- Initializes an SQLite store interface from the given SQLite file name. When this instance is passed to the `CSDataStack`'s `-addStorage*:` methods, a new SQLite file will be created if it does not exist.
-
- - Important: Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.
- - parameter fileName: the local filename for the SQLite persistent store in the "Application Support/" directory (or the "Caches/" directory on tvOS). Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- - parameter configuration: an optional configuration name from the model file. If not specified, defaults to `nil`, the "Default" configuration. Note that if you have multiple configurations, you will need to specify a different `fileName` explicitly for each of them.
- - parameter localStorageOptions: When the `CSSQLiteStore` is passed to the `CSDataStack`'s `addStorage()` methods, tells the `CSDataStack` how to setup the persistent store. Defaults to `[CSLocalStorageOptions none]`.
- */
+
@objc
public convenience init(fileName: String, configuration: ModelConfiguration, localStorageOptions: Int) {
-
- self.init(
- SQLiteStore(
- fileName: fileName,
- configuration: configuration,
- localStorageOptions: LocalStorageOptions(rawValue: localStorageOptions)
- )
- )
+
+ fatalError()
}
-
- /**
- Initializes an `CSSQLiteStore` with an all-default settings: a `fileURL` pointing to a ".sqlite" file in the "Application Support/" directory (or the "Caches/" directory on tvOS), a `nil` `configuration` pertaining to the "Default" configuration, and `localStorageOptions` set to `[CSLocalStorageOptions none]`.
-
- - Important: Initializing `CSSQLiteStore`s with custom migration mapping models is currently not supported. Create an `SQLiteStore` instance from Swift code and bridge the instance to Objective-C using its `SQLiteStore.bridgeToObjectiveC` property.
- */
+
@objc
public convenience override init() {
-
- self.init(SQLiteStore())
+
+ fatalError()
}
// MAKR: CSLocalStorage
-
- /**
- The `NSURL` that points to the SQLite file
- */
+
@objc
public var fileURL: URL {
-
- return self.bridgeToSwift.fileURL as URL
+
+ fatalError()
}
-
- /**
- An array of `SchemaMappingProvider`s that provides the complete mapping models for custom migrations. This is currently only supported for Swift code.
- */
+
@objc
public var migrationMappingProviders: [Any] {
-
- return self.bridgeToSwift.migrationMappingProviders
+
+ fatalError()
}
-
- /**
- Options that tell the `CSDataStack` how to setup the persistent store
- */
+
@objc
public var localStorageOptions: Int {
-
- return self.bridgeToSwift.localStorageOptions.rawValue
+
+ fatalError()
}
// MARK: CSStorageInterface
-
- /**
- The string identifier for the `NSPersistentStore`'s `type` property. For `CSSQLiteStore`s, this is always set to `NSSQLiteStoreType`.
- */
+
@objc
public static let storeType = NSSQLiteStoreType
-
- /**
- The configuration name in the model file
- */
+
public var configuration: ModelConfiguration {
-
- return self.bridgeToSwift.configuration
+
+ fatalError()
}
-
- /**
- The options dictionary for the `NSPersistentStore`. For `CSSQLiteStore`s, this is always set to
- ```
- [NSSQLitePragmasOption: ["journal_mode": "WAL"]]
- ```
- */
+
@objc
public var storeOptions: [AnyHashable: Any]? {
-
- return self.bridgeToSwift.storeOptions
+
+ fatalError()
}
-
- /**
- Called by the `CSDataStack` to perform actual deletion of the store file from disk. Do not call directly! The `sourceModel` argument is a hint for the existing store's model version. For `CSSQLiteStore`, this converts the database's WAL journaling mode to DELETE before deleting the file.
- */
+
@objc
public func cs_eraseStorageAndWait(metadata: NSDictionary, soureModelHint: NSManagedObjectModel?, error: NSErrorPointer) -> Bool {
-
- return bridge(error) {
-
- try self.bridgeToSwift.cs_eraseStorageAndWait(metadata: metadata as! [String: Any], soureModelHint: soureModelHint)
- }
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.bridgeToSwift).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSSQLiteStore else {
-
- return false
- }
- return self.bridgeToSwift === object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -188,22 +119,21 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
public let bridgeToSwift: SQLiteStore
public required init(_ swiftValue: SQLiteStore) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - SQLiteStore
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension SQLiteStore: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSQLiteStore {
-
- return CSSQLiteStore(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSSectionBy.swift b/Sources/CSSectionBy.swift
index b7363c6..4777132 100644
--- a/Sources/CSSectionBy.swift
+++ b/Sources/CSSectionBy.swift
@@ -29,50 +29,28 @@ import CoreData
// MARK: - CSSectionBy
-/**
- The `CSSectionBy` serves as the Objective-C bridging type for `SectionBy`.
-
- - SeeAlso: `SectionBy`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSectionBy: NSObject {
-
- /**
- Initializes a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
-
- - parameter sectionKeyPath: the key path to use to group the objects into sections
- - returns: a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
- */
+
@objc
public static func keyPath(_ sectionKeyPath: KeyPathString) -> CSSectionBy {
-
- return self.init(SectionBy(sectionKeyPath))
+
+ fatalError()
}
-
- /**
- Initializes a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections, and a closure to transform the value for the key path to an appropriate section index title
-
- - parameter sectionKeyPath: the key path to use to group the objects into sections
- - parameter sectionIndexTransformer: a closure to transform the value for the key path to an appropriate section index title
- - returns: a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
- */
+
@objc
public static func keyPath(_ sectionKeyPath: KeyPathString, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> CSSectionBy {
-
- return self.init(
- SectionBy(
- sectionKeyPath,
- sectionIndexTransformer: sectionIndexTransformer
- )
- )
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -81,32 +59,21 @@ public final class CSSectionBy: NSObject {
public let bridgeToSwift: SectionBy
public init(_ swiftValue: SectionBy) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - SectionBy
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension SectionBy {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSectionBy {
-
- return CSSectionBy(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> SectionBy {
-
- return SectionBy(
- self.sectionKeyPath,
- sectionIndexTransformer: self.sectionIndexTransformer
- )
+
+ fatalError()
}
}
diff --git a/Sources/CSSelect.swift b/Sources/CSSelect.swift
index d41371f..4de397d 100644
--- a/Sources/CSSelect.swift
+++ b/Sources/CSSelect.swift
@@ -29,147 +29,63 @@ import CoreData
// MARK: - CSSelectTerm
-/**
- The `CSSelectTerm` serves as the Objective-C bridging type for `SelectTerm`.
-
- - SeeAlso: `SelectTerm`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSelectTerm: NSObject {
-
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying an entity attribute.
- ```
- NSString *fullName = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:CSSelectString(CSAttribute(@"fullname"))
- fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
- ```
- - parameter keyPath: the attribute name
- */
+
@objc
public convenience init(keyPath: KeyPathString) {
- self.init(.attribute(keyPath))
+ fatalError()
}
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying the average value of an attribute.
- ```
- NSNumber *averageAge = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect numberForTerm:[CSSelectTerm average:@"age" as:nil]]];
- ```
- - parameter keyPath: the attribute name
- - parameter `as`: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "average()" is used
- - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the average value of an attribute
- */
@objc
public static func average(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm {
-
- return self.init(.average(keyPath, as: alias))
+
+ fatalError()
}
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for a count query.
- ```
- NSNumber *numberOfEmployees = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect numberForTerm:[CSSelectTerm count:@"employeeID" as:nil]]];
- ```
- - parameter keyPath: the attribute name
- - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "count()" is used
- - returns: a `SelectTerm` to a `Select` clause for a count query
- */
@objc
public static func count(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm {
-
- return self.init(.count(keyPath, as: alias))
+
+ fatalError()
}
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying the maximum value for an attribute.
- ```
- NSNumber *maximumAge = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect numberForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
- ```
- - parameter keyPath: the attribute name
- - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "max()" is used
- - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the maximum value for an attribute
- */
@objc
public static func maximum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm {
-
- return self.init(.maximum(keyPath, as: alias))
+
+ fatalError()
}
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying the minimum value for an attribute.
- ```
- NSNumber *minimumAge = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect numberForTerm:[CSSelectTerm minimum:@"age" as:nil]]];
- ```
- - parameter keyPath: the attribute name
- - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "min()" is used
- - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the minimum value for an attribute
- */
@objc
public static func minimum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm {
-
- return self.init(.minimum(keyPath, as: alias))
+
+ fatalError()
}
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying the sum value for an attribute.
- ```
- NSNumber *totalAge = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect numberForTerm:[CSSelectTerm sum:@"age" as:nil]]];
- ```
- - parameter keyPath: the attribute name
- - parameter alias: the dictionary key to use to access the result. Ignored when the query return value is not an `NSDictionary`. If `nil`, the default key "sum()" is used
- - returns: a `CSSelectTerm` to a `CSSelect` clause for querying the sum value for an attribute
- */
@objc
public static func sum(_ keyPath: KeyPathString, as alias: KeyPathString?) -> CSSelectTerm {
-
- return self.init(.sum(keyPath, as: alias))
+
+ fatalError()
}
-
- /**
- Provides a `CSSelectTerm` to a `CSSelect` clause for querying the `NSManagedObjectID`.
- ```
- NSManagedObjectID *objectID = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect objectIDForTerm:[CSSelectTerm objectIDAs:nil]]
- fetchClauses:@[[CSWhere keyPath:@"employeeID" isEqualTo: @1111]]];
- ```
- - 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
- */
+
@objc
public static func objectIDAs(_ alias: KeyPathString? = nil) -> CSSelectTerm {
-
- return self.init(.objectID(as: alias))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSSelectTerm else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
@@ -178,344 +94,122 @@ public final class CSSelectTerm: NSObject {
public let bridgeToSwift: SelectTerm
public init(_ swiftValue: SelectTerm) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - SelectTerm
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension SelectTerm where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSelectTerm {
-
- return CSSelectTerm(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> SelectTerm {
-
- switch self {
-
- case ._attribute(let keyPath):
- return SelectTerm._attribute(keyPath)
-
- case ._aggregate(let function, let keyPath, let alias, let nativeType):
- return SelectTerm._aggregate(function: function, keyPath: keyPath, alias: alias, nativeType: nativeType)
-
- case ._identity(let alias, let nativeType):
- return SelectTerm._identity(alias: alias, nativeType: nativeType)
- }
+
+ fatalError()
}
}
// MARK: - CSSelect
-/**
- The `CSSelect` serves as the Objective-C bridging type for `Select`.
-
- - SeeAlso: `Select`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSelect: NSObject {
-
- /**
- Creates a `CSSelect` clause for querying `NSNumber` values.
- ```
- NSNumber *maxAge = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectNumber(CSAggregateMax(@"age"))
- // ...
- ```
- - parameter numberTerm: the `CSSelectTerm` specifying the attribute/aggregate value to query
- */
+
@objc
public convenience init(numberTerm: CSSelectTerm) {
-
- self.init(Select(numberTerm.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSDecimalNumber` values.
- ```
- NSDecimalNumber *averagePrice = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectDecimal(CSAggregateAverage(@"price"))
- // ...
- ```
- - parameter decimalTerm: the `CSSelectTerm` specifying the attribute/aggregate value to query
- */
+
@objc
public convenience init(decimalTerm: CSSelectTerm) {
-
- self.init(Select(decimalTerm.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSString` values.
- ```
- NSString *fullname = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectString(CSAttribute(@"fullname"))
- // ...
- ```
- - parameter stringTerm: the `CSSelectTerm` specifying the attribute/aggregate value to query
- */
+
@objc
public convenience init(stringTerm: CSSelectTerm) {
-
- self.init(Select(stringTerm.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSDate` values.
- ```
- NSDate *lastUpdate = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectDate(CSAggregateMax(@"updatedDate"))
- // ...
- ```
- - parameter dateTerm: the `CSSelectTerm` specifying the attribute/aggregate value to query
- */
+
@objc
public convenience init(dateTerm: CSSelectTerm) {
-
- self.init(Select(dateTerm.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSData` values.
- ```
- NSData *imageData = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectData(CSAttribute(@"imageData"))
- // ...
- ```
- - parameter dataTerm: the `CSSelectTerm` specifying the attribute/aggregate value to query
- */
+
@objc
public convenience init(dataTerm: CSSelectTerm) {
-
- self.init(Select(dataTerm.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSManagedObjectID` values.
- ```
- NSManagedObjectID *objectID = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectObjectID()
- // ...
- ```
- */
+
@objc
public convenience init(objectIDTerm: ()) {
-
- self.init(Select(.objectID()))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSDictionary` of an entity's attribute keys and values.
- ```
- NSDictionary *keyValues = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect dictionaryForTerm:[CSSelectTerm maximum:@"age" as:nil]]];
- ```
- - parameter term: the `CSSelectTerm` specifying the attribute/aggregate value to query
- - returns: a `CSSelect` clause for querying an entity attribute
- */
+
@objc
public static func dictionaryForTerm(_ term: CSSelectTerm) -> CSSelect {
-
- return self.init(Select(term.bridgeToSwift))
+
+ fatalError()
}
-
- /**
- Creates a `CSSelect` clause for querying `NSDictionary` of an entity's attribute keys and values.
- ```
- NSDictionary *keyValues = [CSCoreStore
- queryValueFrom:[CSFrom entityClass:[MyPersonEntity class]]
- select:[CSSelect dictionaryForTerms:@[
- [CSSelectTerm attribute:@"name" as:nil],
- [CSSelectTerm attribute:@"age" as:nil]
- ]]];
- ```
- - parameter terms: the `CSSelectTerm`s specifying the attribute/aggregate values to query
- - returns: a `CSSelect` clause for querying an entity attribute
- */
+
@objc
public static func dictionaryForTerms(_ terms: [CSSelectTerm]) -> CSSelect {
-
- return self.init(Select(terms.map { $0.bridgeToSwift }))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.attributeType.hashValue
- ^ self.selectTerms.map { $0.hashValue }.reduce(0, ^)
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSSelect else {
-
- return false
- }
- return self.attributeType == object.attributeType
- && self.selectTerms == object.selectTerms
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
// MARK: CoreStoreObjectiveCType
public init(_ swiftValue: Select) {
-
- self.attributeType = T.cs_rawAttributeType
- self.selectTerms = swiftValue.selectTerms.map({ $0.downcast() })
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
public init(_ swiftValue: Select) {
-
- self.attributeType = .undefinedAttributeType
- self.selectTerms = swiftValue.selectTerms.map({ $0.downcast() })
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
-
-
- // MARK: Internal
-
- internal let attributeType: NSAttributeType
- internal let selectTerms: [SelectTerm]
-
-
- // MARK: Internal
-
- internal func applyToFetchRequest(_ fetchRequest: NSFetchRequest) {
-
- fetchRequest.includesPendingChanges = false
- fetchRequest.resultType = .dictionaryResultType
-
- func attributeDescription(for keyPath: String, in entity: NSEntityDescription) -> NSAttributeDescription? {
-
- let components = keyPath.components(separatedBy: ".")
- switch components.count {
-
- case 0:
- return nil
-
- case 1:
- return entity.attributesByName[components[0]]
-
- default:
- guard let relationship = entity.relationshipsByName[components[0]],
- let destinationEntity = relationship.destinationEntity else {
-
- return nil
- }
- return attributeDescription(
- for: components.dropFirst().joined(separator: "."),
- in: destinationEntity
- )
- }
- }
-
- var propertiesToFetch = [Any]()
- for term in self.selectTerms {
-
- switch term {
-
- case ._attribute(let keyPath):
- propertiesToFetch.append(keyPath)
-
- case ._aggregate(let function, let keyPath, let alias, let nativeType):
- let entityDescription = fetchRequest.entity!
- if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) {
-
- let expressionDescription = NSExpressionDescription()
- expressionDescription.name = alias
- if nativeType == .undefinedAttributeType {
-
- expressionDescription.expressionResultType = attributeDescription.attributeType
- }
- else {
-
- expressionDescription.expressionResultType = nativeType
- }
- expressionDescription.expression = NSExpression(
- forFunction: function,
- arguments: [NSExpression(forKeyPath: keyPath)]
- )
- propertiesToFetch.append(expressionDescription)
- }
- else {
-
- Internals.log(
- .warning,
- message: "The key path \"\(keyPath)\" could not be resolved in entity \(Internals.typeName(entityDescription.managedObjectClassName)) as an attribute and will be ignored by \(Internals.typeName(self)) query clause."
- )
- }
-
- case ._identity(let alias, let nativeType):
- let expressionDescription = NSExpressionDescription()
- expressionDescription.name = alias
- if nativeType == .undefinedAttributeType {
-
- expressionDescription.expressionResultType = .objectIDAttributeType
- }
- else {
-
- expressionDescription.expressionResultType = nativeType
- }
- expressionDescription.expression = NSExpression.expressionForEvaluatedObject()
-
- propertiesToFetch.append(expressionDescription)
- }
- }
-
- fetchRequest.propertiesToFetch = propertiesToFetch
- }
-
-
- // MARK: Private
-
- private let bridgeToSwift: CoreStoreDebugStringConvertible
}
// MARK: - Select
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension Select where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSelect {
-
- return CSSelect(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> Select {
-
- return Select(self.selectTerms.map({ $0.downcast() }))
+
+ fatalError()
}
}
diff --git a/Sources/CSSetupResult.swift b/Sources/CSSetupResult.swift
index cf5e788..55bb63d 100644
--- a/Sources/CSSetupResult.swift
+++ b/Sources/CSSetupResult.swift
@@ -29,162 +29,83 @@ import CoreData
// MARK: - CSSetupResult
-/**
- The `CSSetupResult` serves as the Objective-C bridging type for `SetupResult`.
-
- - SeeAlso: `SetupResult`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSetupResult: NSObject {
-
- /**
- `YES` if adding the `CSStorageInterface` to the `CSDataStack` succeeded, `NO` otherwise.
- */
+
@objc
public var isSuccess: Bool {
-
- return self.storage != nil
+
+ fatalError()
}
-
- /**
- `YES` if adding the `CSStorageInterface` to the `CSDataStack` failed, `NO` otherwise. When `YES`, the `error` property returns the actual `NSError` for the failure.
- */
+
@objc
public var isFailure: Bool {
-
- return self.storage == nil
+
+ fatalError()
}
-
- /**
- A `CSStorageInterface` instance if the `commit` operation for the transaction succeeded. Returns `nil` otherwise.
- */
+
@objc
public let storage: CSStorageInterface?
-
- /**
- The `NSError` for a failed `commit` operation, or `nil` if the `commit` succeeded
- */
+
@objc
public let error: NSError?
-
- /**
- If the result was a success, the `success` block is executed with the `CSStorageInterface` instance that was added to the `CSDataStack`. If the result was a failure, the `failure` block is executed with an `NSError` argument pertaining to the actual error.
-
- The blocks are executed immediately as `@noescape` and will not be retained.
-
- - parameter success: the block to execute on success. The block passes a `CSStorageInterface` instance that was added to the `CSDataStack`.
- - parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
- */
+
@objc
public func handleSuccess(_ success: (_ storage: CSStorageInterface) -> Void, failure: (_ error: NSError) -> Void) {
-
- if let storage = self.storage {
-
- success(storage)
- }
- else {
-
- failure(self.error!)
- }
+
+ fatalError()
}
-
- /**
- If the result was a success, the `success` block is executed with a `BOOL` argument that indicates if there were any changes made. If the result was a failure, this method does nothing.
-
- The block is executed immediately as `@noescape` and will not be retained.
-
- - parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
- */
+
@objc
public func handleSuccess(_ success: (_ storage: CSStorageInterface) -> Void) {
-
- guard let storage = self.storage else {
-
- return
- }
- success(storage)
+
+ fatalError()
}
-
- /**
- If the result was a failure, the `failure` block is executed with an `NSError` argument pertaining to the actual error. If the result was a success, this method does nothing.
-
- The block is executed immediately as `@noescape` and will not be retained.
-
- - parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
- */
+
@objc
public func handleFailure(_ failure: (_ error: NSError) -> Void) {
-
- guard let error = self.error else {
-
- return
- }
- failure(error)
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- if let storage = self.storage {
-
- return self.isSuccess.hashValue ^ ObjectIdentifier(storage).hashValue
- }
- return self.isSuccess.hashValue ^ self.error!.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSSetupResult else {
-
- return false
- }
- return self.storage === object.storage
- && self.error == object.error
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
// MARK: CoreStoreObjectiveCType
public required init(_ swiftValue: SetupResult) where T: CoreStoreSwiftType, T.ObjectiveCType: CSStorageInterface {
-
- switch swiftValue {
-
- case .success(let storage):
- self.storage = storage.bridgeToObjectiveC
- self.error = nil
-
- case .failure(let error):
- self.storage = nil
- self.error = error.bridgeToObjectiveC
- }
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
-
-
- // MARK: Private
-
- private let bridgeToSwift: CoreStoreDebugStringConvertible
}
// MARK: - SetupResult
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension SetupResult where Success: StorageInterface, Success: CoreStoreSwiftType, Success.ObjectiveCType: CSStorageInterface, Failure == CoreStoreError {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSetupResult {
-
- return CSSetupResult(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSStorageInterface.swift b/Sources/CSStorageInterface.swift
index d8e0906..4a5d1c0 100644
--- a/Sources/CSStorageInterface.swift
+++ b/Sources/CSStorageInterface.swift
@@ -29,29 +29,16 @@ import CoreData
// MARK: - CSStorageInterface
-/**
- The `CSStorageInterface` serves as the Objective-C bridging type for `StorageInterface`.
-
- - SeeAlso: `StorageInterface`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSStorageInterface {
-
- /**
- The string identifier for the `NSPersistentStore`'s `type` property. This is the same string CoreStore will use to create the `NSPersistentStore` from the `NSPersistentStoreCoordinator`'s `addPersistentStoreWithType(...)` method.
- */
+
@objc
static var storeType: String { get }
-
- /**
- The configuration name in the model file
- */
+
@objc
var configuration: ModelConfiguration { get }
-
- /**
- The options dictionary for the `NSPersistentStore`
- */
+
@objc
var storeOptions: [AnyHashable: Any]? { get }
}
@@ -59,67 +46,32 @@ public protocol CSStorageInterface {
// MARK: - CSLocalStorageOptions
-/**
- The `CSLocalStorageOptions` provides settings that tells the `CSDataStack` how to setup the persistent store for `CSLocalStorage` implementers.
-
- - SeeAlso: `LocalStorageOptions`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public enum CSLocalStorageOptions: Int {
-
- /**
- Tells the `DataStack` that the store should not be migrated or recreated, and should simply fail on model mismatch
- */
+
case none = 0
-
- /**
- Tells the `DataStack` to delete and recreate the store on model mismatch, otherwise exceptions will be thrown on failure instead
- */
case recreateStoreOnModelMismatch = 1
-
- /**
- Tells the `DataStack` to prevent progressive migrations for the store
- */
case preventProgressiveMigration = 2
-
- /**
- Tells the `DataStack` to allow lightweight migration for the store when added synchronously
- */
case allowSynchronousLightweightMigration = 4
}
// MARK: - CSLocalStorage
-/**
- The `CSLocalStorage` serves as the Objective-C bridging type for `LocalStorage`.
-
- - SeeAlso: `LocalStorage`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public protocol CSLocalStorage: CSStorageInterface {
-
- /**
- The `NSURL` that points to the store file
- */
+
@objc
var fileURL: URL { get }
-
- /**
- An array of `SchemaMappingProvider`s that provides the complete mapping models for custom migrations. This is currently only supported for Swift code.
- */
+
@objc
var migrationMappingProviders: [Any] { get }
-
- /**
- Options that tell the `CSDataStack` how to setup the persistent store
- */
+
@objc
var localStorageOptions: Int { get }
- /**
- Called by the `CSDataStack` to perform actual deletion of the store file from disk. Do not call directly! The `sourceModel` argument is a hint for the existing store's model version. Implementers can use the `sourceModel` to perform necessary store operations. (SQLite stores for example, can convert WAL journaling mode to DELETE before deleting)
- */
@objc
func cs_eraseStorageAndWait(metadata: NSDictionary, soureModelHint: NSManagedObjectModel?, error: NSErrorPointer) -> Bool
}
diff --git a/Sources/CSSynchronousDataTransaction.swift b/Sources/CSSynchronousDataTransaction.swift
index aef28cd..a60e155 100644
--- a/Sources/CSSynchronousDataTransaction.swift
+++ b/Sources/CSSynchronousDataTransaction.swift
@@ -29,100 +29,54 @@ import CoreData
// MARK: - CSSynchronousDataTransaction
-/**
- The `CSSynchronousDataTransaction` serves as the Objective-C bridging type for `SynchronousDataTransaction`.
-
- - SeeAlso: `SynchronousDataTransaction`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSSynchronousDataTransaction: CSBaseDataTransaction, CoreStoreObjectiveCType {
-
- /**
- Saves the transaction changes and waits for completion synchronously. This method should not be used after the `-commitAndWaitWithError:` method was already called once.
-
- - parameter error: the `CSError` pointer that indicates the reason in case of an failure
- - returns: `YES` if the commit succeeded, `NO` if the commit failed. If `NO`, the `error` argument will hold error information.
- */
+
@objc
public func commitAndWait(error: NSErrorPointer) -> Bool {
-
- return bridge(error) {
-
- if case (_, let error?) = self.bridgeToSwift.context.saveSynchronously(waitForMerge: true) {
-
- throw error
- }
- }
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
// MARK: BaseDataTransaction
-
- /**
- Creates a new `NSManagedObject` with the specified entity type.
-
- - parameter into: the `CSInto` clause indicating the destination `NSManagedObject` entity type and the destination configuration
- - returns: a new `NSManagedObject` instance of the specified entity type.
- */
+
@objc
public override func createInto(_ into: CSInto) -> Any {
-
- return self.bridgeToSwift.create(into.bridgeToSwift)
+
+ fatalError()
}
-
- /**
- Returns an editable proxy of a specified `NSManagedObject`. This method should not be used after the `-commitAndWait` method was already called once.
-
- - parameter object: the `NSManagedObject` type to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
+
@objc
public override func editObject(_ object: NSManagedObject?) -> Any? {
-
- return self.bridgeToSwift.edit(object)
+
+ fatalError()
}
-
- /**
- Returns an editable proxy of the object with the specified `NSManagedObjectID`. This method should not be used after the `-commitAndWait` method was already called once.
-
- - parameter into: a `CSInto` clause specifying the entity type
- - parameter objectID: the `NSManagedObjectID` for the object to be edited
- - returns: an editable proxy for the specified `NSManagedObject`.
- */
+
@objc
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
-
- return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
+
+ fatalError()
}
-
- /**
- Deletes a specified `NSManagedObject`. This method should not be used after the `-commitAndWait` method was already called once.
-
- - parameter object: the `NSManagedObject` type to be deleted
- */
+
@objc
public override func deleteObject(_ object: NSManagedObject?) {
-
- return self.bridgeToSwift.delete(object)
+
+ fatalError()
}
-
- /**
- Deletes the specified `NSManagedObject`s.
-
- - parameter objects: the `NSManagedObject`s to be deleted
- */
+
public override func deleteObjects(_ objects: [NSManagedObject]) {
-
- self.bridgeToSwift.delete(objects)
+
+ fatalError()
}
@@ -131,31 +85,26 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction, CoreStor
public typealias SwiftType = SynchronousDataTransaction
public var bridgeToSwift: SynchronousDataTransaction {
-
- return super.swiftTransaction as! SynchronousDataTransaction
+
+ fatalError()
}
public required init(_ swiftValue: SynchronousDataTransaction) {
-
- super.init(swiftValue as BaseDataTransaction)
- }
-
- public required override init(_ swiftValue: BaseDataTransaction) {
-
- super.init(swiftValue)
+
+ fatalError()
}
}
// MARK: - SynchronousDataTransaction
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension SynchronousDataTransaction: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSSynchronousDataTransaction {
-
- return CSSynchronousDataTransaction(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSTweak.swift b/Sources/CSTweak.swift
index a852780..4badf1d 100644
--- a/Sources/CSTweak.swift
+++ b/Sources/CSTweak.swift
@@ -29,42 +29,28 @@ import CoreData
// MARK: - CSTweak
-/**
- The `CSTweak` serves as the Objective-C bridging type for `Tweak`.
-
- - SeeAlso: `Tweak`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause, CoreStoreObjectiveCType {
- /**
- The block to customize the `NSFetchRequest`
- */
@objc
public var block: (_ fetchRequest: NSFetchRequest) -> Void {
-
- return self.bridgeToSwift.closure
+
+ fatalError()
}
-
- /**
- Initializes a `CSTweak` clause with a closure where the `NSFetchRequest` may be configured.
-
- - Important: `CSTweak`'s closure is executed only just before the fetch occurs, so make sure that any values captured by the closure is not prone to race conditions. Also, some utilities (such as `CSListMonitor`s) may keep `CSFetchClause`s in memory and may thus introduce retain cycles if reference captures are not handled properly.
- - parameter block: the block to customize the `NSFetchRequest`
- */
+
@objc
public convenience init(block: @escaping (_ fetchRequest: NSFetchRequest) -> Void) {
-
- self.init(Tweak(block))
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -72,8 +58,8 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
@objc
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) {
-
- self.bridgeToSwift.applyToFetchRequest(fetchRequest)
+
+ fatalError()
}
@@ -82,22 +68,21 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
public let bridgeToSwift: Tweak
public init(_ swiftValue: Tweak) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - Tweak
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension Tweak: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSTweak {
-
- return CSTweak(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSUnsafeDataModelSchema.swift b/Sources/CSUnsafeDataModelSchema.swift
index f0a3a39..3be207a 100644
--- a/Sources/CSUnsafeDataModelSchema.swift
+++ b/Sources/CSUnsafeDataModelSchema.swift
@@ -29,50 +29,32 @@ import Foundation
// MARK: - CSUnsafeDataModelSchema
-/**
- The `CSUnsafeDataModelSchema` serves as the Objective-C bridging type for `UnsafeDataModelSchema`.
-
- - SeeAlso: `UnsafeDataModelSchema`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSUnsafeDataModelSchema: NSObject, CSDynamicSchema, CoreStoreObjectiveCType {
- /**
- Initializes a `CSUnsafeDataModelSchema` from an `NSManagedObjectModel`.
-
- - parameter modelName: the model version, typically the file name of an *.xcdatamodeld file (without the file extension)
- - parameter model: the `NSManagedObjectModel`
- */
@objc
public required init(modelName: ModelVersion, model: NSManagedObjectModel) {
-
- self.bridgeToSwift = UnsafeDataModelSchema(
- modelName: modelName,
- model: model
- )
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.bridgeToSwift).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSUnsafeDataModelSchema else {
-
- return false
- }
- return self.bridgeToSwift === object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -80,14 +62,14 @@ public final class CSUnsafeDataModelSchema: NSObject, CSDynamicSchema, CoreStore
@objc
public var modelVersion: ModelVersion {
-
- return self.bridgeToSwift.modelVersion
+
+ fatalError()
}
@objc
public func rawModel() -> NSManagedObjectModel {
-
- return self.bridgeToSwift.rawModel()
+
+ fatalError()
}
@@ -96,22 +78,21 @@ public final class CSUnsafeDataModelSchema: NSObject, CSDynamicSchema, CoreStore
public let bridgeToSwift: UnsafeDataModelSchema
public required init(_ swiftValue: UnsafeDataModelSchema) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - UnsafeDataModelSchema
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension UnsafeDataModelSchema: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSUnsafeDataModelSchema {
-
- return CSUnsafeDataModelSchema(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSUnsafeDataTransaction.swift b/Sources/CSUnsafeDataTransaction.swift
index 236d7d2..524af7f 100644
--- a/Sources/CSUnsafeDataTransaction.swift
+++ b/Sources/CSUnsafeDataTransaction.swift
@@ -29,160 +29,76 @@ import CoreData
// MARK: - CSUnsafeDataTransaction
-/**
- The `CSUnsafeDataTransaction` serves as the Objective-C bridging type for `UnsafeDataTransaction`.
-
- - SeeAlso: `UnsafeDataTransaction`
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSUnsafeDataTransaction: CSBaseDataTransaction, CoreStoreObjectiveCType {
- /**
- Saves the transaction changes asynchronously. For a `CSUnsafeDataTransaction`, multiple commits are allowed, although it is the developer's responsibility to ensure a reasonable leeway to prevent blocking the main thread.
-
- - parameter success: the block executed if the save succeeds.
- - parameter failure: the block executed if the save fails. A `CSError` is reported as the argument of the block.
- */
+
@objc
public func commitWithSuccess(_ success: (() -> Void)?, _ failure: ((CSError) -> Void)?) {
-
- self.bridgeToSwift.context.saveAsynchronouslyWithCompletion { (_, error) in
-
- defer {
-
- withExtendedLifetime(self, {})
- }
- if let error = error {
-
- failure?(error.bridgeToObjectiveC)
- }
- else {
-
- success?()
- }
- }
+
+ fatalError()
}
-
- /**
- Saves the transaction changes and waits for completion synchronously. For a `CSUnsafeDataTransaction`, multiple commits are allowed, although it is the developer's responsibility to ensure a reasonable leeway to prevent blocking the main thread.
-
- - parameter error: the `CSError` pointer that indicates the reason in case of an failure
- - returns: `YES` if the commit succeeded, `NO` if the commit failed. If `NO`, the `error` argument will hold error information.
- */
+
@objc
public func commitAndWait(error: NSErrorPointer) -> Bool {
-
- return bridge(error) {
-
- if case (_, let error?) = self.bridgeToSwift.context.saveSynchronously(waitForMerge: true) {
-
- throw error
- }
- }
+
+ fatalError()
}
-
- /**
- Rolls back the transaction.
- */
+
@objc
public func rollback() {
-
- self.bridgeToSwift.rollback()
+
+ fatalError()
}
-
- /**
- Undo's the last change made to the transaction.
- */
+
@objc
public func undo() {
-
- self.bridgeToSwift.undo()
+
+ fatalError()
}
-
- /**
- Redo's the last undone change to the transaction.
- */
+
@objc
public func redo() {
-
- self.bridgeToSwift.redo()
+
+ fatalError()
}
-
- /**
- Immediately flushes all pending changes to the transaction's observers. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
-
- - Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
- */
+
@objc
public func flush() {
-
- self.bridgeToSwift.flush()
+
+ fatalError()
}
-
- /**
- Flushes all pending changes to the transaction's observers at the end of the `closure`'s execution. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
-
- - Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
- - parameter block: the block where changes can be made prior to the flush
- */
+
@objc
public func flush(_ block: () -> Void) {
-
- self.bridgeToSwift.flush {
-
- block()
- }
+
+ fatalError()
}
-
- /**
- Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
-
- To support "undo" methods such as `-undo`, `-redo`, and `-rollback`, use the `-beginSafeWithSupportsUndo:` method passing `YES` to the argument. Without "undo" support, calling those methods will raise an exception.
- - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
- */
+
@objc
public func beginUnsafe() -> CSUnsafeDataTransaction {
-
- return bridge {
-
- self.bridgeToSwift.beginUnsafe()
- }
+
+ fatalError()
}
-
- /**
- Begins a child transaction where `NSManagedObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
-
- - prameter supportsUndo: `-undo`, `-redo`, and `-rollback` methods are only available when this parameter is `YES`, otherwise those method will raise an exception. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
- - returns: a `CSUnsafeDataTransaction` instance where creates, updates, and deletes can be made.
- */
+
@objc
public func beginUnsafeWithSupportsUndo(_ supportsUndo: Bool) -> CSUnsafeDataTransaction {
-
- return bridge {
-
- self.bridgeToSwift.beginUnsafe(supportsUndo: supportsUndo)
- }
+
+ fatalError()
}
-
- /**
- Returns the `NSManagedObjectContext` for this unsafe transaction. Use only for cases where external frameworks need an `NSManagedObjectContext` instance to work with.
-
- Note that it is the developer's responsibility to ensure the following:
- - that the `CSUnsafeDataTransaction` that owns this context should be strongly referenced and prevented from being deallocated during the context's lifetime
- - that all saves will be done either through the `CSUnsafeDataTransaction`'s `-commit:` or `-commitAndWait` method, or by calling `-save:` manually on the context, its parent, and all other ancestor contexts if there are any.
- */
+
@objc
public func unsafeContext() -> NSManagedObjectContext {
-
- return self.bridgeToSwift.context
+
+ fatalError()
}
// MARK: NSObject
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -191,31 +107,26 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction, CoreStoreObje
public typealias SwiftType = UnsafeDataTransaction
public var bridgeToSwift: UnsafeDataTransaction {
-
- return super.swiftTransaction as! UnsafeDataTransaction
+
+ fatalError()
}
public required init(_ swiftValue: UnsafeDataTransaction) {
-
- super.init(swiftValue as BaseDataTransaction)
- }
-
- public required override init(_ swiftValue: BaseDataTransaction) {
-
- super.init(swiftValue)
+
+ fatalError()
}
}
// MARK: - UnsafeDataTransaction
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension UnsafeDataTransaction: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSUnsafeDataTransaction {
-
- return CSUnsafeDataTransaction(self)
+
+ fatalError()
}
}
diff --git a/Sources/CSWhere.swift b/Sources/CSWhere.swift
index b77aeeb..f916ab4 100644
--- a/Sources/CSWhere.swift
+++ b/Sources/CSWhere.swift
@@ -29,112 +29,62 @@ import CoreData
// MARK: - CSWhere
-/**
- The `CSWhere` serves as the Objective-C bridging type for `Where`.
-
- - SeeAlso: `Where`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClause {
- /**
- The internal `NSPredicate` instance for the `Where` clause
- */
@objc
public var predicate: NSPredicate {
-
- return self.bridgeToSwift.predicate
+
+ fatalError()
}
- /**
- Initializes a `CSWhere` clause with a predicate that always evaluates to the specified boolean value
- ```
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSWhereValue(YES)]]];
- ```
- - parameter value: the boolean value for the predicate
- */
@objc
public convenience init(value: Bool) {
-
- self.init(Where(value))
+
+ fatalError()
}
-
- /**
- Initializes a `CSWhere` clause with a predicate using the specified string format and arguments
- ```
- NSPredicate *predicate = // ...
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSWherePredicate(predicate)]];
- ```
- - parameter format: the format string for the predicate
- - parameter argumentArray: the arguments for `format`
- */
+
@objc
public convenience init(format: String, argumentArray: [NSObject]?) {
-
- self.init(Where(format, argumentArray: argumentArray))
+
+ fatalError()
}
-
- /**
- Initializes a `CSWhere` clause that compares equality
-
- - parameter keyPath: the keyPath to compare with
- - parameter value: the arguments for the `==` operator
- */
+
@objc
public convenience init(keyPath: KeyPathString, isEqualTo value: CoreDataNativeType?) {
-
- self.init(value == nil || value is NSNull
- ? Where("\(keyPath) == nil")
- : Where("\(keyPath) == %@", value!))
+
+ fatalError()
}
-
- /**
- Initializes a `CSWhere` clause that compares membership
-
- - parameter keyPath: the keyPath to compare with
- - parameter list: the array to check membership of
- */
+
@objc
public convenience init(keyPath: KeyPathString, isMemberOf list: [CoreDataNativeType]) {
-
- self.init(Where("\(keyPath) IN %@", list as NSArray))
+
+ fatalError()
}
-
- /**
- Initializes a `CSWhere` clause with an `NSPredicate`
-
- - parameter predicate: the `NSPredicate` for the fetch or query
- */
+
@objc
public convenience init(predicate: NSPredicate) {
-
- self.init(Where(predicate))
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return self.bridgeToSwift.hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSWhere else {
-
- return false
- }
- return self.bridgeToSwift == object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -142,8 +92,8 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
@objc
public func applyToFetchRequest(_ fetchRequest: NSFetchRequest) {
-
- self.bridgeToSwift.applyToFetchRequest(fetchRequest)
+
+ fatalError()
}
@@ -152,29 +102,21 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
public let bridgeToSwift: Where
public init(_ swiftValue: Where) {
-
- self.bridgeToSwift = swiftValue.downcast()
- super.init()
+
+ fatalError()
}
}
// MARK: - Where
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension Where where O: NSManagedObject {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSWhere {
-
- return CSWhere(self)
- }
-
-
- // MARK: FilePrivate
-
- fileprivate func downcast() -> Where {
-
- return Where(self.predicate)
+
+ fatalError()
}
}
diff --git a/Sources/CSXcodeDataModelSchema.swift b/Sources/CSXcodeDataModelSchema.swift
index 8b4f428..a6318c7 100644
--- a/Sources/CSXcodeDataModelSchema.swift
+++ b/Sources/CSXcodeDataModelSchema.swift
@@ -29,50 +29,32 @@ import Foundation
// MARK: - CSXcodeDataModelSchema
-/**
- The `CSXcodeDataModelSchema` serves as the Objective-C bridging type for `XcodeDataModelSchema`.
-
- - SeeAlso: `XcodeDataModelSchema`
- */
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
@objc
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
public final class CSXcodeDataModelSchema: NSObject, CSDynamicSchema, CoreStoreObjectiveCType {
- /**
- Initializes an `CSXcodeDataModelSchema` from an *.xcdatamodeld file URL.
-
- - parameter modelName: the model version, typically the file name of an *.xcdatamodeld file (without the file extension)
- - parameter modelVersionFileURL: the file URL that points to the .xcdatamodeld's "momd" file.
- */
@objc
public required init(modelName: ModelVersion, modelVersionFileURL: URL) {
-
- self.bridgeToSwift = XcodeDataModelSchema(
- modelName: modelName,
- modelVersionFileURL: modelVersionFileURL
- )
+
+ fatalError()
}
// MARK: NSObject
public override var hash: Int {
-
- return ObjectIdentifier(self.bridgeToSwift).hashValue
+
+ fatalError()
}
public override func isEqual(_ object: Any?) -> Bool {
-
- guard let object = object as? CSXcodeDataModelSchema else {
-
- return false
- }
- return self.bridgeToSwift === object.bridgeToSwift
+
+ fatalError()
}
public override var description: String {
-
- return "(\(String(reflecting: Self.self))) \(self.bridgeToSwift.coreStoreDumpString)"
+
+ fatalError()
}
@@ -80,14 +62,14 @@ public final class CSXcodeDataModelSchema: NSObject, CSDynamicSchema, CoreStoreO
@objc
public var modelVersion: ModelVersion {
-
- return self.bridgeToSwift.modelVersion
+
+ fatalError()
}
@objc
public func rawModel() -> NSManagedObjectModel {
-
- return self.bridgeToSwift.rawModel()
+
+ fatalError()
}
@@ -96,22 +78,21 @@ public final class CSXcodeDataModelSchema: NSObject, CSDynamicSchema, CoreStoreO
public let bridgeToSwift: XcodeDataModelSchema
public required init(_ swiftValue: XcodeDataModelSchema) {
-
- self.bridgeToSwift = swiftValue
- super.init()
+
+ fatalError()
}
}
// MARK: - XcodeDataModelSchema
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
extension XcodeDataModelSchema: CoreStoreSwiftType {
// MARK: CoreStoreSwiftType
public var bridgeToObjectiveC: CSXcodeDataModelSchema {
-
- return CSXcodeDataModelSchema(self)
+
+ fatalError()
}
}
diff --git a/Sources/CoreStoreBridge.h b/Sources/CoreStoreBridge.h
index e7a4715..c67d4e5 100644
--- a/Sources/CoreStoreBridge.h
+++ b/Sources/CoreStoreBridge.h
@@ -37,7 +37,7 @@
#error CoreStore Objective-C utilities can only be used on platforms that support C function overloading
#endif
-#define CORESTORE_EXTERN extern __deprecated_msg("CoreStore Objective-C API will be removed soon.")
+#define CORESTORE_EXTERN extern __deprecated_msg("CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
#define CORESTORE_OVERLOADABLE __attribute__((__overloadable__))
#define CORESTORE_REQUIRES_NIL_TERMINATION __attribute__((sentinel(0, 1)))
#define CORESTORE_RETURNS_RETAINED __attribute__((ns_returns_retained))
@@ -46,12 +46,14 @@
#pragma mark - KeyPathString Utilities
#define CSKeyPath(type, property) ({ \
+ CORESTORE_OBJC_OBSOLETE; \
type *_je_keypath_dummy __attribute__((unused)); \
typeof(_je_keypath_dummy.property) _je_keypath_dummy_property __attribute__((unused)); \
@#property; \
})
#define CSKeyPathOperator(operator, type, property) ({ \
+ CORESTORE_OBJC_OBSOLETE; \
type *_je_keypath_dummy __attribute__((unused)); \
typeof(_je_keypath_dummy.property) _je_keypath_dummy_property __attribute__((unused)); \
@"@" #operator "." #property; \
@@ -65,85 +67,19 @@
@class CSFrom;
-/**
- @abstract
- Initializes a CSFrom clause with the specified entity class.
-
- @code
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class])];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @result
- a CSFrom clause with the specified entity class
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSFrom clause with the specified configuration.
-
- @code
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class], @"Configuration1")];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @param configuration
- an 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.
-
- @result
- a CSFrom clause with the specified configuration
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSNull *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSFrom clause with the specified configuration.
-
- @code
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class], @"Configuration1")];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @param configuration
- an 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.
-
- @result
- a CSFrom clause with the specified configuration
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSFrom clause with the specified configurations.
-
- @code
- MyPersonEntity *people = [transaction fetchAllFrom:
- CSFromClass([MyPersonEntity class],
- @[[NSNull null], @"Configuration1"])];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @param 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.
-
- @result
- a CSFrom clause with the specified configurations
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray *_Nonnull configurations) CORESTORE_RETURNS_RETAINED;
@@ -152,42 +88,15 @@ CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray *_Nonnull c
@class CSGroupBy;
-/**
- @abstract
- Initializes a CSGroupBy clause with a key path string
-
- @param keyPath
- a key path string to group results with
-
- @result
- a CSGroupBy clause with a key path string
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSGroupBy *_Nonnull CSGroupByKeyPath(NSString *_Nonnull keyPath) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSGroupBy clause with a list of key path strings
-
- @param keyPath
- a nil-terminated list of key path strings to group results with
-
- @result
- a CSGroupBy clause with a list of key path strings
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSString *_Nonnull keyPath, ...) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSGroupBy clause with a list of key path strings
-
- @param keyPaths
- a list of key path strings to group results with
-
- @result
- a CSGroupBy clause with a list of key path strings
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray *_Nonnull keyPaths) CORESTORE_RETURNS_RETAINED;
@@ -196,63 +105,15 @@ CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray *_Nonnull keyPaths) CO
@class CSInto;
-/**
- @abstract
- Initializes a CSInto clause with the specified entity class.
-
- @code
- MyPersonEntity *people = [transaction createInto:
- CSIntoClass([MyPersonEntity class])];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @result
- a CSInto clause with the specified entity class
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSInto clause with the specified entity class.
-
- @code
- MyPersonEntity *people = [transaction createInto:
- CSIntoClass([MyPersonEntity class], [NSNull null])];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @param configuration
- an 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.
-
- @result
- a CSInto clause with the specified entity class
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSNull *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSInto clause with the specified entity class.
-
- @code
- MyPersonEntity *people = [transaction createInto:
- CSIntoClass([MyPersonEntity class], @"Configuration1")];
- @endcode
-
- @param entityClass
- the NSManagedObject class type to be created
-
- @param configuration
- an 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.
-
- @result
- a CSInto clause with the specified entity class
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
@@ -261,98 +122,23 @@ CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull conf
@class CSOrderBy;
-/**
- @abstract
- Syntax sugar for initializing an ascending NSSortDescriptor for use with CSOrderBy
-
- @code
- MyPersonEntity *people = [CSCoreStore
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]];
- @endcode
-
- @param key
- the attribute key to sort with
-
- @result
- an NSSortDescriptor for use with CSOrderBy
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
NSSortDescriptor *_Nonnull CSSortAscending(NSString *_Nonnull key) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Syntax sugar for initializing a descending NSSortDescriptor for use with CSOrderBy
-
- @code
- MyPersonEntity *people = [CSCoreStore
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKey(CSSortDescending(@"fullname"))]]];
- @endcode
-
- @param key
- the attribute key to sort with
-
- @result
- an NSSortDescriptor for use with CSOrderBy
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
NSSortDescriptor *_Nonnull CSSortDescending(NSString *_Nonnull key) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSOrderBy clause with a single sort descriptor
-
- @code
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKey(CSSortAscending(@"fullname"))]]];
- @endcode
-
- @param sortDescriptor
- an NSSortDescriptor
-
- @result
- a CSOrderBy clause with a single sort descriptor
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSOrderBy *_Nonnull CSOrderByKey(NSSortDescriptor *_Nonnull sortDescriptor) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSOrderBy clause with a list of sort descriptors
-
- @code
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKeys(CSSortAscending(@"fullname"), CSSortDescending(@"age"), nil))]]];
- @endcode
-
- @param sortDescriptor
- a nil-terminated array of NSSortDescriptors
-
- @result
- a CSOrderBy clause with a list of sort descriptors
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSOrderBy *_Nonnull CSOrderByKeys(NSSortDescriptor *_Nonnull sortDescriptor, ...) CORESTORE_RETURNS_RETAINED CORESTORE_REQUIRES_NIL_TERMINATION;
-/**
- @abstract
- Initializes a CSOrderBy clause with a list of sort descriptors
-
- @code
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSOrderByKeys(@[CSSortAscending(@"fullname"), CSSortDescending(@"age")]))]]];
- @endcode
-
- @param sortDescriptors
- an array of NSSortDescriptors
-
- @result
- a CSOrderBy clause with a list of sort descriptors
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSOrderBy *_Nonnull CSOrderByKeys(NSArray *_Nonnull sortDescriptors) CORESTORE_RETURNS_RETAINED;
@@ -362,120 +148,27 @@ CSOrderBy *_Nonnull CSOrderByKeys(NSArray *_Nonnull sortDesc
@class CSSelect;
@class CSSelectTerm;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSNumber value
-
- @code
- NSNumber *maxAge = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectNumber(CSAggregateMax(@"age"))
- // ...
- @endcode
-
- @param selectTerm
- the CSSelectTerm specifying the attribute/aggregate value to query
-
- @result
- a CSSelect clause for querying an NSNumber value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectNumber(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSDecimalNumber value
-
- @code
- NSDecimalNumber *averagePrice = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectDecimal(CSAggregateAverage(@"price"))
- // ...
- @endcode
-
- @param selectTerm
- the CSSelectTerm specifying the attribute/aggregate value to query
-
- @result
- a CSSelect clause for querying an NSDecimalNumber value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectDecimal(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSString value
-
- @code
- NSString *fullname = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectString(CSAttribute(@"fullname"))
- // ...
- @endcode
-
- @param selectTerm
- the CSSelectTerm specifying the attribute/aggregate value to query
-
- @result
- a CSSelect clause for querying an NSString value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectString(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSDate value
-
- @code
- NSDate *lastUpdate = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectDate(CSAggregateMax(@"updatedDate"))
- // ...
- @endcode
-
- @param selectTerm
- the CSSelectTerm specifying the attribute/aggregate value to query
-
- @result
- a CSSelect clause for querying an NSDate value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectDate(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSData value
-
- @code
- NSData *imageData = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectData(CSAttribute(@"imageData"))
- // ...
- @endcode
-
- @param selectTerm
- the CSSelectTerm specifying the attribute/aggregate value to query
-
- @result
- a CSSelect clause for querying an NSData value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectData(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Creates a CSSelect clause for querying an NSManagedObjectID value
-
- @code
- NSManagedObjectID *objectID = [CSCoreStore
- queryValueFrom:CSFromClass([MyPersonEntity class])
- select:CSSelectObjectID()
- // ...
- @endcode
-
- @result
- a CSSelect clause for querying an NSManagedObjectID value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSSelect *_Nonnull CSSelectObjectID(void) CORESTORE_RETURNS_RETAINED;
@@ -484,19 +177,7 @@ CSSelect *_Nonnull CSSelectObjectID(void) CORESTORE_RETURNS_RETAINED;
@class CSTweak;
-/**
- @abstract
- Initializes a CSTweak clause with a block where the NSFetchRequest may be configured.
-
- @important
- CSTweak's closure is executed only just before the fetch occurs, so make sure that any values captured by the closure is not prone to race conditions. Also, some utilities (such as CSListMonitors) may keep CSFetchClauses in memory and may thus introduce retain cycles if reference captures are not handled properly.
-
- @param block
- the block to customize the NSFetchRequest
-
- @result
- a CSTweak clause with the NSFetchRequest configuration block
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN CORESTORE_OVERLOADABLE
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED;
@@ -505,61 +186,15 @@ CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull
@class CSWhere;
-/**
- @abstract
- Initializes a CSWhere clause with a predicate that always evaluates to the specified boolean value
-
- @code
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSWhereValue(YES)]];
- @endcode
-
- @param value
- the boolean value for the predicate
-
- @result
- a CSWhere clause with a predicate that always evaluates to the specified boolean value
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSWhere *_Nonnull CSWhereValue(BOOL value) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSWhere clause with a predicate using the specified string format and arguments
-
- @code
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSWhereFormat(@"%K == %@", @"key", @"value")]];
- @endcode
-
- @param format
- the format string for the predicate, followed by an optional comma-separated argument list
-
- @result
- a CSWhere clause with a predicate using the specified string format and arguments
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSWhere *_Nonnull CSWhereFormat(NSString *_Nonnull format, ...) CORESTORE_RETURNS_RETAINED;
-/**
- @abstract
- Initializes a CSWhere clause with an NSPredicate
-
- @code
- NSPredicate *predicate = // ...
- MyPersonEntity *people = [transaction
- fetchAllFrom:CSFromClass([MyPersonEntity class])
- fetchClauses:@[CSWherePredicate(predicate)]];
- @endcode
-
- @param predicate
- the NSPredicate for the fetch or query
-
- @result
- a CSWhere clause with an NSPredicate
- */
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_EXTERN
CSWhere *_Nonnull CSWherePredicate(NSPredicate *_Nonnull predicate) CORESTORE_RETURNS_RETAINED;
diff --git a/Sources/CoreStoreBridge.m b/Sources/CoreStoreBridge.m
index 3254b86..52ce1a2 100644
--- a/Sources/CoreStoreBridge.m
+++ b/Sources/CoreStoreBridge.m
@@ -33,81 +33,79 @@
#pragma mark CSFrom
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
-
- return [[CSFrom alloc] initWithEntityClass:entityClass];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSNull *_Nonnull configuration) CORESTORE_RETURNS_RETAINED {
-
- return [[CSFrom alloc] initWithEntityClass:entityClass configuration:configuration];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED {
-
- return [[CSFrom alloc] initWithEntityClass:entityClass configuration:configuration];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray *_Nonnull configurations) CORESTORE_RETURNS_RETAINED {
-
- return [[CSFrom alloc] initWithEntityClass:entityClass configurations:configurations];
+
+ abort();
}
#pragma mark CSGroupBy
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSGroupBy *_Nonnull CSGroupByKeyPath(NSString *_Nonnull keyPath) CORESTORE_RETURNS_RETAINED {
-
- return [[CSGroupBy alloc] initWithKeyPath:keyPath];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSString *_Nonnull keyPath, ...) CORESTORE_RETURNS_RETAINED {
-
- va_list args;
- va_start(args, keyPath);
-
- NSMutableArray *keyPaths = [NSMutableArray new];
- [keyPaths addObject:keyPath];
-
- NSString *next;
- while ((next = va_arg(args, NSString *)) != nil) {
-
- [keyPaths addObject:next];
- }
- va_end(args);
- return [[CSGroupBy alloc] initWithKeyPaths:keyPaths];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray *_Nonnull keyPaths) CORESTORE_RETURNS_RETAINED {
-
- return [[CSGroupBy alloc] initWithKeyPaths:keyPaths];
+
+ abort();
}
#pragma mark CSInto
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
-
- return [[CSInto alloc] initWithEntityClass:entityClass];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSNull *_Nonnull configuration) CORESTORE_RETURNS_RETAINED {
-
- return [[CSInto alloc] initWithEntityClass:entityClass configuration:nil];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED {
-
- return [[CSInto alloc] initWithEntityClass:entityClass configuration:configuration];
+
+ abort();
}
@@ -115,106 +113,104 @@ CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull conf
@class CSOrderBy;
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
NSSortDescriptor *_Nonnull CSSortAscending(NSString *_Nonnull key) {
-
- return [[NSSortDescriptor alloc] initWithKey:key ascending:YES];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
NSSortDescriptor *_Nonnull CSSortDescending(NSString *_Nonnull key) {
-
- return [[NSSortDescriptor alloc] initWithKey:key ascending:NO];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSOrderBy *_Nonnull CSOrderByKey(NSSortDescriptor *_Nonnull sortDescriptor) CORESTORE_RETURNS_RETAINED {
-
- return [[CSOrderBy alloc] initWithSortDescriptor:sortDescriptor];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSOrderBy *_Nonnull CSOrderByKeys(NSSortDescriptor *_Nonnull sortDescriptor, ...) CORESTORE_RETURNS_RETAINED {
-
- va_list args;
- va_start(args, sortDescriptor);
-
- NSMutableArray *sortDescriptors = [NSMutableArray new];
- [sortDescriptors addObject:sortDescriptor];
-
- NSSortDescriptor *next;
- while ((next = va_arg(args, NSSortDescriptor *)) != nil) {
-
- [sortDescriptors addObject:next];
- }
- va_end(args);
- return [[CSOrderBy alloc] initWithSortDescriptors:sortDescriptors];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSOrderBy *_Nonnull CSOrderByKeys(NSArray *_Nonnull sortDescriptors) CORESTORE_RETURNS_RETAINED {
-
- return [[CSOrderBy alloc] initWithSortDescriptors:sortDescriptors];
+
+ abort();
}
#pragma mark CSSelect
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectNumber(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithNumberTerm:selectTerm];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectDecimal(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithDecimalTerm:selectTerm];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectString(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithStringTerm:selectTerm];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectDate(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithDateTerm:selectTerm];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectData(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithDataTerm:selectTerm];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSSelect *_Nonnull CSSelectObjectID() CORESTORE_RETURNS_RETAINED {
-
- return [[CSSelect alloc] initWithObjectIDTerm];
+
+ abort();
}
#pragma mark CSTweak
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CORESTORE_OVERLOADABLE
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED {
-
- return [[CSTweak alloc] initWithBlock:block];
+
+ abort();
}
#pragma mark CSWhere
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSWhere *_Nonnull CSWhereValue(BOOL value) CORESTORE_RETURNS_RETAINED {
-
- return [[CSWhere alloc] initWithValue:value];
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSWhere *_Nonnull CSWhereFormat(NSString *_Nonnull format, ...) CORESTORE_RETURNS_RETAINED {
-
- CSWhere *where;
- va_list args;
- va_start(args, format);
- where = [[CSWhere alloc] initWithPredicate:[NSPredicate predicateWithFormat:format arguments:args]];
- va_end(args);
- return where;
+
+ abort();
}
+NS_UNAVAILABLE // CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.
CSWhere *_Nonnull CSWherePredicate(NSPredicate *_Nonnull predicate) CORESTORE_RETURNS_RETAINED {
-
- return [[CSWhere alloc] initWithPredicate:predicate];
+
+ abort();
}
diff --git a/Sources/CoreStoreBridge.swift b/Sources/CoreStoreBridge.swift
index b2c1dfc..13ff99c 100644
--- a/Sources/CoreStoreBridge.swift
+++ b/Sources/CoreStoreBridge.swift
@@ -28,157 +28,23 @@ import Foundation
// MARK: - CoreStoreObjectiveCType
-/**
- `CoreStoreObjectiveCType`s are Objective-C accessible classes that represent CoreStore's Swift types.
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
public protocol CoreStoreObjectiveCType: AnyObject {
-
- /**
- The corresponding Swift type
- */
+
associatedtype SwiftType
-
- /**
- The bridged Swift instance
- */
+
var bridgeToSwift: SwiftType { get }
-
- /**
- Initializes this instance with the Swift instance to bridge from
- */
+
init(_ swiftValue: SwiftType)
}
// MARK: - CoreStoreSwiftType
-/**
- `CoreStoreSwiftType`s are CoreStore's Swift types that are bridgeable to Objective-C.
- */
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
+@available(*, unavailable, message: "CoreStore Objective-C is now obsoleted in preparation for Swift concurrency.")
public protocol CoreStoreSwiftType {
-
- /**
- The corresponding Objective-C type
- */
+
associatedtype ObjectiveCType
- /**
- The bridged Objective-C instance
- */
var bridgeToObjectiveC: ObjectiveCType { get }
}
-
-
-// MARK: - Internal
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ closure: () -> T) -> T.ObjectiveCType {
-
- return closure().bridgeToObjectiveC
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ closure: () -> [T]) -> [T.ObjectiveCType] {
-
- return closure().map { $0.bridgeToObjectiveC }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ closure: () -> T?) -> T.ObjectiveCType? {
-
- return closure()?.bridgeToObjectiveC
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ closure: () throws -> T) throws -> T.ObjectiveCType {
-
- do {
-
- return try closure().bridgeToObjectiveC
- }
- catch {
-
- throw error.bridgeToObjectiveC
- }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ closure: () throws -> Void) throws {
-
- do {
-
- try closure()
- }
- catch {
-
- throw error.bridgeToObjectiveC
- }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ error: NSErrorPointer, _ closure: () throws -> T) -> T.ObjectiveCType? {
-
- do {
-
- let result = try closure()
- error?.pointee = nil
- return result.bridgeToObjectiveC
- }
- catch let swiftError {
-
- error?.pointee = swiftError.bridgeToObjectiveC
- return nil
- }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ error: NSErrorPointer, _ closure: () throws -> Void) -> Bool {
-
- do {
-
- try closure()
- error?.pointee = nil
- return true
- }
- catch let swiftError {
-
- error?.pointee = swiftError.bridgeToObjectiveC
- return false
- }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ error: NSErrorPointer, _ closure: () throws -> T?) -> T? {
-
- do {
-
- let result = try closure()
- error?.pointee = nil
- return result
- }
- catch let swiftError {
-
- error?.pointee = swiftError.bridgeToObjectiveC
- return nil
- }
-}
-
-@available(*, deprecated, message: "CoreStore Objective-C API will be removed soon.")
-internal func bridge(_ error: NSErrorPointer, _ closure: () throws -> [T]) -> [T.ObjectiveCType]? {
-
- do {
-
- let result = try closure()
- error?.pointee = nil
- return result.map { $0.bridgeToObjectiveC }
- }
- catch let swiftError {
-
- error?.pointee = swiftError.bridgeToObjectiveC
- return nil
- }
-}
-
-
diff --git a/Sources/CoreStoreError.swift b/Sources/CoreStoreError.swift
index c22ce8b..655b5d2 100644
--- a/Sources/CoreStoreError.swift
+++ b/Sources/CoreStoreError.swift
@@ -258,8 +258,23 @@ public enum CoreStoreError: Error, CustomNSError, Hashable {
// MARK: Internal
internal init(_ error: Error?) {
-
- self = error.flatMap({ $0.bridgeToSwift }) ?? .unknown
+
+ guard let error = error else {
+
+ self = .unknown
+ return
+ }
+ switch error {
+
+ case let error as CoreStoreError:
+ self = error
+
+ case let error as NSError:
+ self = .internalError(NSError: error)
+
+ default:
+ self = .unknown
+ }
}
}
diff --git a/Sources/CustomSchemaMappingProvider.swift b/Sources/CustomSchemaMappingProvider.swift
index afcacfa..d8b4525 100644
--- a/Sources/CustomSchemaMappingProvider.swift
+++ b/Sources/CustomSchemaMappingProvider.swift
@@ -216,7 +216,7 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
*/
public subscript(attribute: KeyPathString) -> Any? {
- return self.rawObject.cs_accessValueForKVCKey(attribute)
+ return self.rawObject.getValue(forKvcKey: attribute)
}
/**
@@ -224,7 +224,7 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
*/
public subscript(attribute: NSAttributeDescription) -> Any? {
- return self.rawObject.cs_accessValueForKVCKey(attribute.name)
+ return self.rawObject.getValue(forKvcKey: attribute.name)
}
/**
@@ -273,8 +273,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
*/
public subscript(attribute: KeyPathString) -> Any? {
- get { return self.rawObject.cs_accessValueForKVCKey(attribute) }
- set { self.rawObject.cs_setValue(newValue, forKVCKey: attribute) }
+ get { return self.rawObject.getValue(forKvcKey: attribute) }
+ set { self.rawObject.setValue(newValue, forKvcKey: attribute) }
}
/**
@@ -282,8 +282,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
*/
public subscript(attribute: NSAttributeDescription) -> Any? {
- get { return self.rawObject.cs_accessValueForKVCKey(attribute.name) }
- set { self.rawObject.cs_setValue(newValue, forKVCKey: attribute.name) }
+ get { return self.rawObject.getValue(forKvcKey: attribute.name) }
+ set { self.rawObject.setValue(newValue, forKvcKey: attribute.name) }
}
/**
diff --git a/Sources/DataStack+Transaction.swift b/Sources/DataStack+Transaction.swift
index 52b3844..ae8bb6c 100644
--- a/Sources/DataStack+Transaction.swift
+++ b/Sources/DataStack+Transaction.swift
@@ -35,12 +35,18 @@ extension DataStack {
Performs a transaction asynchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the wrapped as `.success(T)` in the `completion`'s `Result`. Any errors thrown from inside the `task` will be reported as `.failure(CoreStoreError)`. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`.
- parameter task: the asynchronous closure 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 sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- parameter completion: the closure executed after the save completes. The `Result` argument of the closure will either wrap the return value of `task`, or any uncaught errors thrown from within `task`. Cancelled `task`s will be indicated by `.failure(error: CoreStoreError.userCancelled)`. Custom errors thrown by the user will be wrapped in `CoreStoreError.userError(error: Error)`.
*/
- public func perform(asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T, completion: @escaping (AsynchronousDataTransaction.Result) -> Void) {
+ public func perform(
+ asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T,
+ sourceIdentifier: Any? = nil,
+ completion: @escaping (AsynchronousDataTransaction.Result) -> Void
+ ) {
self.perform(
asynchronous: task,
+ sourceIdentifier: sourceIdentifier,
success: { completion(.success($0)) },
failure: { completion(.failure($0)) }
)
@@ -50,14 +56,21 @@ extension DataStack {
Performs a transaction asynchronously where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. The changes are commited automatically after the `task` closure returns. On success, the value returned from closure will be the argument of the `success` closure. Any errors thrown from inside the `task` will be wrapped in a `CoreStoreError` and reported in the `failure` closure. To cancel/rollback changes, call `try transaction.cancel()`, which throws a `CoreStoreError.userCancelled`.
- parameter task: the asynchronous closure 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 sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- parameter success: the closure executed after the save succeeds. The `T` argument of the closure will be the value returned from `task`.
- parameter failure: the closure executed if the save fails or if any errors are thrown within `task`. Cancelled `task`s will be indicated by `CoreStoreError.userCancelled`. Custom errors thrown by the user will be wrapped in `CoreStoreError.userError(error: Error)`.
*/
- public func perform(asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T, success: @escaping (T) -> Void, failure: @escaping (CoreStoreError) -> Void) {
+ public func perform(
+ asynchronous task: @escaping (_ transaction: AsynchronousDataTransaction) throws -> T,
+ sourceIdentifier: Any? = nil,
+ success: @escaping (T) -> Void,
+ failure: @escaping (CoreStoreError) -> Void
+ ) {
let transaction = AsynchronousDataTransaction(
mainContext: self.rootSavingContext,
- queue: self.childTransactionQueue
+ queue: self.childTransactionQueue,
+ sourceIdentifier: sourceIdentifier
)
transaction.transactionQueue.cs_async {
@@ -99,14 +112,20 @@ extension DataStack {
- parameter task: the synchronous non-escaping closure 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 waitForAllObservers: When `true`, this method waits for all observers to be notified of the changes before returning. This results in more predictable data update order, but may risk triggering deadlocks. When `false`, this method does not wait for observers to be notified of the changes before returning. This results in lower risk for deadlocks, but the updated data may not have been propagated to the `DataStack` after returning. Defaults to `true`.
+ - parameter sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- throws: a `CoreStoreError` value indicating the failure. Cancelled `task`s will be indicated by `CoreStoreError.userCancelled`. Custom errors thrown by the user will be wrapped in `CoreStoreError.userError(error: Error)`.
- returns: the value returned from `task`
*/
- public func perform(synchronous task: ((_ transaction: SynchronousDataTransaction) throws -> T), waitForAllObservers: Bool = true) throws -> T {
+ public func perform(
+ synchronous task: ((_ transaction: SynchronousDataTransaction) throws -> T),
+ waitForAllObservers: Bool = true,
+ sourceIdentifier: Any? = nil
+ ) throws -> T {
let transaction = SynchronousDataTransaction(
mainContext: self.rootSavingContext,
- queue: self.childTransactionQueue
+ queue: self.childTransactionQueue,
+ sourceIdentifier: sourceIdentifier
)
return try transaction.transactionQueue.cs_sync {
@@ -141,10 +160,14 @@ extension DataStack {
/**
Begins a non-contiguous transaction where `NSManagedObject` or `CoreStoreObject` creates, updates, and deletes can be made. This is useful for making temporary changes, such as partially filled forms.
- - prameter supportsUndo: `undo()`, `redo()`, and `rollback()` methods are only available when this parameter is `true`, otherwise those method will raise an exception. Defaults to `false`. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
+ - parameter supportsUndo: `undo()`, `redo()`, and `rollback()` methods are only available when this parameter is `true`, otherwise those method will raise an exception. Defaults to `false`. Note that turning on Undo support may heavily impact performance especially on iOS or watchOS where memory is limited.
+ - parameter sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- returns: a `UnsafeDataTransaction` instance where creates, updates, and deletes can be made.
*/
- public func beginUnsafe(supportsUndo: Bool = false) -> UnsafeDataTransaction {
+ public func beginUnsafe(
+ supportsUndo: Bool = false,
+ sourceIdentifier: Any? = nil
+ ) -> UnsafeDataTransaction {
return UnsafeDataTransaction(
mainContext: self.rootSavingContext,
@@ -152,10 +175,11 @@ extension DataStack {
Internals.libReverseDomain("UnsafeDataTransaction.queue"),
qos: .userInitiated
),
- supportsUndo: supportsUndo
+ supportsUndo: supportsUndo,
+ sourceIdentifier: sourceIdentifier
)
}
-
+
/**
Refreshes all registered objects `NSManagedObject`s or `CoreStoreObject`s in the `DataStack`.
*/
diff --git a/Sources/DataStack.AddStoragePublisher.swift b/Sources/DataStack.AddStoragePublisher.swift
index ddc1763..85cf5d5 100644
--- a/Sources/DataStack.AddStoragePublisher.swift
+++ b/Sources/DataStack.AddStoragePublisher.swift
@@ -199,7 +199,7 @@ extension DataStack {
)
if let progress = progress {
- progress.cs_setProgressHandler { [weak self] progress in
+ progress.setProgressHandler { [weak self] progress in
guard
let self = self,
diff --git a/Sources/DiffableDataSource.BaseAdapter.swift b/Sources/DiffableDataSource.BaseAdapter.swift
index bf04b22..e3ffb46 100644
--- a/Sources/DiffableDataSource.BaseAdapter.swift
+++ b/Sources/DiffableDataSource.BaseAdapter.swift
@@ -116,10 +116,10 @@ extension DiffableDataSource {
target.reload(
using: changeset,
animated: animatingDifferences,
- setData: setSections
+ setData: setSections,
+ completion: completion
)
- },
- completion: completion
+ }
)
}
@@ -148,10 +148,10 @@ extension DiffableDataSource {
target.reload(
using: changeset,
animated: animatingDifferences,
- setData: setSections
+ setData: setSections,
+ completion: completion
)
- },
- completion: completion
+ }
)
}
diff --git a/Sources/DiffableDataSource.CollectionViewAdapter-AppKit.swift b/Sources/DiffableDataSource.CollectionViewAdapter-AppKit.swift
index d533af4..39fb38a 100644
--- a/Sources/DiffableDataSource.CollectionViewAdapter-AppKit.swift
+++ b/Sources/DiffableDataSource.CollectionViewAdapter-AppKit.swift
@@ -83,7 +83,12 @@ extension DiffableDataSource {
- parameter itemProvider: a closure that configures and returns the `NSCollectionViewItem` for the object
*/
@nonobjc
- public init(collectionView: NSCollectionView, dataStack: DataStack, itemProvider: @escaping (NSCollectionView, IndexPath, O) -> NSCollectionViewItem?, supplementaryViewProvider: @escaping (NSCollectionView, String, IndexPath) -> NSView? = { _, _, _ in nil }) {
+ public init(
+ collectionView: NSCollectionView,
+ dataStack: DataStack,
+ itemProvider: @escaping (NSCollectionView, IndexPath, O) -> NSCollectionViewItem?,
+ supplementaryViewProvider: @escaping (NSCollectionView, String, IndexPath) -> NSView? = { _, _, _ in nil }
+ ) {
self.itemProvider = itemProvider
self.supplementaryViewProvider = supplementaryViewProvider
@@ -97,19 +102,27 @@ extension DiffableDataSource {
// MARK: - NSCollectionViewDataSource
@objc
- public dynamic func numberOfSections(in collectionView: NSCollectionView) -> Int {
+ public dynamic func numberOfSections(
+ in collectionView: NSCollectionView
+ ) -> Int {
return self.numberOfSections()
}
@objc
- public dynamic func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
+ public dynamic func collectionView(
+ _ collectionView: NSCollectionView,
+ numberOfItemsInSection section: Int
+ ) -> Int {
return self.numberOfItems(inSection: section) ?? 0
}
@objc
- open dynamic func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
+ open dynamic func collectionView(
+ _ collectionView: NSCollectionView,
+ itemForRepresentedObjectAt indexPath: IndexPath
+ ) -> NSCollectionViewItem {
guard let objectID = self.itemID(for: indexPath) else {
@@ -127,7 +140,11 @@ extension DiffableDataSource {
}
@objc
- open dynamic func collectionView(_ collectionView: NSCollectionView, viewForSupplementaryElementOfKind kind: NSCollectionView.SupplementaryElementKind, at indexPath: IndexPath) -> NSView {
+ open dynamic func collectionView(
+ _ collectionView: NSCollectionView,
+ viewForSupplementaryElementOfKind kind: NSCollectionView.SupplementaryElementKind,
+ at indexPath: IndexPath
+ ) -> NSView {
guard let view = self.supplementaryViewProvider(collectionView, kind, indexPath) else {
@@ -207,9 +224,9 @@ extension DiffableDataSource {
self.base?.moveItem(at: indexPath, to: newIndexPath)
}
- public func performBatchUpdates(updates: () -> Void, animated: Bool) {
+ public func performBatchUpdates(updates: () -> Void, animated: Bool, completion: @escaping () -> Void) {
- self.base?.animator().performBatchUpdates(updates, completionHandler: nil)
+ self.base?.animator().performBatchUpdates(updates, completionHandler: { _ in completion() })
}
public func reloadData() {
diff --git a/Sources/DiffableDataSource.CollectionViewAdapter-UIKit.swift b/Sources/DiffableDataSource.CollectionViewAdapter-UIKit.swift
index 2294f1f..4c22f4e 100644
--- a/Sources/DiffableDataSource.CollectionViewAdapter-UIKit.swift
+++ b/Sources/DiffableDataSource.CollectionViewAdapter-UIKit.swift
@@ -83,7 +83,12 @@ extension DiffableDataSource {
- parameter cellProvider: a closure that configures and returns the `UICollectionViewCell` for the object
- parameter supplementaryViewProvider: an optional closure for providing `UICollectionReusableView` supplementary views. If not set, defaults to returning `nil`
*/
- public init(collectionView: UICollectionView, dataStack: DataStack, cellProvider: @escaping (UICollectionView, IndexPath, O) -> UICollectionViewCell?, supplementaryViewProvider: @escaping (UICollectionView, String, IndexPath) -> UICollectionReusableView? = { _, _, _ in nil }) {
+ public init(
+ collectionView: UICollectionView,
+ dataStack: DataStack,
+ cellProvider: @escaping (UICollectionView, IndexPath, O) -> UICollectionViewCell?,
+ supplementaryViewProvider: @escaping (UICollectionView, String, IndexPath) -> UICollectionReusableView? = { _, _, _ in nil }
+ ) {
self.cellProvider = cellProvider
self.supplementaryViewProvider = supplementaryViewProvider
@@ -97,19 +102,30 @@ extension DiffableDataSource {
// MARK: - UICollectionViewDataSource
@objc
- public dynamic func numberOfSections(in collectionView: UICollectionView) -> Int {
+ @MainActor
+ public dynamic func numberOfSections(
+ in collectionView: UICollectionView
+ ) -> Int {
return self.numberOfSections()
}
@objc
- public dynamic func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+ @MainActor
+ public dynamic func collectionView(
+ _ collectionView: UICollectionView,
+ numberOfItemsInSection section: Int
+ ) -> Int {
return self.numberOfItems(inSection: section) ?? 0
}
@objc
- open dynamic func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+ @MainActor
+ open dynamic func collectionView(
+ _ collectionView: UICollectionView,
+ cellForItemAt indexPath: IndexPath
+ ) -> UICollectionViewCell {
guard let objectID = self.itemID(for: indexPath) else {
@@ -127,7 +143,12 @@ extension DiffableDataSource {
}
@objc
- open dynamic func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
+ @MainActor
+ open dynamic func collectionView(
+ _ collectionView: UICollectionView,
+ viewForSupplementaryElementOfKind kind: String,
+ at indexPath: IndexPath
+ ) -> UICollectionReusableView {
guard let view = self.supplementaryViewProvider(collectionView, kind, indexPath) else {
@@ -207,9 +228,9 @@ extension DiffableDataSource {
self.base?.moveItem(at: indexPath, to: newIndexPath)
}
- public func performBatchUpdates(updates: () -> Void, animated: Bool) {
+ public func performBatchUpdates(updates: () -> Void, animated: Bool, completion: @escaping () -> Void) {
- self.base?.performBatchUpdates(updates, completion: nil)
+ self.base?.performBatchUpdates(updates, completion: { _ in completion() })
}
public func reloadData() {
diff --git a/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift b/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift
index 88a6ad9..3747d96 100644
--- a/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift
+++ b/Sources/DiffableDataSource.TableViewAdapter-UIKit.swift
@@ -82,7 +82,11 @@ extension DiffableDataSource {
- parameter dataStack: the `DataStack` instance that the dataSource will fetch objects from
- parameter cellProvider: a closure that configures and returns the `UITableViewCell` for the object
*/
- public init(tableView: UITableView, dataStack: DataStack, cellProvider: @escaping (UITableView, IndexPath, O) -> UITableViewCell?) {
+ public init(
+ tableView: UITableView,
+ dataStack: DataStack,
+ cellProvider: @escaping (UITableView, IndexPath, O) -> UITableViewCell?
+ ) {
self.cellProvider = cellProvider
super.init(target: .init(tableView), dataStack: dataStack)
@@ -102,31 +106,48 @@ extension DiffableDataSource {
// MARK: - UITableViewDataSource
@objc
+ @MainActor
public dynamic func numberOfSections(in tableView: UITableView) -> Int {
return self.numberOfSections()
}
@objc
- public dynamic func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ @MainActor
+ public dynamic func tableView(
+ _ tableView: UITableView,
+ numberOfRowsInSection section: Int
+ ) -> Int {
return self.numberOfItems(inSection: section) ?? 0
}
@objc
- open dynamic func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ titleForHeaderInSection section: Int
+ ) -> String? {
return self.sectionID(for: section)
}
@objc
- open dynamic func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ titleForFooterInSection section: Int
+ ) -> String? {
return nil
}
@objc
- open dynamic func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ cellForRowAt indexPath: IndexPath
+ ) -> UITableViewCell {
guard let objectID = self.itemID(for: indexPath) else {
@@ -144,28 +165,49 @@ extension DiffableDataSource {
}
@objc
- open dynamic func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ canEditRowAt indexPath: IndexPath
+ ) -> Bool {
return true
}
@objc
- open dynamic func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ editingStyleForRowAt indexPath: IndexPath
+ ) -> UITableViewCell.EditingStyle {
return .delete
}
@objc
- open dynamic func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {}
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ commit editingStyle: UITableViewCell.EditingStyle,
+ forRowAt indexPath: IndexPath
+ ) {}
@objc
- open dynamic func sectionIndexTitles(for tableView: UITableView) -> [String]? {
+ @MainActor
+ open dynamic func sectionIndexTitles(
+ for tableView: UITableView
+ ) -> [String]? {
return nil
}
@objc
- open dynamic func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
+ @MainActor
+ open dynamic func tableView(
+ _ tableView: UITableView,
+ sectionForSectionIndexTitle title: String,
+ at index: Int
+ ) -> Int {
return index
}
@@ -241,13 +283,13 @@ extension DiffableDataSource {
self.base?.moveRow(at: indexPath, to: newIndexPath)
}
- public func performBatchUpdates(updates: () -> Void, animated: Bool) {
+ public func performBatchUpdates(updates: () -> Void, animated: Bool, completion: @escaping () -> Void) {
guard let base = self.base else {
return
}
- base.performBatchUpdates(updates)
+ base.performBatchUpdates(updates, completion: { _ in completion() })
}
public func reloadData() {
diff --git a/Sources/DiffableDataSource.Target.swift b/Sources/DiffableDataSource.Target.swift
index 9b1ba16..8408444 100644
--- a/Sources/DiffableDataSource.Target.swift
+++ b/Sources/DiffableDataSource.Target.swift
@@ -98,7 +98,7 @@ public protocol DiffableDataSourceTarget {
/**
Animates multiple insert, delete, reload, and move operations as a group.
*/
- func performBatchUpdates(updates: () -> Void, animated: Bool)
+ func performBatchUpdates(updates: () -> Void, animated: Bool, completion: @escaping () -> Void)
/**
Reloads all sections and items.
@@ -114,9 +114,15 @@ extension DiffableDataSource.Target {
using stagedChangeset: Internals.DiffableDataUIDispatcher.StagedChangeset,
animated: Bool,
interrupt: ((Internals.DiffableDataUIDispatcher.Changeset) -> Bool)? = nil,
- setData: (C) -> Void
+ setData: (C) -> Void,
+ completion: @escaping () -> Void
) {
+ let group = DispatchGroup()
+ defer {
+
+ group.notify(queue: .main, execute: completion)
+ }
if self.shouldSuspendBatchUpdates, let data = stagedChangeset.last?.data {
setData(data)
@@ -133,6 +139,7 @@ extension DiffableDataSource.Target {
self.reloadData()
return
}
+ group.enter()
self.performBatchUpdates(
updates: {
@@ -206,7 +213,8 @@ extension DiffableDataSource.Target {
)
}
},
- animated: animated
+ animated: animated,
+ completion: group.leave
)
}
}
diff --git a/Sources/Internals.Closure.swift b/Sources/Internals.Closure.swift
index a7438ec..d904852 100644
--- a/Sources/Internals.Closure.swift
+++ b/Sources/Internals.Closure.swift
@@ -34,7 +34,10 @@ extension Internals {
internal final class Closure {
- // MARK: FilePrivate
+ // MARK: Internal
+
+ internal typealias Arguments = T
+ internal typealias Result = U
internal init(_ closure: @escaping (T) -> U) {
diff --git a/Sources/Internals.DiffableDataUIDispatcher.swift b/Sources/Internals.DiffableDataUIDispatcher.swift
index a09202c..acde1bf 100644
--- a/Sources/Internals.DiffableDataUIDispatcher.swift
+++ b/Sources/Internals.DiffableDataUIDispatcher.swift
@@ -59,16 +59,14 @@ extension Internals {
Target,
StagedChangeset<[Internals.DiffableDataSourceSnapshot.Section]>,
@escaping ([Internals.DiffableDataSourceSnapshot.Section]) -> Void
- ) -> Void,
- completion: @escaping () -> Void
+ ) -> Void
) {
self.apply(
.init(),
target: target,
animatingDifferences: animatingDifferences,
- performUpdates: performUpdates,
- completion: completion
+ performUpdates: performUpdates
)
}
@@ -80,8 +78,7 @@ extension Internals {
Target,
StagedChangeset<[Internals.DiffableDataSourceSnapshot.Section]>,
@escaping ([Internals.DiffableDataSourceSnapshot.Section]) -> Void
- ) -> Void,
- completion: @escaping () -> Void
+ ) -> Void
) {
self.dispatcher.dispatch { [weak self] in
@@ -112,7 +109,6 @@ extension Internals {
#if canImport(QuartzCore)
CATransaction.begin()
- CATransaction.setCompletionBlock(completion)
if !animatingDifferences {
@@ -122,11 +118,9 @@ extension Internals {
CATransaction.commit()
-
#else
performDiffingUpdates()
- completion()
#endif
diff --git a/Sources/Internals.FetchedDiffableDataSourceSnapshotDelegate.swift b/Sources/Internals.FetchedDiffableDataSourceSnapshotDelegate.swift
index 760be1a..c8d6375 100644
--- a/Sources/Internals.FetchedDiffableDataSourceSnapshotDelegate.swift
+++ b/Sources/Internals.FetchedDiffableDataSourceSnapshotDelegate.swift
@@ -43,7 +43,10 @@ internal protocol FetchedDiffableDataSourceSnapshotHandler: AnyObject {
var sectionIndexTransformer: (_ sectionName: KeyPathString?) -> String? { get }
- func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: Internals.DiffableDataSourceSnapshot)
+ func controller(
+ _ controller: NSFetchedResultsController,
+ didChangeContentWith snapshot: Internals.DiffableDataSourceSnapshot
+ )
}
diff --git a/Sources/Internals.FetchedResultsControllerDelegate.swift b/Sources/Internals.FetchedResultsControllerDelegate.swift
index 2931ee0..15da8a7 100644
--- a/Sources/Internals.FetchedResultsControllerDelegate.swift
+++ b/Sources/Internals.FetchedResultsControllerDelegate.swift
@@ -33,13 +33,28 @@ internal protocol FetchedResultsControllerHandler: AnyObject {
var sectionIndexTransformer: (_ sectionName: KeyPathString?) -> String? { get }
- func controller(_ controller: NSFetchedResultsController, didChangeObject anObject: Any, atIndexPath indexPath: IndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath?)
+ func controller(
+ _ controller: NSFetchedResultsController,
+ didChangeObject anObject: Any,
+ atIndexPath indexPath: IndexPath?,
+ forChangeType type: NSFetchedResultsChangeType,
+ newIndexPath: IndexPath?
+ )
- func controller(_ controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType)
+ func controller(
+ _ controller: NSFetchedResultsController,
+ didChangeSection sectionInfo: NSFetchedResultsSectionInfo,
+ atIndex sectionIndex: Int,
+ forChangeType type: NSFetchedResultsChangeType
+ )
- func controllerWillChangeContent(_ controller: NSFetchedResultsController)
+ func controllerWillChangeContent(
+ _ controller: NSFetchedResultsController
+ )
- func controllerDidChangeContent(_ controller: NSFetchedResultsController)
+ func controllerDidChangeContent(
+ _ controller: NSFetchedResultsController
+ )
}
@@ -102,7 +117,6 @@ extension Internals {
return
}
-
self.handler?.controllerDidChangeContent(controller)
}
diff --git a/Sources/ListMonitor.swift b/Sources/ListMonitor.swift
index 79e0789..4487704 100644
--- a/Sources/ListMonitor.swift
+++ b/Sources/ListMonitor.swift
@@ -393,19 +393,31 @@ public final class ListMonitor: Hashable {
observer,
willChange: { (observer, monitor) in
- observer.listMonitorWillChange(monitor)
+ observer.listMonitorWillChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didChange: { (observer, monitor) in
- observer.listMonitorDidChange(monitor)
+ observer.listMonitorDidChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
willRefetch: { (observer, monitor) in
- observer.listMonitorWillRefetch(monitor)
+ observer.listMonitorWillRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didRefetch: { (observer, monitor) in
- observer.listMonitorDidRefetch(monitor)
+ observer.listMonitorDidRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
}
@@ -428,38 +440,71 @@ public final class ListMonitor: Hashable {
observer,
willChange: { (observer, monitor) in
- observer.listMonitorWillChange(monitor)
+ observer.listMonitorWillChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didChange: { (observer, monitor) in
- observer.listMonitorDidChange(monitor)
+ observer.listMonitorDidChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
willRefetch: { (observer, monitor) in
- observer.listMonitorWillRefetch(monitor)
+ observer.listMonitorWillRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didRefetch: { (observer, monitor) in
- observer.listMonitorDidRefetch(monitor)
+ observer.listMonitorDidRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
self.registerObserver(
observer,
didInsertObject: { (observer, monitor, object, toIndexPath) in
- observer.listMonitor(monitor, didInsertObject: object, toIndexPath: toIndexPath)
+ observer.listMonitor(
+ monitor,
+ didInsertObject: object,
+ toIndexPath: toIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didDeleteObject: { (observer, monitor, object, fromIndexPath) in
- observer.listMonitor(monitor, didDeleteObject: object, fromIndexPath: fromIndexPath)
+ observer.listMonitor(
+ monitor,
+ didDeleteObject: object,
+ fromIndexPath: fromIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didUpdateObject: { (observer, monitor, object, atIndexPath) in
- observer.listMonitor(monitor, didUpdateObject: object, atIndexPath: atIndexPath)
+ observer.listMonitor(
+ monitor,
+ didUpdateObject: object,
+ atIndexPath: atIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didMoveObject: { (observer, monitor, object, fromIndexPath, toIndexPath) in
- observer.listMonitor(monitor, didMoveObject: object, fromIndexPath: fromIndexPath, toIndexPath: toIndexPath)
+ observer.listMonitor(
+ monitor,
+ didMoveObject: object,
+ fromIndexPath: fromIndexPath,
+ toIndexPath: toIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
}
@@ -482,49 +527,92 @@ public final class ListMonitor: Hashable {
observer,
willChange: { (observer, monitor) in
- observer.listMonitorWillChange(monitor)
+ observer.listMonitorWillChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didChange: { (observer, monitor) in
- observer.listMonitorDidChange(monitor)
+ observer.listMonitorDidChange(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
willRefetch: { (observer, monitor) in
- observer.listMonitorWillRefetch(monitor)
+ observer.listMonitorWillRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didRefetch: { (observer, monitor) in
- observer.listMonitorDidRefetch(monitor)
+ observer.listMonitorDidRefetch(
+ monitor,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
self.registerObserver(
observer,
didInsertObject: { (observer, monitor, object, toIndexPath) in
- observer.listMonitor(monitor, didInsertObject: object, toIndexPath: toIndexPath)
+ observer.listMonitor(
+ monitor,
+ didInsertObject: object,
+ toIndexPath: toIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didDeleteObject: { (observer, monitor, object, fromIndexPath) in
- observer.listMonitor(monitor, didDeleteObject: object, fromIndexPath: fromIndexPath)
+ observer.listMonitor(
+ monitor,
+ didDeleteObject: object,
+ fromIndexPath: fromIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didUpdateObject: { (observer, monitor, object, atIndexPath) in
- observer.listMonitor(monitor, didUpdateObject: object, atIndexPath: atIndexPath)
+ observer.listMonitor(
+ monitor,
+ didUpdateObject: object,
+ atIndexPath: atIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didMoveObject: { (observer, monitor, object, fromIndexPath, toIndexPath) in
- observer.listMonitor(monitor, didMoveObject: object, fromIndexPath: fromIndexPath, toIndexPath: toIndexPath)
+ observer.listMonitor(
+ monitor,
+ didMoveObject: object,
+ fromIndexPath: fromIndexPath,
+ toIndexPath: toIndexPath,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
self.registerObserver(
observer,
didInsertSection: { (observer, monitor, sectionInfo, toIndex) in
- observer.listMonitor(monitor, didInsertSection: sectionInfo, toSectionIndex: toIndex)
+ observer.listMonitor(
+ monitor,
+ didInsertSection: sectionInfo,
+ toSectionIndex: toIndex,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
},
didDeleteSection: { (observer, monitor, sectionInfo, fromIndex) in
- observer.listMonitor(monitor, didDeleteSection: sectionInfo, fromSectionIndex: fromIndex)
+ observer.listMonitor(
+ monitor,
+ didDeleteSection: sectionInfo,
+ fromSectionIndex: fromIndex,
+ sourceIdentifier: monitor.fetchedResultsController.managedObjectContext.saveMetadata?.sourceIdentifier
+ )
}
)
}
@@ -555,11 +643,18 @@ public final class ListMonitor: Hashable {
`refetch(...)` broadcasts `listMonitorWillRefetch(...)` to its observers immediately, and then `listMonitorDidRefetch(...)` after the new fetch request completes.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
+ - parameter sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- Important: Starting CoreStore 4.0, all `FetchClause`s required by the `ListMonitor` should be provided in the arguments list of `refetch(...)`.
*/
- public func refetch(_ fetchClauses: FetchClause...) {
+ public func refetch(
+ _ fetchClauses: FetchClause...,
+ sourceIdentifier: Any? = nil
+ ) {
- self.refetch(fetchClauses)
+ self.refetch(
+ fetchClauses,
+ sourceIdentifier: sourceIdentifier
+ )
}
/**
@@ -568,14 +663,21 @@ public final class ListMonitor: Hashable {
`refetch(...)` broadcasts `listMonitorWillRefetch(...)` to its observers immediately, and then `listMonitorDidRefetch(...)` after the new fetch request completes.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
+ - parameter sourceIdentifier: an optional value that identifies the source of this transaction. This identifier will be passed to the change notifications and callers can use it for custom handling that depends on the source.
- Important: Starting CoreStore 4.0, all `FetchClause`s required by the `ListMonitor` should be provided in the arguments list of `refetch(...)`.
*/
- public func refetch(_ fetchClauses: [FetchClause]) {
+ public func refetch(
+ _ fetchClauses: [FetchClause],
+ sourceIdentifier: Any? = nil
+ ) {
- self.refetch { (fetchRequest) in
-
- fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
- }
+ self.refetch(
+ { (fetchRequest) in
+
+ fetchClauses.forEach { $0.applyToFetchRequest(fetchRequest) }
+ },
+ sourceIdentifier: sourceIdentifier
+ )
}
@@ -627,7 +729,12 @@ public final class ListMonitor: Hashable {
// MARK: Internal
- internal convenience init(dataStack: DataStack, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void) {
+ internal convenience init(
+ dataStack: DataStack,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void
+ ) {
self.init(
context: dataStack.mainContext,
@@ -639,7 +746,13 @@ public final class ListMonitor: Hashable {
)
}
- internal convenience init(dataStack: DataStack, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void, createAsynchronously: @escaping (ListMonitor) -> Void) {
+ internal convenience init(
+ dataStack: DataStack,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void,
+ createAsynchronously: @escaping (ListMonitor) -> Void
+ ) {
self.init(
context: dataStack.mainContext,
@@ -651,7 +764,12 @@ public final class ListMonitor: Hashable {
)
}
- internal convenience init(unsafeTransaction: UnsafeDataTransaction, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void) {
+ internal convenience init(
+ unsafeTransaction: UnsafeDataTransaction,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void
+ ) {
self.init(
context: unsafeTransaction.context,
@@ -663,7 +781,13 @@ public final class ListMonitor: Hashable {
)
}
- internal convenience init(unsafeTransaction: UnsafeDataTransaction, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void, createAsynchronously: @escaping (ListMonitor) -> Void) {
+ internal convenience init(
+ unsafeTransaction: UnsafeDataTransaction,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void,
+ createAsynchronously: @escaping (ListMonitor) -> Void
+ ) {
self.init(
context: unsafeTransaction.context,
@@ -675,7 +799,12 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerChangeNotification(_ notificationKey: UnsafeRawPointer, name: Notification.Name, toObserver observer: AnyObject, callback: @escaping (_ monitor: ListMonitor) -> Void) {
+ internal func registerChangeNotification(
+ _ notificationKey: UnsafeRawPointer,
+ name: Notification.Name,
+ toObserver observer: AnyObject,
+ callback: @escaping (_ monitor: ListMonitor) -> Void
+ ) {
Internals.setAssociatedRetainedObject(
Internals.NotificationObserver(
@@ -695,7 +824,16 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerObjectNotification(_ notificationKey: UnsafeRawPointer, name: Notification.Name, toObserver observer: AnyObject, callback: @escaping (_ monitor: ListMonitor, _ object: O, _ indexPath: IndexPath?, _ newIndexPath: IndexPath?) -> Void) {
+ internal func registerObjectNotification(
+ _ notificationKey: UnsafeRawPointer,
+ name: Notification.Name,
+ toObserver observer: AnyObject,
+ callback: @escaping (
+ _ monitor: ListMonitor,
+ _ object: O,
+ _ indexPath: IndexPath?,
+ _ newIndexPath: IndexPath?
+ ) -> Void) {
Internals.setAssociatedRetainedObject(
Internals.NotificationObserver(
@@ -722,7 +860,16 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerSectionNotification(_ notificationKey: UnsafeRawPointer, name: Notification.Name, toObserver observer: AnyObject, callback: @escaping (_ monitor: ListMonitor, _ sectionInfo: NSFetchedResultsSectionInfo, _ sectionIndex: Int) -> Void) {
+ internal func registerSectionNotification(
+ _ notificationKey: UnsafeRawPointer,
+ name: Notification.Name,
+ toObserver observer: AnyObject,
+ callback: @escaping (
+ _ monitor: ListMonitor,
+ _ sectionInfo: NSFetchedResultsSectionInfo,
+ _ sectionIndex: Int
+ ) -> Void
+ ) {
Internals.setAssociatedRetainedObject(
Internals.NotificationObserver(
@@ -745,7 +892,24 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerObserver(_ observer: U, willChange: @escaping (_ observer: U, _ monitor: ListMonitor) -> Void, didChange: @escaping (_ observer: U, _ monitor: ListMonitor) -> Void, willRefetch: @escaping (_ observer: U, _ monitor: ListMonitor) -> Void, didRefetch: @escaping (_ observer: U, _ monitor: ListMonitor) -> Void) {
+ internal func registerObserver(
+ _ observer: U,
+ willChange: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor
+ ) -> Void,
+ didChange: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor
+ ) -> Void,
+ willRefetch: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor
+ ) -> Void,
+ didRefetch: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor
+ ) -> Void) {
Internals.assert(
Thread.isMainThread,
@@ -805,7 +969,33 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerObserver(_ observer: U, didInsertObject: @escaping (_ observer: U, _ monitor: ListMonitor, _ object: O, _ toIndexPath: IndexPath) -> Void, didDeleteObject: @escaping (_ observer: U, _ monitor: ListMonitor, _ object: O, _ fromIndexPath: IndexPath) -> Void, didUpdateObject: @escaping (_ observer: U, _ monitor: ListMonitor, _ object: O, _ atIndexPath: IndexPath) -> Void, didMoveObject: @escaping (_ observer: U, _ monitor: ListMonitor, _ object: O, _ fromIndexPath: IndexPath, _ toIndexPath: IndexPath) -> Void) {
+ internal func registerObserver(
+ _ observer: U,
+ didInsertObject: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ object: O,
+ _ toIndexPath: IndexPath
+ ) -> Void,
+ didDeleteObject: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ object: O,
+ _ fromIndexPath: IndexPath
+ ) -> Void,
+ didUpdateObject: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ object: O,
+ _ atIndexPath: IndexPath
+ ) -> Void,
+ didMoveObject: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ object: O,
+ _ fromIndexPath: IndexPath,
+ _ toIndexPath: IndexPath
+ ) -> Void) {
Internals.assert(
Thread.isMainThread,
@@ -866,7 +1056,20 @@ public final class ListMonitor: Hashable {
)
}
- internal func registerObserver(_ observer: U, didInsertSection: @escaping (_ observer: U, _ monitor: ListMonitor, _ sectionInfo: NSFetchedResultsSectionInfo, _ toIndex: Int) -> Void, didDeleteSection: @escaping (_ observer: U, _ monitor: ListMonitor, _ sectionInfo: NSFetchedResultsSectionInfo, _ fromIndex: Int) -> Void) {
+ internal func registerObserver(
+ _ observer: U,
+ didInsertSection: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ sectionInfo: NSFetchedResultsSectionInfo,
+ _ toIndex: Int
+ ) -> Void,
+ didDeleteSection: @escaping (
+ _ observer: U,
+ _ monitor: ListMonitor,
+ _ sectionInfo: NSFetchedResultsSectionInfo,
+ _ fromIndex: Int
+ ) -> Void) {
Internals.assert(
Thread.isMainThread,
@@ -922,7 +1125,10 @@ public final class ListMonitor: Hashable {
Internals.setAssociatedRetainedObject(nilValue, forKey: &self.didDeleteSectionKey, inObject: observer)
}
- internal func refetch(_ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void) {
+ internal func refetch(
+ _ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void,
+ sourceIdentifier: Any?
+ ) {
Internals.assert(
Thread.isMainThread,
@@ -987,10 +1193,15 @@ public final class ListMonitor: Hashable {
self.isPendingRefetch = false
+ newFetchedResultsController.managedObjectContext.saveMetadata = .init(
+ isSavingSynchronously: false,
+ sourceIdentifier: sourceIdentifier
+ )
NotificationCenter.default.post(
name: Notification.Name.listMonitorDidRefetchList,
object: self
)
+ newFetchedResultsController.managedObjectContext.saveMetadata = nil
}
}
}
@@ -1051,7 +1262,15 @@ public final class ListMonitor: Hashable {
}
}
- private static func recreateFetchedResultsController(context: NSManagedObjectContext, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void) -> (controller: Internals.CoreStoreFetchedResultsController, delegate: Internals.FetchedResultsControllerDelegate) {
+ private static func recreateFetchedResultsController(
+ context: NSManagedObjectContext,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void
+ ) -> (
+ controller: Internals.CoreStoreFetchedResultsController,
+ delegate: Internals.FetchedResultsControllerDelegate
+ ) {
let fetchRequest = Internals.CoreStoreFetchRequest()
fetchRequest.fetchLimit = 0
@@ -1077,7 +1296,14 @@ public final class ListMonitor: Hashable {
private let from: From
private let sectionBy: SectionBy?
- private init(context: NSManagedObjectContext, transactionQueue: DispatchQueue, from: From, sectionBy: SectionBy?, applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void, createAsynchronously: ((ListMonitor) -> Void)?) {
+ private init(
+ context: NSManagedObjectContext,
+ transactionQueue: DispatchQueue,
+ from: From,
+ sectionBy: SectionBy?,
+ applyFetchClauses: @escaping (_ fetchRequest: Internals.CoreStoreFetchRequest) -> Void,
+ createAsynchronously: ((ListMonitor) -> Void)?
+ ) {
self.isSectioned = (sectionBy != nil)
self.from = from
@@ -1124,7 +1350,7 @@ public final class ListMonitor: Hashable {
return
}
- self.refetch(self.applyFetchClauses)
+ self.refetch(self.applyFetchClauses, sourceIdentifier: nil)
}
)
@@ -1148,7 +1374,7 @@ public final class ListMonitor: Hashable {
if previousStores != currentStores {
- self.refetch(self.applyFetchClauses)
+ self.refetch(self.applyFetchClauses, sourceIdentifier: nil)
}
}
@@ -1294,7 +1520,13 @@ extension ListMonitor: FetchedResultsControllerHandler {
return self.sectionByIndexTransformer
}
- internal func controller(_ controller: NSFetchedResultsController, didChangeObject anObject: Any, atIndexPath indexPath: IndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
+ internal func controller(
+ _ controller: NSFetchedResultsController,
+ didChangeObject anObject: Any,
+ atIndexPath indexPath: IndexPath?,
+ forChangeType type: NSFetchedResultsChangeType,
+ newIndexPath: IndexPath?
+ ) {
switch type {
@@ -1344,7 +1576,12 @@ extension ListMonitor: FetchedResultsControllerHandler {
}
}
- internal func controller(_ controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) {
+ internal func controller(
+ _ controller: NSFetchedResultsController,
+ didChangeSection sectionInfo: NSFetchedResultsSectionInfo,
+ atIndex sectionIndex: Int,
+ forChangeType type: NSFetchedResultsChangeType
+ ) {
switch type {
@@ -1373,7 +1610,9 @@ extension ListMonitor: FetchedResultsControllerHandler {
}
}
- internal func controllerWillChangeContent(_ controller: NSFetchedResultsController) {
+ internal func controllerWillChangeContent(
+ _ controller: NSFetchedResultsController
+ ) {
self.taskGroup.enter()
NotificationCenter.default.post(
@@ -1382,7 +1621,9 @@ extension ListMonitor: FetchedResultsControllerHandler {
)
}
- internal func controllerDidChangeContent(_ controller: NSFetchedResultsController