My text right now saves the textfield in a uiviewcontroller but when a go to the previous view controller than back to the original view controller the text is erased. How can I save the text so that when the text is entered and saved the text stays their.
import UIKit class tryingViewController: UIViewController { @IBOutlet weak var textext: UITextField! @IBAction func actionaction(_ sender: Any) { textext.resignFirstResponder() let myText = textext.text UserDefaults.standard.set(myText, forKey: "myKey") } }