mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-23 18:01:10 +01:00
WIP: Xcode 8 beta 6
This commit is contained in:
@@ -43,11 +43,11 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
||||
*/
|
||||
@objc
|
||||
public func commitWithCompletion(_ completion: ((result: CSSaveResult) -> Void)?) {
|
||||
public func commitWithCompletion(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
||||
|
||||
self.bridgeToSwift.commit { (result) in
|
||||
|
||||
completion?(result: result.bridgeToObjectiveC)
|
||||
completion?(result.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@discardableResult
|
||||
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
|
||||
return ObjectIdentifier(self.bridgeToSwift).hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSBaseDataTransaction else {
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ public extension CSCoreStore {
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
*/
|
||||
@objc
|
||||
public static func beginAsynchronous(_ closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
public static func beginAsynchronous(_ closure: @escaping (_ transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
|
||||
return CoreStore.beginAsynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.bridgeToObjectiveC)
|
||||
closure(transaction.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public extension CSCoreStore {
|
||||
*/
|
||||
@objc
|
||||
@discardableResult
|
||||
public static func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
public static func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ public extension CSDataStack {
|
||||
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
|
||||
*/
|
||||
@objc
|
||||
public func beginAsynchronous(_ closure: (transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
public func beginAsynchronous(_ closure: @escaping (_ transaction: CSAsynchronousDataTransaction) -> Void) {
|
||||
|
||||
return self.bridgeToSwift.beginAsynchronous { (transaction) in
|
||||
|
||||
closure(transaction: transaction.bridgeToObjectiveC)
|
||||
closure(transaction.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public extension CSDataStack {
|
||||
*/
|
||||
@objc
|
||||
@discardableResult
|
||||
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
||||
return ObjectIdentifier(self.bridgeToSwift).hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSDataStack else {
|
||||
|
||||
@@ -255,7 +255,7 @@ public final class CSDataStack: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSError else {
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
@@ -150,27 +150,27 @@ public final class CSError: NSError, CoreStoreObjectiveCType {
|
||||
case .differentStorageExistsAtURL(let existingPersistentStoreURL):
|
||||
code = .differentStorageExistsAtURL
|
||||
info = [
|
||||
"existingPersistentStoreURL": existingPersistentStoreURL
|
||||
"existingPersistentStoreURL" as NSObject: existingPersistentStoreURL as AnyObject
|
||||
]
|
||||
|
||||
case .mappingModelNotFound(let localStoreURL, let targetModel, let targetModelVersion):
|
||||
code = .mappingModelNotFound
|
||||
info = [
|
||||
"localStoreURL": localStoreURL,
|
||||
"targetModel": targetModel,
|
||||
"targetModelVersion": targetModelVersion
|
||||
"localStoreURL" as NSObject: localStoreURL as AnyObject,
|
||||
"targetModel" as NSObject: targetModel,
|
||||
"targetModelVersion" as NSObject: targetModelVersion as AnyObject
|
||||
]
|
||||
|
||||
case .progressiveMigrationRequired(let localStoreURL):
|
||||
code = .progressiveMigrationRequired
|
||||
info = [
|
||||
"localStoreURL": localStoreURL
|
||||
"localStoreURL" as NSObject: localStoreURL as AnyObject
|
||||
]
|
||||
|
||||
case .internalError(let NSError):
|
||||
code = .internalError
|
||||
info = [
|
||||
"NSError": NSError
|
||||
"NSError" as NSObject: NSError
|
||||
]
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ extension CoreStoreError: CoreStoreSwiftType {
|
||||
|
||||
// MARK: Internal
|
||||
|
||||
internal extension ErrorProtocol {
|
||||
internal extension Error {
|
||||
|
||||
internal var bridgeToSwift: CoreStoreError {
|
||||
|
||||
@@ -254,7 +254,7 @@ internal extension ErrorProtocol {
|
||||
case let error as CSError:
|
||||
return error.bridgeToSwift
|
||||
|
||||
case let error as NSError where self.dynamicType is NSError.Type:
|
||||
case let error as NSError where type(of: self) is NSError.Type:
|
||||
return .internalError(NSError: error)
|
||||
|
||||
default:
|
||||
|
||||
@@ -136,7 +136,7 @@ public final class CSFrom: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSGroupBy else {
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class CSGroupBy: NSObject, CSQueryClause, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjec
|
||||
return ObjectIdentifier(self.bridgeToSwift).hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSInMemoryStore else {
|
||||
|
||||
@@ -103,7 +103,7 @@ public final class CSInMemoryStore: NSObject, CSStorageInterface, CoreStoreObjec
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSInto else {
|
||||
|
||||
@@ -104,7 +104,7 @@ public final class CSInto: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -513,7 +513,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSListMonitor else {
|
||||
|
||||
@@ -524,7 +524,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,15 +90,15 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (migrationTypes: [CSMigrationType]) -> Void, failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleSuccess(_ success: (_ migrationTypes: [CSMigrationType]) -> Void, failure: (_ error: NSError) -> Void) {
|
||||
|
||||
switch self.bridgeToSwift {
|
||||
|
||||
case .success(let migrationTypes):
|
||||
success(migrationTypes: migrationTypes.map { $0.bridgeToObjectiveC })
|
||||
success(migrationTypes.map { $0.bridgeToObjectiveC })
|
||||
|
||||
case .failure(let error):
|
||||
failure(error: error.bridgeToObjectiveC)
|
||||
failure(error.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter success: the block to execute on success. The block passes an array of `CSMigrationType`s that indicates the migration steps completed.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (migrationTypes: [CSMigrationType]) -> Void) {
|
||||
public func handleSuccess(_ success: (_ migrationTypes: [CSMigrationType]) -> Void) {
|
||||
|
||||
guard case .success(let migrationTypes) = self.bridgeToSwift else {
|
||||
|
||||
return
|
||||
}
|
||||
success(migrationTypes: migrationTypes.map { $0.bridgeToObjectiveC })
|
||||
success(migrationTypes.map { $0.bridgeToObjectiveC })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,13 +127,13 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleFailure(_ failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleFailure(_ failure: (_ error: NSError) -> Void) {
|
||||
|
||||
guard case .failure(let error) = self.bridgeToSwift else {
|
||||
|
||||
return
|
||||
}
|
||||
failure(error: error.bridgeToObjectiveC)
|
||||
failure(error.bridgeToObjectiveC)
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSMigrationResult else {
|
||||
|
||||
@@ -155,7 +155,7 @@ public final class CSMigrationResult: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSMigrationType else {
|
||||
|
||||
@@ -101,7 +101,7 @@ public final class CSMigrationType: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSObjectMonitor else {
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSOrderBy else {
|
||||
|
||||
@@ -95,7 +95,7 @@ public final class CSOrderBy: NSObject, CSFetchClause, CSQueryClause, CSDeleteCl
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
|
||||
return ObjectIdentifier(self.bridgeToSwift).hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSSQLiteStore else {
|
||||
|
||||
@@ -181,7 +181,7 @@ public final class CSSQLiteStore: NSObject, CSLocalStorage, CoreStoreObjectiveCT
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,15 +90,15 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (hasChanges: Bool) -> Void, failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleSuccess(_ success: (_ hasChanges: Bool) -> Void, failure: (_ error: NSError) -> Void) {
|
||||
|
||||
switch self.bridgeToSwift {
|
||||
|
||||
case .success(let hasChanges):
|
||||
success(hasChanges: hasChanges)
|
||||
success(hasChanges)
|
||||
|
||||
case .failure(let error):
|
||||
failure(error: error.bridgeToObjectiveC)
|
||||
failure(error.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (hasChanges: Bool) -> Void) {
|
||||
public func handleSuccess(_ success: (_ hasChanges: Bool) -> Void) {
|
||||
|
||||
guard case .success(let hasChanges) = self.bridgeToSwift else {
|
||||
|
||||
return
|
||||
}
|
||||
success(hasChanges: hasChanges)
|
||||
success(hasChanges)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,13 +127,13 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleFailure(_ failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleFailure(_ failure: (_ error: NSError) -> Void) {
|
||||
|
||||
guard case .failure(let error) = self.bridgeToSwift else {
|
||||
|
||||
return
|
||||
}
|
||||
failure(error: error.bridgeToObjectiveC)
|
||||
failure(error.bridgeToObjectiveC)
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSSaveResult else {
|
||||
|
||||
@@ -155,7 +155,7 @@ public final class CSSaveResult: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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: (_ sectionName: String?) -> String?) -> CSSectionBy {
|
||||
|
||||
return self.init(SectionBy(sectionKeyPath, sectionIndexTransformer))
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public final class CSSelectTerm: NSObject, CoreStoreObjectiveCType {
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSSelectTerm else {
|
||||
|
||||
@@ -335,10 +335,10 @@ public final class CSSelect: NSObject {
|
||||
public override var hash: Int {
|
||||
|
||||
return self.attributeType.hashValue
|
||||
^ self.selectTerms.map { $0.hashValue }.reduce(0, combine: ^)
|
||||
^ self.selectTerms.map { $0.hashValue }.reduce(0, ^)
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSSelect else {
|
||||
|
||||
@@ -350,7 +350,7 @@ public final class CSSelect: NSObject {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,15 +76,15 @@ public final class CSSetupResult: NSObject {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (storage: CSStorageInterface) -> Void, failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleSuccess(_ success: (_ storage: CSStorageInterface) -> Void, failure: (_ error: NSError) -> Void) {
|
||||
|
||||
if let storage = self.storage {
|
||||
|
||||
success(storage: storage)
|
||||
success(storage)
|
||||
}
|
||||
else {
|
||||
|
||||
failure(error: self.error!)
|
||||
failure(self.error!)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,13 +96,13 @@ public final class CSSetupResult: NSObject {
|
||||
- parameter success: the block to execute on success. The block passes a `BOOL` argument that indicates if there were any changes made.
|
||||
*/
|
||||
@objc
|
||||
public func handleSuccess(_ success: @noescape (storage: CSStorageInterface) -> Void) {
|
||||
public func handleSuccess(_ success: (_ storage: CSStorageInterface) -> Void) {
|
||||
|
||||
guard let storage = self.storage else {
|
||||
|
||||
return
|
||||
}
|
||||
success(storage: storage)
|
||||
success(storage)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,13 +113,13 @@ public final class CSSetupResult: NSObject {
|
||||
- parameter failure: the block to execute on failure. The block passes an `NSError` argument that pertains to the actual error.
|
||||
*/
|
||||
@objc
|
||||
public func handleFailure(_ failure: @noescape (error: NSError) -> Void) {
|
||||
public func handleFailure(_ failure: (_ error: NSError) -> Void) {
|
||||
|
||||
guard let error = self.error else {
|
||||
|
||||
return
|
||||
}
|
||||
failure(error: error)
|
||||
failure(error)
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public final class CSSetupResult: NSObject {
|
||||
return self.isSuccess.hashValue ^ self.error!.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSSetupResult else {
|
||||
|
||||
@@ -146,13 +146,13 @@ public final class CSSetupResult: NSObject {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
// MARK: CoreStoreObjectiveCType
|
||||
|
||||
public required init<T: StorageInterface where T: CoreStoreSwiftType, T.ObjectiveCType: CSStorageInterface>(_ swiftValue: SetupResult<T>) {
|
||||
public required init<T: StorageInterface>(_ swiftValue: SetupResult<T>) where T: CoreStoreSwiftType, T.ObjectiveCType: CSStorageInterface {
|
||||
|
||||
switch swiftValue {
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@discardableResult
|
||||
public func beginSynchronous(_ closure: (transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
public func beginSynchronous(_ closure: @escaping (_ transaction: CSSynchronousDataTransaction) -> Void) -> CSSaveResult? {
|
||||
|
||||
return bridge {
|
||||
|
||||
@@ -75,7 +75,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
The block to customize the `NSFetchRequest`
|
||||
*/
|
||||
@objc
|
||||
public var block: (fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void {
|
||||
public var block: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void {
|
||||
|
||||
return self.bridgeToSwift.closure
|
||||
}
|
||||
@@ -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: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
|
||||
|
||||
self.init(Tweak(block))
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public final class CSTweak: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
||||
- parameter completion: the block executed after the save completes. Success or failure is reported by the `CSSaveResult` argument of the block.
|
||||
*/
|
||||
@objc
|
||||
public func commit(_ completion: ((result: CSSaveResult) -> Void)?) {
|
||||
public func commit(_ completion: ((_ result: CSSaveResult) -> Void)?) {
|
||||
|
||||
self.bridgeToSwift.commit { (result) in
|
||||
|
||||
completion?(result: result.bridgeToObjectiveC)
|
||||
completion?(result.bridgeToObjectiveC)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
return self.bridgeToSwift.hashValue
|
||||
}
|
||||
|
||||
public override func isEqual(_ object: AnyObject?) -> Bool {
|
||||
public override func isEqual(_ object: Any?) -> Bool {
|
||||
|
||||
guard let object = object as? CSWhere else {
|
||||
|
||||
@@ -132,7 +132,7 @@ public final class CSWhere: NSObject, CSFetchClause, CSQueryClause, CSDeleteClau
|
||||
|
||||
public override var description: String {
|
||||
|
||||
return "(\(String(reflecting: self.dynamicType))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
return "(\(String(reflecting: type(of: self)))) \(self.bridgeToSwift.coreStoreDumpString)"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,17 +79,17 @@ public extension CoreStoreSwiftType where ObjectiveCType: CoreStoreObjectiveCTyp
|
||||
|
||||
// MARK: - Internal
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType>(_ closure: @noescape () -> T) -> T.ObjectiveCType {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T) -> T.ObjectiveCType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
|
||||
return closure().bridgeToObjectiveC
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType>(_ closure: @noescape () -> T?) -> T.ObjectiveCType? {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () -> T?) -> T.ObjectiveCType? where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
|
||||
return closure()?.bridgeToObjectiveC
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType>(_ closure: @noescape () throws -> T) throws -> T.ObjectiveCType {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ closure: () throws -> T) throws -> T.ObjectiveCType where T.ObjectiveCType: CoreStoreObjectiveCType, T == T.ObjectiveCType.SwiftType {
|
||||
|
||||
do {
|
||||
|
||||
@@ -101,7 +101,7 @@ internal func bridge<T: CoreStoreSwiftType where T.ObjectiveCType: CoreStoreObje
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge(_ closure: @noescape () throws -> Void) throws {
|
||||
internal func bridge(_ closure: () throws -> Void) throws {
|
||||
|
||||
do {
|
||||
|
||||
@@ -113,7 +113,7 @@ internal func bridge(_ closure: @noescape () throws -> Void) throws {
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ error: NSErrorPointer, _ closure: @noescape () throws -> T) -> T.ObjectiveCType? {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ error: NSErrorPointer, _ closure: () throws -> T) -> T.ObjectiveCType? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -128,7 +128,7 @@ internal func bridge<T: CoreStoreSwiftType>(_ error: NSErrorPointer, _ closure:
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge(_ error: NSErrorPointer, _ closure: @noescape () throws -> Void) -> Bool {
|
||||
internal func bridge(_ error: NSErrorPointer, _ closure: () throws -> Void) -> Bool {
|
||||
|
||||
do {
|
||||
|
||||
@@ -143,7 +143,7 @@ internal func bridge(_ error: NSErrorPointer, _ closure: @noescape () throws ->
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge<T>(_ error: NSErrorPointer, _ closure: @noescape () throws -> T?) -> T? {
|
||||
internal func bridge<T>(_ error: NSErrorPointer, _ closure: () throws -> T?) -> T? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -158,7 +158,7 @@ internal func bridge<T>(_ error: NSErrorPointer, _ closure: @noescape () throws
|
||||
}
|
||||
}
|
||||
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ error: NSErrorPointer, _ closure: @noescape () throws -> [T]) -> [T.ObjectiveCType]? {
|
||||
internal func bridge<T: CoreStoreSwiftType>(_ error: NSErrorPointer, _ closure: () throws -> [T]) -> [T.ObjectiveCType]? {
|
||||
|
||||
do {
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public extension Progress {
|
||||
- parameter closure: the closure to execute on progress change
|
||||
*/
|
||||
@objc
|
||||
public func cs_setProgressHandler(_ closure: ((progress: Progress) -> Void)?) {
|
||||
public func cs_setProgressHandler(_ closure: ((_ progress: Progress) -> Void)?) {
|
||||
|
||||
self.setProgressHandler(closure)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user