Read core data. The basic simple code

I have created some data from UITextField name and password. It works well. I have problems to make the same with Read. For instance select from Core Data the Attribute name of John and Read (print) its password. I just want the most basic solution like the example here with create. Can anyone help me?

// CREATE
@IBAction func createButton(_ sender: UIButton) {
    guard name.hasText && password.hasText else {
        return
    }
    
    let user = Users(context: context)
    user.name = self.name.text!
    user.password = self.password.text!
    do {
        try context.save()
        print ("saved")
        print (self.name.text!)
    } catch {
        print(error)
    }
}

@IBAction func readButton(_ sender: UIButton) {
   // The solution here
}

@narcis Do you still have issues with this?

This topic was automatically closed after 166 days. New replies are no longer allowed.