Error when trying to save a array to coreData

I am trying to save whatever is in the array arrayOfInt to coreData. The code builds and runs but whenever I try to submit entries the runtime error comes up.

    import UIKit
   import CoreData

    class ViewController: UIViewController {
   @IBOutlet var txt: UITextField!
 var arrayOfInt = [Int]()


@IBAction func submit(_ sender: Any) {
if let text = txt.text {
    if let number = Int(text){
        arrayOfInt.append(number)
        let appdeleaget = UIApplication.shared.delegate as! AppDelegate
        let context = appdeleaget.persistentContainer.viewContext
        let NewUser = NSEntityDescription.insertNewObject(forEntityName: "Users", into: context)
        NewUser.setValue(arrayOfInt, forKey: "userName")

        do {
            try context.save()
            print(NewUser)

        }
        catch {
            //
        }

    }}}

}