From 08053ccb1585cc16b6c03f1ab519c5a0669e2abf Mon Sep 17 00:00:00 2001 From: John Estropia Date: Sat, 27 Apr 2019 17:50:55 +0900 Subject: [PATCH] change protocol inheritance from class to AnyObject (as per recent Swift recommendation) --- .../CoreStoreDemo/MIgrations Demo/OrganismProtocol.swift | 2 +- README.md | 2 +- Sources/AttributeProtocol.swift | 2 +- Sources/CSListObserver.swift | 2 +- Sources/CSObjectObserver.swift | 2 +- Sources/CoreDataNativeType.swift | 2 +- Sources/CoreStoreBridge.swift | 2 +- Sources/CoreStoreObject+Observing.swift | 2 +- Sources/DynamicObject.swift | 2 +- Sources/FetchableSource.swift | 2 +- Sources/FetchedResultsControllerDelegate.swift | 2 +- Sources/ListObserver.swift | 2 +- Sources/ObjectObserver.swift | 2 +- Sources/QueryableSource.swift | 2 +- Sources/RelationshipProtocol.swift | 2 +- Sources/StorageInterface.swift | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/OrganismProtocol.swift b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/OrganismProtocol.swift index d38fb95..48afe59 100644 --- a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/OrganismProtocol.swift +++ b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/OrganismProtocol.swift @@ -8,7 +8,7 @@ import Foundation -protocol OrganismProtocol: class { +protocol OrganismProtocol: AnyObject { var dna: Int64 { get set } diff --git a/README.md b/README.md index 0c92815..8edd35c 100644 --- a/README.md +++ b/README.md @@ -964,7 +964,7 @@ You can even use external types from popular 3rd-party JSON libraries, or just s #### `ImportableObject` `ImportableObject` is a very simple protocol: ```swift -public protocol ImportableObject: class { +public protocol ImportableObject: AnyObject { typealias ImportSource static func shouldInsert(from source: ImportSource, in transaction: BaseDataTransaction) -> Bool func didInsert(from source: ImportSource, in transaction: BaseDataTransaction) throws diff --git a/Sources/AttributeProtocol.swift b/Sources/AttributeProtocol.swift index 3649bb8..9223daa 100644 --- a/Sources/AttributeProtocol.swift +++ b/Sources/AttributeProtocol.swift @@ -29,7 +29,7 @@ import CoreData // MARK: - AttributeProtocol -internal protocol AttributeProtocol: class { +internal protocol AttributeProtocol: AnyObject { static var attributeType: NSAttributeType { get } diff --git a/Sources/CSListObserver.swift b/Sources/CSListObserver.swift index e2b0f92..b12c3f4 100644 --- a/Sources/CSListObserver.swift +++ b/Sources/CSListObserver.swift @@ -42,7 +42,7 @@ import CoreData */ @available(macOS 10.12, *) @objc -public protocol CSListObserver: class { +public protocol CSListObserver: AnyObject { /** Handles processing just before a change to the observed list occurs diff --git a/Sources/CSObjectObserver.swift b/Sources/CSObjectObserver.swift index 42cdf8d..a69e968 100644 --- a/Sources/CSObjectObserver.swift +++ b/Sources/CSObjectObserver.swift @@ -40,7 +40,7 @@ import CoreData */ @available(macOS 10.12, *) @objc -public protocol CSObjectObserver: class { +public protocol CSObjectObserver: AnyObject { /** Handles processing just before a change to the observed `object` occurs diff --git a/Sources/CoreDataNativeType.swift b/Sources/CoreDataNativeType.swift index dfa1717..4f98347 100644 --- a/Sources/CoreDataNativeType.swift +++ b/Sources/CoreDataNativeType.swift @@ -33,7 +33,7 @@ import CoreData Objective-C Foundation types that are natively supported by Core Data managed attributes all conform to `CoreDataNativeType`. */ @objc -public protocol CoreDataNativeType: class, NSObjectProtocol {} +public protocol CoreDataNativeType: AnyObject, NSObjectProtocol {} // MARK: - NSNumber diff --git a/Sources/CoreStoreBridge.swift b/Sources/CoreStoreBridge.swift index fc36eb7..1c8aae9 100644 --- a/Sources/CoreStoreBridge.swift +++ b/Sources/CoreStoreBridge.swift @@ -31,7 +31,7 @@ import Foundation /** `CoreStoreObjectiveCType`s are Objective-C accessible classes that represent CoreStore's Swift types. */ -public protocol CoreStoreObjectiveCType: class { +public protocol CoreStoreObjectiveCType: AnyObject { /** The corresponding Swift type diff --git a/Sources/CoreStoreObject+Observing.swift b/Sources/CoreStoreObject+Observing.swift index d5eaf83..81d4365 100644 --- a/Sources/CoreStoreObject+Observing.swift +++ b/Sources/CoreStoreObject+Observing.swift @@ -34,7 +34,7 @@ import CoreData `invalidate()` will be called automatically when an `CoreStoreObjectKeyValueObservation` is deinited. */ -public protocol CoreStoreObjectKeyValueObservation: class { +public protocol CoreStoreObjectKeyValueObservation: AnyObject { /** `invalidate()` will be called automatically when an `CoreStoreObjectKeyValueObservation` is deinited. diff --git a/Sources/DynamicObject.swift b/Sources/DynamicObject.swift index 49931ae..923ea43 100644 --- a/Sources/DynamicObject.swift +++ b/Sources/DynamicObject.swift @@ -32,7 +32,7 @@ import CoreData /** All CoreStore's utilities are designed around `DynamicObject` instances. `NSManagedObject` and `CoreStoreObject` instances all conform to `DynamicObject`. */ -public protocol DynamicObject: class { +public protocol DynamicObject: AnyObject { /** Used internally by CoreStore. Do not call directly. diff --git a/Sources/FetchableSource.swift b/Sources/FetchableSource.swift index e7688aa..c2cb82c 100644 --- a/Sources/FetchableSource.swift +++ b/Sources/FetchableSource.swift @@ -32,7 +32,7 @@ import CoreData /** Encapsulates containers which manages an internal `NSManagedObjectContext`, such as `DataStack`s and transactions, that can be used for fetching objects. CoreStore provides implementations for this protocol and should be used as a read-only abstraction. */ -public protocol FetchableSource: class { +public protocol FetchableSource: AnyObject { /** Fetches the `DynamicObject` instance in the `FetchableSource`'s context from a reference created from another managed object context. diff --git a/Sources/FetchedResultsControllerDelegate.swift b/Sources/FetchedResultsControllerDelegate.swift index 00c2ea4..417573e 100644 --- a/Sources/FetchedResultsControllerDelegate.swift +++ b/Sources/FetchedResultsControllerDelegate.swift @@ -30,7 +30,7 @@ import CoreData // MARK: - FetchedResultsControllerHandler @available(macOS 10.12, *) -internal protocol FetchedResultsControllerHandler: class { +internal protocol FetchedResultsControllerHandler: AnyObject { func controller(_ controller: NSFetchedResultsController, didChangeObject anObject: Any, atIndexPath indexPath: IndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) diff --git a/Sources/ListObserver.swift b/Sources/ListObserver.swift index b12f543..d7f8433 100644 --- a/Sources/ListObserver.swift +++ b/Sources/ListObserver.swift @@ -40,7 +40,7 @@ import CoreData ``` */ @available(macOS 10.12, *) -public protocol ListObserver: class { +public protocol ListObserver: AnyObject { /** The `NSManagedObject` type for the observed list diff --git a/Sources/ObjectObserver.swift b/Sources/ObjectObserver.swift index 083db14..b9508f3 100644 --- a/Sources/ObjectObserver.swift +++ b/Sources/ObjectObserver.swift @@ -37,7 +37,7 @@ import CoreData ``` */ @available(macOS 10.12, *) -public protocol ObjectObserver: class { +public protocol ObjectObserver: AnyObject { /** The `DynamicObject` type for the observed object diff --git a/Sources/QueryableSource.swift b/Sources/QueryableSource.swift index d7e00ed..af58556 100644 --- a/Sources/QueryableSource.swift +++ b/Sources/QueryableSource.swift @@ -32,7 +32,7 @@ import CoreData /** Encapsulates containers which manages an internal `NSManagedObjectContext`, such as `DataStack`s and transactions, that can be used for querying values. CoreStore provides implementations for this protocol and should be used as a read-only abstraction. */ -public protocol QueryableSource: class { +public protocol QueryableSource: AnyObject { /** Queries aggregate values as specified by the `QueryClause`s. Requires at least a `Select` clause, and optional `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. diff --git a/Sources/RelationshipProtocol.swift b/Sources/RelationshipProtocol.swift index c46c669..bb97636 100644 --- a/Sources/RelationshipProtocol.swift +++ b/Sources/RelationshipProtocol.swift @@ -29,7 +29,7 @@ import CoreData // MARK: - RelationshipProtocol -internal protocol RelationshipProtocol: class { +internal protocol RelationshipProtocol: AnyObject { var keyPath: KeyPathString { get } var isToMany: Bool { get } diff --git a/Sources/StorageInterface.swift b/Sources/StorageInterface.swift index 0fd4482..441e47d 100644 --- a/Sources/StorageInterface.swift +++ b/Sources/StorageInterface.swift @@ -31,7 +31,7 @@ import CoreData /** The `StorageInterface` represents the data store managed (or to be managed) by the `DataStack`. When added to the `DataStack`, the `StorageInterface` serves as the interface for the `NSPersistentStore`. This may be a database file, an in-memory store, etc. */ -public protocol StorageInterface: class { +public protocol StorageInterface: AnyObject { /** 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.