mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-14 13:13:33 +01:00
relax NSManagedObject return types so callers don't need to cast every time
This commit is contained in:
@@ -87,7 +87,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
- returns: a new `NSManagedObject` instance of the specified entity type.
|
||||
*/
|
||||
@objc
|
||||
public override func createInto(into: CSInto) -> NSManagedObject {
|
||||
public override func createInto(into: CSInto) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift.create(into.bridgeToSwift)
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public override func editObject(object: NSManagedObject?) -> NSManagedObject? {
|
||||
public override func editObject(object: NSManagedObject?) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(object)
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public final class CSAsynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public extension CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
public func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -59,7 +59,7 @@ public extension CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -106,7 +106,7 @@ public extension CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||
|
||||
CoreStore.assert(
|
||||
self.bridgeToSwift.isRunningInAllowedQueue(),
|
||||
|
||||
@@ -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) -> NSManagedObject {
|
||||
public func createInto(into: CSInto) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift.create(into.bridgeToSwift)
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func editObject(object: NSManagedObject?) -> NSManagedObject? {
|
||||
public func editObject(object: NSManagedObject?) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(object)
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class CSBaseDataTransaction: NSObject, CoreStoreObjectiveCType {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func editInto(into: CSInto, objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public extension CSCoreStore {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
public static func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
|
||||
|
||||
return self.defaultStack.fetchExistingObject(object)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public extension CSCoreStore {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public static func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
return self.defaultStack.fetchExistingObjectWithID(objectID)
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public extension CSCoreStore {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public static func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
public static func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||
|
||||
return self.defaultStack.fetchOneFrom(from, fetchClauses: fetchClauses)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public extension CSDataStack {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObject(object: NSManagedObject) -> NSManagedObject? {
|
||||
public func fetchExistingObject(object: NSManagedObject) -> AnyObject? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -59,7 +59,7 @@ public extension CSDataStack {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public func fetchExistingObjectWithID(objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
do {
|
||||
|
||||
@@ -106,7 +106,7 @@ public extension CSDataStack {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObject? {
|
||||
public func fetchOneFrom(from: CSFrom, fetchClauses: [CSFetchClause]) -> AnyObject? {
|
||||
|
||||
CoreStore.assert(
|
||||
NSThread.isMainThread(),
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
- returns: the `NSManagedObject` at the specified index
|
||||
*/
|
||||
@objc
|
||||
public subscript(index: Int) -> NSManagedObject {
|
||||
public subscript(index: Int) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift[index]
|
||||
}
|
||||
@@ -59,7 +59,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) -> NSManagedObject? {
|
||||
public func objectAtSafeIndex(index: Int) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift[safeIndex: index]
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
- returns: the `NSManagedObject` at the specified section and item index
|
||||
*/
|
||||
@objc
|
||||
public func objectAtSectionIndex(sectionIndex: Int, itemIndex: Int) -> NSManagedObject {
|
||||
public func objectAtSectionIndex(sectionIndex: Int, itemIndex: Int) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift[sectionIndex, itemIndex]
|
||||
}
|
||||
@@ -85,7 +85,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) -> NSManagedObject? {
|
||||
public func objectAtSafeSectionIndex(sectionIndex: Int, safeItemIndex itemIndex: Int) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift[safeSectionIndex: sectionIndex, safeItemIndex: itemIndex]
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public final class CSListMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
- returns: the `NSManagedObject` at the specified index path
|
||||
*/
|
||||
@objc
|
||||
public func objectAtIndexPath(indexPath: NSIndexPath) -> NSManagedObject {
|
||||
public func objectAtIndexPath(indexPath: NSIndexPath) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift[indexPath]
|
||||
}
|
||||
@@ -109,7 +109,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: NSIndexPath) -> NSManagedObject? {
|
||||
public func objectAtSafeIndexPath(indexPath: NSIndexPath) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift[safeIndexPath: indexPath]
|
||||
}
|
||||
|
||||
@@ -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: NSManagedObject, toIndexPath indexPath: NSIndexPath)
|
||||
optional func listMonitor(monitor: CSListMonitor, didInsertObject object: AnyObject, toIndexPath indexPath: NSIndexPath)
|
||||
|
||||
/**
|
||||
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: NSManagedObject, fromIndexPath indexPath: NSIndexPath)
|
||||
optional func listMonitor(monitor: CSListMonitor, didDeleteObject object: AnyObject, fromIndexPath indexPath: NSIndexPath)
|
||||
|
||||
/**
|
||||
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: NSManagedObject, atIndexPath indexPath: NSIndexPath)
|
||||
optional func listMonitor(monitor: CSListMonitor, didUpdateObject object: AnyObject, atIndexPath indexPath: NSIndexPath)
|
||||
|
||||
/**
|
||||
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: NSManagedObject, fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath)
|
||||
optional func listMonitor(monitor: CSListMonitor, didMoveObject object: AnyObject, fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class CSObjectMonitor: NSObject, CoreStoreObjectiveCType {
|
||||
/**
|
||||
Returns the `NSManagedObject` instance being observed, or `nil` if the object was already deleted.
|
||||
*/
|
||||
public var object: NSManagedObject? {
|
||||
public var object: AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.object
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public protocol CSObjectObserver: class, AnyObject {
|
||||
- parameter object: the `NSManagedObject` instance being observed
|
||||
*/
|
||||
@objc
|
||||
optional func objectMonitor(monitor: CSObjectMonitor, willUpdateObject object: NSManagedObject)
|
||||
optional func objectMonitor(monitor: CSObjectMonitor, willUpdateObject object: AnyObject)
|
||||
|
||||
/**
|
||||
Handles processing right after a change to the observed `object` occurs
|
||||
@@ -59,7 +59,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: NSManagedObject, changedPersistentKeys: Set<String>)
|
||||
optional func objectMonitor(monitor: CSObjectMonitor, didUpdateObject object: AnyObject, changedPersistentKeys: Set<String>)
|
||||
|
||||
/**
|
||||
Handles processing right after `object` is deleted
|
||||
@@ -68,5 +68,5 @@ public protocol CSObjectObserver: class, AnyObject {
|
||||
- parameter object: the `NSManagedObject` instance being observed
|
||||
*/
|
||||
@objc
|
||||
optional func objectMonitor(monitor: CSObjectMonitor, didDeleteObject object: NSManagedObject)
|
||||
optional func objectMonitor(monitor: CSObjectMonitor, didDeleteObject object: AnyObject)
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
||||
- returns: a new `NSManagedObject` instance of the specified entity type.
|
||||
*/
|
||||
@objc
|
||||
public override func createInto(into: CSInto) -> NSManagedObject {
|
||||
public override func createInto(into: CSInto) -> AnyObject {
|
||||
|
||||
return self.bridgeToSwift.create(into.bridgeToSwift)
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public override func editObject(object: NSManagedObject?) -> NSManagedObject? {
|
||||
public override func editObject(object: NSManagedObject?) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(object)
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public final class CSSynchronousDataTransaction: CSBaseDataTransaction {
|
||||
*/
|
||||
@objc
|
||||
@warn_unused_result
|
||||
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> NSManagedObject? {
|
||||
public override func editInto(into: CSInto, objectID: NSManagedObjectID) -> AnyObject? {
|
||||
|
||||
return self.bridgeToSwift.edit(into.bridgeToSwift, objectID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user