How can I conform NSSecureCoding in my Core Data entity class

I'm trying to use transformable with my entity class. Is that possible? if so how can i do that?

It's my core data properties code

import Foundation
import CoreData


extension PersonEntity {

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

  @NSManaged public var gender: String?
  @NSManaged public var id: UUID?
  @NSManaged public var name: String?
  @NSManaged public var volunteered: Bool
  @NSManaged public var schedules: NSSet?
}

// MARK: Generated accessors for schedules
extension PersonEntity {

  @objc(addSchedulesObject:)
  @NSManaged public func addToSchedules(_ value: ScheduleEntity)

  @objc(removeSchedulesObject:)
  @NSManaged public func removeFromSchedules(_ value: ScheduleEntity)

  @objc(addSchedules:)
  @NSManaged public func addToSchedules(_ values: NSSet)

  @objc(removeSchedules:)
  @NSManaged public func removeFromSchedules(_ values: NSSet)

}

extension PersonEntity : Identifiable {

}

and it's my core data class

import CoreData

@objc(PersonEntity)
public class PersonEntity: NSManagedObject, NSSecureCoding {
  public static var supportsSecureCoding: Bool = true
   
  enum Key: String {
    case id = "id"
    case name = "name"
    case gender = "gender"
    case volunteered = "volunteered"
  }
   
  init(id: UUID, name: String, gender: String, volunteered: Bool) {
    self.id = id
    self.name = name
    self.gender = gender
    self.volunteered = volunteered

// I'm getting Error here
// Must call a designated initializer of the superclass 'NSManagedObject'
    super.init(entity: , insertInto: )
  }
   
  public func encode(with coder: NSCoder) {
    coder.encode(id, forKey: Key.id.rawValue)
    coder.encode(name, forKey: Key.name.rawValue)
    coder.encode(gender, forKey: Key.gender.rawValue)
    coder.encode(volunteered, forKey: Key.volunteered.rawValue)
  }
   
  required convenience public init?(coder: NSCoder) {
    let decodedId = coder.decodeObject(forKey: Key.id.rawValue)
    let decodedName = coder.decodeObject(forKey: Key.name.rawValue)
    let decodedGender = coder.decodeObject(forKey: Key.gender.rawValue)
    let decodedVolunteered = coder.decodeObject(forKey: Key.volunteered.rawValue)

    self.init(id: decodedId as! UUID, name: decodedName as! String, gender: decodedGender as! String, volunteered: (decodedVolunteered != nil))
  }
}

I'm really new here... sorry

The fundamental challenge with using Codable with Core Data entities is that, when you instantiate an entity, it must be within a current managed object context (and its thread). I have seen lots of articles written by others who tackled the challenge.

e.g. https://medium.com/swlh/core-data-using-codable-68660dfb5ce8 https://medium.com/@andrea.prearo/working-with-codable-and-core-data-83983e77198e https://www.hackingwithswift.com/forums/100-days-of-swiftui/day-61-my-solution-to-make-core-data-conform-to-codable/2434

How can I conform NSSecureCoding in my Core Data entity class
 
 
Q