mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-25 02:41:10 +01:00
keyPath utilities for SectionBy clauses
This commit is contained in:
@@ -36,7 +36,7 @@ import CoreData
|
||||
*/
|
||||
@available(OSX 10.12, *)
|
||||
@objc
|
||||
public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
public final class CSSectionBy: NSObject {
|
||||
|
||||
/**
|
||||
Initializes a `CSSectionBy` clause with the key path to use to group `CSListMonitor` objects into sections
|
||||
@@ -47,7 +47,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
@objc
|
||||
public static func keyPath(_ sectionKeyPath: KeyPathString) -> CSSectionBy {
|
||||
|
||||
return self.init(SectionBy(sectionKeyPath))
|
||||
return self.init(SectionBy<NSManagedObject>(sectionKeyPath))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
@objc
|
||||
public static func keyPath(_ sectionKeyPath: KeyPathString, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> CSSectionBy {
|
||||
|
||||
return self.init(SectionBy(sectionKeyPath, sectionIndexTransformer))
|
||||
return self.init(SectionBy<NSManagedObject>(sectionKeyPath, sectionIndexTransformer))
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +74,11 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
|
||||
// MARK: CoreStoreObjectiveCType
|
||||
|
||||
public let bridgeToSwift: SectionBy
|
||||
public let bridgeToSwift: SectionBy<NSManagedObject>
|
||||
|
||||
public init(_ swiftValue: SectionBy) {
|
||||
public init<D>(_ swiftValue: SectionBy<D>) {
|
||||
|
||||
self.bridgeToSwift = swiftValue
|
||||
self.bridgeToSwift = swiftValue.downcast()
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public final class CSSectionBy: NSObject, CoreStoreObjectiveCType {
|
||||
// MARK: - SectionBy
|
||||
|
||||
@available(OSX 10.12, *)
|
||||
extension SectionBy: CoreStoreSwiftType {
|
||||
extension SectionBy {
|
||||
|
||||
// MARK: CoreStoreSwiftType
|
||||
|
||||
@@ -95,4 +95,12 @@ extension SectionBy: CoreStoreSwiftType {
|
||||
|
||||
return CSSectionBy(self)
|
||||
}
|
||||
|
||||
|
||||
// MARK: FilePrivate
|
||||
|
||||
fileprivate func downcast() -> SectionBy<NSManagedObject> {
|
||||
|
||||
return SectionBy<NSManagedObject>(self.sectionKeyPath, self.sectionIndexTransformer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user