0

I am working a Swift homework assignment, where when I click on a button, the user text moves to the label. For some reason, it is not working. I also have this exception error here:

Exception NSException * "[<HelloWorld.ViewController 0x160b08920> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key button." 0x0000600003b2e760

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }

    @IBOutlet var textLabel: UILabel!
    
    @IBOutlet var textField: UITextField!
    
    
    @IBAction func moveText(_ sender: Any) {
        textLabel.text = textField.text
        textField.text = ""
    }
    
}

Phone app

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • When you get an error like this, search for the text of the [error message in quotes](https://stackoverflow.com/search?q=“this+class+is+not+key+value+coding-compliant+for+the+key”) – Rob Apr 17 '23 at 20:43
  • check for IBOutlet, sure there is binding deleted from the storyboard. – Gagan_iOS Apr 17 '23 at 22:09

0 Answers0