WIP: broken generics

This commit is contained in:
John Estropia
2016-09-06 20:16:46 +09:00
parent b502895d63
commit 82de482191
95 changed files with 610 additions and 677 deletions

View File

@@ -65,7 +65,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
self.bridgeToSwift.beginSynchronous { (transaction) in
closure(transaction: transaction.bridgeToObjectiveC)
closure(transaction.bridgeToObjectiveC)
}
}
}
@@ -88,7 +88,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public override func createInto(_ into: CSInto) -> AnyObject {
public override func createInto(_ into: CSInto) -> Any {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -100,7 +100,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public override func editObject(_ object: NSManagedObject?) -> AnyObject? {
public override func editObject(_ object: NSManagedObject?) -> Any? {
return self.bridgeToSwift.edit(object)
}
@@ -113,7 +113,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}

View File

@@ -38,7 +38,7 @@ public extension CSBaseDataTransaction {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
public func fetchExistingObject(_ object: NSManagedObject) -> Any? {
do {
@@ -57,7 +57,7 @@ public extension CSBaseDataTransaction {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any? {
do {
@@ -76,7 +76,7 @@ public extension CSBaseDataTransaction {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any] {
return objects.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0.objectID) }
}
@@ -88,7 +88,7 @@ public extension CSBaseDataTransaction {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any] {
return objectIDs.flatMap { try? self.bridgeToSwift.context.existingObject(with: $0) }
}
@@ -101,7 +101,7 @@ public extension CSBaseDataTransaction {
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
*/
@objc
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -118,7 +118,7 @@ public extension CSBaseDataTransaction {
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
*/
@objc
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -141,7 +141,9 @@ public extension CSBaseDataTransaction {
self.bridgeToSwift.isRunningInAllowedQueue(),
"Attempted to fetch from a \(cs_typeName(self)) outside its designated queue."
)
return self.bridgeToSwift.context.fetchCount(from, fetchClauses)
return self.bridgeToSwift.context
.fetchCount(from, fetchClauses)
.flatMap { NSNumber(value: $0) }
}
/**
@@ -172,7 +174,7 @@ public extension CSBaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),
@@ -192,7 +194,7 @@ public extension CSBaseDataTransaction {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String: Any]]? {
CoreStore.assert(
self.bridgeToSwift.isRunningInAllowedQueue(),

View File

@@ -55,7 +55,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public func createInto(_ into: CSInto) -> AnyObject {
public func createInto(_ into: CSInto) -> Any {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -67,7 +67,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public func editObject(_ object: NSManagedObject?) -> AnyObject? {
public func editObject(_ object: NSManagedObject?) -> Any? {
return self.bridgeToSwift.edit(object)
}
@@ -80,7 +80,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}

View File

@@ -47,7 +47,7 @@ public extension CSCoreStore {
- 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.
*/
public static func addInMemoryStorage(_ storage: CSInMemoryStore, completion: (CSSetupResult) -> Void) {
public static func addInMemoryStorage(_ storage: CSInMemoryStore, completion: @escaping (CSSetupResult) -> Void) {
self.defaultStack.addInMemoryStorage(storage, completion: completion)
}
@@ -72,7 +72,7 @@ public extension CSCoreStore {
- 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.
*/
public static func addSQLiteStorage(_ storage: CSSQLiteStore, completion: (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
public static func addSQLiteStorage(_ storage: CSSQLiteStore, completion: @escaping (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
return self.defaultStack.addSQLiteStorage(storage, completion: completion, error: error)
}
@@ -86,7 +86,7 @@ public extension CSCoreStore {
- returns: an `NSProgress` instance if a migration has started. `nil` if no migrations are required or if `error` was set.
*/
@objc
public static func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
public static func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: @escaping (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
return self.defaultStack.upgradeStorageIfNeeded(storage, completion: completion, error: error)
}

View File

@@ -66,7 +66,7 @@ public extension CSCoreStore {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public static func monitorListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
public static func monitorListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
return self.defaultStack.monitorListByCreatingAsynchronously(
createAsynchronously,
@@ -102,7 +102,7 @@ public extension CSCoreStore {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public static func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
public static func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
self.defaultStack.monitorSectionedListByCreatingAsynchronously(
createAsynchronously,

View File

@@ -38,7 +38,7 @@ public extension CSCoreStore {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public static func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
public static func fetchExistingObject(_ object: NSManagedObject) -> Any? {
return self.defaultStack.fetchExistingObject(object)
}
@@ -50,7 +50,7 @@ public extension CSCoreStore {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
public static func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any? {
return self.defaultStack.fetchExistingObjectWithID(objectID)
}
@@ -62,7 +62,7 @@ public extension CSCoreStore {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
public static func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any] {
return self.defaultStack.fetchExistingObjects(objects)
}
@@ -74,7 +74,7 @@ public extension CSCoreStore {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public static func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any] {
return self.defaultStack.fetchExistingObjectsWithIDs(objectIDs)
}
@@ -87,7 +87,7 @@ public extension CSCoreStore {
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
*/
@objc
public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public static func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any? {
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
}
@@ -100,7 +100,7 @@ public extension CSCoreStore {
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
*/
@objc
public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public static func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]? {
return self.defaultStack.fetchAllFrom(from, fetchClauses: fetchClauses)
}
@@ -155,7 +155,7 @@ public extension CSCoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public static func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any? {
return self.defaultStack.queryValueFrom(from, selectClause: selectClause, queryClauses: queryClauses)
}
@@ -171,7 +171,7 @@ public extension CSCoreStore {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public static func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String: Any]]? {
return self.defaultStack.queryAttributesFrom(from, selectClause: selectClause, queryClauses: queryClauses)
}

View File

@@ -58,7 +58,7 @@ public extension CSCoreStore {
CoreStore.beginSynchronous { (transaction) in
closure(transaction: transaction.bridgeToObjectiveC)
closure(transaction.bridgeToObjectiveC)
}
}
}

View File

@@ -48,7 +48,7 @@ public extension CSDataStack {
- 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: (CSSetupResult) -> Void) {
public func addInMemoryStorage(_ storage: CSInMemoryStore, completion: @escaping (CSSetupResult) -> Void) {
self.bridgeToSwift.addStorage(
storage.bridgeToSwift,
@@ -77,7 +77,7 @@ public extension CSDataStack {
- 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: (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
public func addSQLiteStorage(_ storage: CSSQLiteStore, completion: @escaping (CSSetupResult) -> Void, error: NSErrorPointer) -> Progress? {
return bridge(error) {
@@ -97,7 +97,7 @@ public extension CSDataStack {
- 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: (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
public func upgradeStorageIfNeeded(_ storage: CSSQLiteStore, completion: @escaping (CSMigrationResult) -> Void, error: NSErrorPointer) -> Progress? {
return bridge(error) {

View File

@@ -88,7 +88,7 @@ public extension CSDataStack {
- parameter fetchClauses: a series of `CSFetchClause` instances for fetching the object list. Accepts `CSWhere`, `CSOrderBy`, and `CSTweak` clauses.
*/
@objc
public func monitorListByCreatingAsynchronously(_ createAsynchronously: (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
public func monitorListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, fetchClauses: [CSFetchClause]) {
CoreStore.assert(
Thread.isMainThread,
@@ -154,7 +154,7 @@ public extension CSDataStack {
- 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: (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
public func monitorSectionedListByCreatingAsynchronously(_ createAsynchronously: @escaping (CSListMonitor) -> Void, from: CSFrom, sectionBy: CSSectionBy, fetchClauses: [CSFetchClause]) {
CoreStore.assert(
Thread.isMainThread,

View File

@@ -38,7 +38,7 @@ public extension CSDataStack {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public func fetchExistingObject(_ object: NSManagedObject) -> AnyObject? {
public func fetchExistingObject(_ object: NSManagedObject) -> Any? {
do {
@@ -57,7 +57,7 @@ public extension CSDataStack {
- returns: the `NSManagedObject` instance if the object exists in the transaction, or `nil` if not found.
*/
@objc
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> AnyObject? {
public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any? {
do {
@@ -76,7 +76,7 @@ public extension CSDataStack {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [AnyObject] {
public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any] {
return objects.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0.objectID) }
}
@@ -88,7 +88,7 @@ public extension CSDataStack {
- returns: the `NSManagedObject` array for objects that exists in the transaction
*/
@objc
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [AnyObject] {
public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any] {
return objectIDs.flatMap { try? self.bridgeToSwift.mainContext.existingObject(with: $0) }
}
@@ -101,7 +101,7 @@ public extension CSDataStack {
- returns: the first `NSManagedObject` instance that satisfies the specified `CSFetchClause`s
*/
@objc
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any? {
CoreStore.assert(
Thread.isMainThread,
@@ -118,7 +118,7 @@ public extension CSDataStack {
- returns: all `NSManagedObject` instances that satisfy the specified `CSFetchClause`s
*/
@objc
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [AnyObject]? {
public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]? {
CoreStore.assert(
Thread.isMainThread,
@@ -141,7 +141,9 @@ public extension CSDataStack {
Thread.isMainThread,
"Attempted to fetch from a \(cs_typeName(self)) outside the main thread."
)
return self.bridgeToSwift.mainContext.fetchCount(from, fetchClauses)
return self.bridgeToSwift.mainContext
.fetchCount(from, fetchClauses)
.flatMap { NSNumber(value: $0) }
}
/**
@@ -189,7 +191,7 @@ public extension CSDataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> AnyObject? {
public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any? {
CoreStore.assert(
Thread.isMainThread,
@@ -209,7 +211,7 @@ public extension CSDataStack {
- returns: the result of the the query. The type of the return value is specified by the generic type of the `CSSelect` parameter.
*/
@objc
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String: Any]]? {
CoreStore.assert(
Thread.isMainThread,

View File

@@ -58,7 +58,7 @@ public extension CSDataStack {
self.bridgeToSwift.beginSynchronous { (transaction) in
closure(transaction: transaction.bridgeToObjectiveC)
closure(transaction.bridgeToObjectiveC)
}
}
}

View File

@@ -140,7 +140,7 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
self.swiftError = swiftValue
let code: CoreStoreErrorCode
let info: [NSObject: AnyObject]
let info: [AnyHashable: Any]
switch swiftValue {
case .unknown:
@@ -150,27 +150,27 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
case .differentStorageExistsAtURL(let existingPersistentStoreURL):
code = .differentStorageExistsAtURL
info = [
"existingPersistentStoreURL" as NSObject: existingPersistentStoreURL as AnyObject
"existingPersistentStoreURL": existingPersistentStoreURL
]
case .mappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
code = .mappingModelNotFound
info = [
"localStoreURL" as NSObject: localStoreURL as AnyObject,
"targetModel" as NSObject: targetModel,
"targetModelVersion" as NSObject: targetModelVersion as AnyObject
"localStoreURL": localStoreURL,
"targetModel": targetModel,
"targetModelVersion": targetModelVersion
]
case .progressiveMigrationRequired(let localStoreURL):
code = .progressiveMigrationRequired
info = [
"localStoreURL" as NSObject: localStoreURL as AnyObject
"localStoreURL": localStoreURL
]
case .internalError(let NSError):
code = .internalError
info = [
"NSError" as NSObject: NSError
"NSError": NSError
]
}

View File

@@ -51,7 +51,7 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
May contain `NSString` instances to pertain to named configurations, or `NSNull` to pertain to the default configuration
*/
@objc
public var configurations: [AnyObject]? {
public var configurations: [Any]? {
return self.bridgeToSwift.configurations?.map {
@@ -85,7 +85,7 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
- 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: AnyClass, configuration: AnyObject) {
public convenience init(entityClass: AnyClass, configuration: Any) {
switch configuration {
@@ -111,7 +111,7 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
- 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: AnyClass, configurations: [AnyObject]) {
public convenience init(entityClass: AnyClass, configurations: [Any]) {
var arguments = [String?]()
for configuration in configurations {

View File

@@ -79,7 +79,7 @@ public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjec
The options dictionary for the `NSPersistentStore`. For `CSInMemoryStore`s, this is always set to `nil`.
*/
@objc
public var storeOptions: [String: AnyObject]? {
public var storeOptions: [AnyHashable: Any]? {
return self.bridgeToSwift.storeOptions
}

View File

@@ -48,7 +48,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index
*/
@objc
public subscript(index: Int) -> AnyObject {
public subscript(index: Int) -> Any {
return self.bridgeToSwift[index]
}
@@ -60,7 +60,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index, or `nil` if out of bounds
*/
@objc
public func objectAtSafeIndex(_ index: Int) -> AnyObject? {
public func objectAtSafeIndex(_ index: Int) -> Any? {
return self.bridgeToSwift[safeIndex: index]
}
@@ -73,12 +73,10 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified section and item index
*/
@objc
public func objectAtSectionIndex(_ sectionIndex: Int, itemIndex: Int) -> AnyObject {
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`.
@@ -86,7 +84,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified section and item index, or `nil` if out of bounds
*/
@objc
public func objectAtSafeSectionIndex(_ sectionIndex: Int, safeItemIndex itemIndex: Int) -> AnyObject? {
public func objectAtSafeSectionIndex(_ sectionIndex: Int, safeItemIndex itemIndex: Int) -> Any? {
return self.bridgeToSwift[safeSectionIndex: sectionIndex, safeItemIndex: itemIndex]
}
@@ -98,7 +96,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index path
*/
@objc
public func objectAtIndexPath(_ indexPath: IndexPath) -> AnyObject {
public func objectAtIndexPath(_ indexPath: IndexPath) -> Any {
return self.bridgeToSwift[indexPath]
}
@@ -110,7 +108,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
- returns: the `NSManagedObject` at the specified index path, or `nil` if out of bounds
*/
@objc
public func objectAtSafeIndexPath(_ indexPath: IndexPath) -> AnyObject? {
public func objectAtSafeIndexPath(_ indexPath: IndexPath) -> Any? {
return self.bridgeToSwift[safeIndexPath: indexPath]
}
@@ -216,7 +214,9 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
@objc
public func numberOfObjectsInSafeSection(safeSectionIndex section: Int) -> NSNumber? {
return self.bridgeToSwift.numberOfObjectsInSection(safeSectionIndex: section)
return self.bridgeToSwift
.numberOfObjectsInSection(safeSectionIndex: section)
.flatMap { NSNumber(value: $0) }
}
/**
@@ -287,7 +287,9 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
@objc
public func indexOf(_ object: NSManagedObject) -> NSNumber? {
return self.bridgeToSwift.indexOf(object)
return self.bridgeToSwift
.indexOf(object)
.flatMap { NSNumber(value: $0) }
}
/**

View File

@@ -103,7 +103,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the new `NSIndexPath` for the inserted object
*/
@objc
optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: AnyObject, toIndexPath indexPath: IndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didInsertObject object: Any, toIndexPath indexPath: IndexPath)
/**
Notifies that an object was deleted from the specified `NSIndexPath` in the list
@@ -113,7 +113,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the `NSIndexPath` for the deleted object
*/
@objc
optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: AnyObject, fromIndexPath indexPath: IndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didDeleteObject object: Any, fromIndexPath indexPath: IndexPath)
/**
Notifies that an object at the specified `NSIndexPath` was updated
@@ -123,7 +123,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter indexPath: the `NSIndexPath` for the updated object
*/
@objc
optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: AnyObject, atIndexPath indexPath: IndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didUpdateObject object: Any, atIndexPath indexPath: IndexPath)
/**
Notifies that an object's index changed
@@ -134,7 +134,7 @@ public protocol CSListObjectObserver: CSListObserver {
- parameter toIndexPath: the new `NSIndexPath` for the moved object
*/
@objc
optional func listMonitor(_ monitor: CSListMonitor, didMoveObject object: AnyObject, fromIndexPath: IndexPath, toIndexPath: IndexPath)
optional func listMonitor(_ monitor: CSListMonitor, didMoveObject object: Any, fromIndexPath: IndexPath, toIndexPath: IndexPath)
}

View File

@@ -43,7 +43,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
@objc
public var isSuccess: Bool {
return self.bridgeToSwift.boolValue
return self.bridgeToSwift.isSuccess
}
/**
@@ -52,7 +52,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
@objc
public var isFailure: Bool {
return !self.bridgeToSwift.boolValue
return !self.bridgeToSwift.isSuccess
}
/**

View File

@@ -43,7 +43,7 @@ public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
@objc
public var needsMigration: Bool {
return self.bridgeToSwift.boolValue
return self.bridgeToSwift.hasMigration
}
/**

View File

@@ -42,7 +42,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
/**
Returns the `NSManagedObject` instance being observed, or `nil` if the object was already deleted.
*/
public var object: AnyObject? {
public var object: Any? {
return self.bridgeToSwift.object
}

View File

@@ -50,7 +50,7 @@ public protocol CSObjectObserver: class, AnyObject {
- parameter object: the `NSManagedObject` instance being observed
*/
@objc
optional func objectMonitor(_ monitor: CSObjectMonitor, willUpdateObject object: AnyObject)
optional func objectMonitor(_ monitor: CSObjectMonitor, willUpdateObject object: Any)
/**
Handles processing right after a change to the observed `object` occurs
@@ -60,7 +60,7 @@ public protocol CSObjectObserver: class, AnyObject {
- 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: AnyObject, changedPersistentKeys: Set<String>)
optional func objectMonitor(_ monitor: CSObjectMonitor, didUpdateObject object: Any, changedPersistentKeys: Set<String>)
/**
Handles processing right after `object` is deleted
@@ -69,7 +69,7 @@ public protocol CSObjectObserver: class, AnyObject {
- parameter object: the `NSManagedObject` instance being observed
*/
@objc
optional func objectMonitor(_ monitor: CSObjectMonitor, didDeleteObject object: AnyObject)
optional func objectMonitor(_ monitor: CSObjectMonitor, didDeleteObject object: Any)
}
#endif

View File

@@ -41,7 +41,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
The list of sort descriptors
*/
@objc
public var sortDescriptors: [SortDescriptor] {
public var sortDescriptors: [NSSortDescriptor] {
return self.bridgeToSwift.sortDescriptors
}
@@ -56,7 +56,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
- parameter sortDescriptor: a `NSSortDescriptor`
*/
@objc
public convenience init(sortDescriptor: SortDescriptor) {
public convenience init(sortDescriptor: NSSortDescriptor) {
self.init(OrderBy(sortDescriptor))
}
@@ -71,7 +71,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
- parameter sortDescriptors: an array of `NSSortDescriptor`s
*/
@objc
public convenience init(sortDescriptors: [SortDescriptor]) {
public convenience init(sortDescriptors: [NSSortDescriptor]) {
self.init(OrderBy(sortDescriptors))
}

View File

@@ -145,7 +145,7 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
```
*/
@objc
public var storeOptions: [String: AnyObject]? {
public var storeOptions: [AnyHashable: Any]? {
return self.bridgeToSwift.storeOptions
}

View File

@@ -59,7 +59,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
- returns: a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
*/
@objc
public static func keyPath(_ sectionKeyPath: KeyPath, sectionIndexTransformer: (_ sectionName: String?) -> String?) -> CSSectionBy {
public static func keyPath(_ sectionKeyPath: KeyPath, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> CSSectionBy {
return self.init(SectionBy(sectionKeyPath, sectionIndexTransformer))
}

View File

@@ -67,7 +67,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func average(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.average(keyPath, As: alias))
return self.init(.average(keyPath, as: alias))
}
/**
@@ -84,7 +84,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func count(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.count(keyPath, As: alias))
return self.init(.count(keyPath, as: alias))
}
/**
@@ -101,7 +101,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func maximum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.maximum(keyPath, As: alias))
return self.init(.maximum(keyPath, as: alias))
}
/**
@@ -118,7 +118,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func minimum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.minimum(keyPath, As: alias))
return self.init(.minimum(keyPath, as: alias))
}
/**
@@ -135,7 +135,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func sum(_ keyPath: KeyPath, as alias: KeyPath?) -> CSSelectTerm {
return self.init(.sum(keyPath, As: alias))
return self.init(.sum(keyPath, as: alias))
}
/**
@@ -153,7 +153,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
@objc
public static func objectIDAs(_ alias: KeyPath? = nil) -> CSSelectTerm {
return self.init(.objectID(As: alias))
return self.init(.objectID(as: alias))
}

View File

@@ -53,7 +53,7 @@ public protocol CSStorageInterface {
The options dictionary for the `NSPersistentStore`
*/
@objc
var storeOptions: [String: AnyObject]? { get }
var storeOptions: [AnyHashable: Any]? { get }
}

View File

@@ -65,7 +65,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
self.bridgeToSwift.beginSynchronous { (transaction) in
closure(transaction: transaction.bridgeToObjectiveC)
closure(transaction.bridgeToObjectiveC)
}
}
}
@@ -88,7 +88,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
@objc
public override func createInto(_ into: CSInto) -> AnyObject {
public override func createInto(_ into: CSInto) -> Any {
return self.bridgeToSwift.create(into.bridgeToSwift)
}
@@ -100,7 +100,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public override func editObject(_ object: NSManagedObject?) -> AnyObject? {
public override func editObject(_ object: NSManagedObject?) -> Any? {
return self.bridgeToSwift.edit(object)
}
@@ -113,7 +113,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@objc
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
public override func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any? {
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
}

View File

@@ -53,7 +53,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
- parameter block: the block to customize the `NSFetchRequest`
*/
@objc
public convenience init(block: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
public convenience init(block: @escaping (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
self.init(Tweak(block))
}

View File

@@ -41,7 +41,7 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
The internal `NSPredicate` instance for the `Where` clause
*/
@objc
public var predicate: Predicate {
public var predicate: NSPredicate {
return self.bridgeToSwift.predicate
}
@@ -108,7 +108,7 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
- parameter predicate: the `NSPredicate` for the fetch or query
*/
@objc
public convenience init(predicate: Predicate) {
public convenience init(predicate: NSPredicate) {
self.init(Where(predicate))
}

View File

@@ -38,7 +38,7 @@ public extension NSManagedObject {
- returns: the primitive value for the KVC key
*/
@objc
public func cs_accessValueForKVCKey(_ KVCKey: KeyPath) -> AnyObject? {
public func cs_accessValueForKVCKey(_ KVCKey: KeyPath) -> Any? {
return self.accessValueForKVCKey(KVCKey)
}
@@ -50,7 +50,7 @@ public extension NSManagedObject {
- parameter KVCKey: the KVC key
*/
@objc
public func cs_setValue(_ value: AnyObject?, forKVCKey KVCKey: KeyPath) {
public func cs_setValue(_ value: Any?, forKVCKey KVCKey: KeyPath) {
self.setValue(value, forKVCKey: KVCKey)
}

View File

@@ -135,7 +135,7 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func queryValue(_ from: CSFrom, _ selectClause: CSSelect, _ queryClauses: [CSQueryClause]) -> AnyObject? {
internal func queryValue(_ from: CSFrom, _ selectClause: CSSelect, _ queryClauses: [CSQueryClause]) -> Any? {
let fetchRequest = CoreStoreFetchRequest<NSFetchRequestResult>()
let storeFound = from.bridgeToSwift.applyToFetchRequest(fetchRequest, context: self)
@@ -154,7 +154,7 @@ internal extension NSManagedObjectContext {
}
@nonobjc
internal func queryAttributes(_ from: CSFrom, _ selectClause: CSSelect, _ queryClauses: [CSQueryClause]) -> [[NSString: AnyObject]]? {
internal func queryAttributes(_ from: CSFrom, _ selectClause: CSSelect, _ queryClauses: [CSQueryClause]) -> [[String: Any]]? {
let fetchRequest = CoreStoreFetchRequest<NSFetchRequestResult>()
let storeFound = from.bridgeToSwift.applyToFetchRequest(fetchRequest, context: self)