Search code examples
swiftcore-data

Repeating reference to CoreData Entity when debugging object in Swift


I may be simply understanding this incorrectly, but when I created an Exercise entity and looked at it contents in the debugger I get this repeating reference to the Entity type.

enter image description here

The Exercise+CoreDataProperties file is standard:

import Foundation
import CoreData


extension Exercise {

@nonobjc public class func fetchRequest() -> NSFetchRequest<Exercise> {
    return NSFetchRequest<Exercise>(entityName: "Exercise")
}

@NSManaged public var exerciseDuration: Int16
@NSManaged public var repeatNo: Int16
@NSManaged public var restDuration: Int16
@NSManaged public var exerciseName: String
@NSManaged public var id: UUID
@NSManaged public var associatedWorkout: NSSet?

}

// MARK: Generated accessors for associatedWorkout
extension Exercise {

@objc(addAssociatedWorkoutObject:)
@NSManaged public func addToAssociatedWorkout(_ value: WorkoutSet)

@objc(removeAssociatedWorkoutObject:)
@NSManaged public func removeFromAssociatedWorkout(_ value: WorkoutSet)

@objc(addAssociatedWorkout:)
@NSManaged public func addToAssociatedWorkout(_ values: NSSet)

@objc(removeAssociatedWorkout:)
@NSManaged public func removeFromAssociatedWorkout(_ values: NSSet)

}

extension Exercise : Identifiable {

}

And here is the xcdatamodeld config: enter image description here

Any ideas why I cannot view the values of the object in debug mode once I've created it? Have I done something in my code to cause this repetition?


Solution

  • The variables view you're using can't see into the values of properties of managed objects (or of most objects). If you want to inspect the property values, use the debug console. When you're stopped on the line in your screenshot, you should be able to use po newExercise to see properties of newExercise, or you can use commands like po newExercise.exerciseName to see individual property values.