Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 8f2ef0e

Browse files
committed
Rename RelationType.RelatedById to Reference
1 parent 6a75bff commit 8f2ef0e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CoreDataKit/Importing/NSManagedObject+Importing.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ extension NSManagedObject
152152
let importableValue = relationship.preferredValueFromDictionary(dictionary)
153153

154154
switch relationship.relationType {
155-
case .RelatedById:
156-
return performImportRelatedByIdRelationship(relationship, importableValue: importableValue, destinationEntity: destinationEntity)
155+
case .Reference:
156+
return performImportReferenceRelationship(relationship, importableValue: importableValue, destinationEntity: destinationEntity)
157157

158158
case .Embedding:
159159
return performImportEmbeddingRelationship(relationship, importableValue: importableValue, destinationEntity: destinationEntity)
@@ -164,15 +164,15 @@ extension NSManagedObject
164164
}
165165
}
166166

167-
private func performImportRelatedByIdRelationship(relationship: NSRelationshipDescription, importableValue: ImportableValue, destinationEntity: NSEntityDescription) -> Result<Void> {
167+
private func performImportReferenceRelationship(relationship: NSRelationshipDescription, importableValue: ImportableValue, destinationEntity: NSEntityDescription) -> Result<Void> {
168168
switch importableValue {
169169
case let .Some(value as [String: AnyObject]):
170170
return managedObjectContext!.importEntity(destinationEntity, dictionary: value).flatMap {
171171
self.updateRelationship(relationship, withValue: $0, deleteCurrent: false)
172172
}
173173

174174
case let .Some(value as [AnyObject]):
175-
let error = NSError(domain: CoreDataKitErrorDomain, code: CoreDataKitErrorCode.UnimplementedMethod.rawValue, userInfo: [NSLocalizedDescriptionKey: "Multiple referenced / nested relationships not yet supported with relation type \(RelationType.RelatedById)"])
175+
let error = NSError(domain: CoreDataKitErrorDomain, code: CoreDataKitErrorCode.UnimplementedMethod.rawValue, userInfo: [NSLocalizedDescriptionKey: "Multiple referenced / nested relationships not yet supported with relation type \(RelationType.Reference)"])
176176
return Result(error)
177177

178178
case let .Some(value):

CoreDataKit/Importing/NSRelationshipDescription+Importing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension NSRelationshipDescription {
1212

1313
/// Type of the relation as defined in the model
1414
var relationType: RelationType {
15-
let fallbackRelationType = RelationType.RelatedById
15+
let fallbackRelationType = RelationType.Reference
1616

1717
if let relationTypeString = userInfo?[RelationTypeUserInfoKey] as? String {
1818
if let relationType = RelationType(rawValue: relationTypeString) {

CoreDataKit/Importing/Types+Importing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let RelationTypeUserInfoKey = "CDKRelationType"
4141
/// Values used with RelationTypeUserInfoKey to alter relation type
4242
enum RelationType: String {
4343
/// Relation that is referenced by a primary key like ID
44-
case RelatedById = "CDKRelatedById"
44+
case Reference = "CDKReference"
4545

4646
/// Relation that doesn't use a ID of some sort
4747
case Embedding = "CDKEmbedding"

0 commit comments

Comments
 (0)