Swift , CoreData not inserting a record. : I have a function which errors where marker // ERRORS HERE


The db is empty, I try to append a Persistence record, then set its values,

  tasks[0].persistencevalue = "Some Text"!

Any help would be appreciated.

Thanks

The stack shows :

    2017-08-18 10:09:07.158047+0100 Ontrack[6491:1684506] [error] error:      CoreData: error: Failed to call designated initializer on NSManagedObject class 'Persistence'
    CoreData: error: CoreData: error: Failed to call designated initializer on NSManagedObject class 'Persistence' 

    2017-08-18 10:09:08.678 Ontrack[6491:1684506] -[Persistence   setPersistencevalue:]: unrecognized selector sent to instance 0x60800026a040
    2017-08-18 10:09:08.681 Ontrack[6491:1684506] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Persistence setPersistencevalue:]: unrecognized selector sent to instance 0x60800026a040'

===========================================================================



     
    func Update() {
            
            let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
            let app = (UIApplication.shared.delegate as! AppDelegate )
            
            
            var tasks: [ Persistence] = []
        

                let pers = Persistence()
                
                tasks.append(pers)
                cnt = tasks.count
    // ERRORS HERE 
                tasks[0].persistencevalue = Rate.text!
    // END ERROR
    
  
        }
  