mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-18 23:17:02 +01:00
added utility to inspect NSEntityDescription for a given NSManagedObject type
This commit is contained in:
@@ -150,7 +150,7 @@ internal extension NSManagedObjectModel {
|
||||
return self.entityNameMapping[NSStringFromClass(entityClass)]!
|
||||
}
|
||||
|
||||
@nonobjc internal func entityMapping() -> [String: NSManagedObject.Type] {
|
||||
@nonobjc internal func entityTypesMapping() -> [String: NSManagedObject.Type] {
|
||||
|
||||
return self.entityNameMapping.reduce([:]) { (var mapping, pair) in
|
||||
|
||||
|
||||
@@ -84,9 +84,20 @@ public final class DataStack {
|
||||
/**
|
||||
Returns the entity name-to-class type mapping from the `DataStack`'s model.
|
||||
*/
|
||||
public var entitiesByName: [String: NSManagedObject.Type] {
|
||||
public var entityTypesByName: [String: NSManagedObject.Type] {
|
||||
|
||||
return self.model.entityMapping()
|
||||
return self.model.entityTypesMapping()
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the `NSEntityDescription` for the specified `NSManagedObject` subclass.
|
||||
*/
|
||||
public func entityDescriptionForType(type: NSManagedObject.Type) -> NSEntityDescription? {
|
||||
|
||||
return NSEntityDescription.entityForName(
|
||||
self.model.entityNameForClass(type),
|
||||
inManagedObjectContext: self.mainContext
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user