Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Post Undeleted by Frankie
Post Deleted by Frankie
added 140 characters in body
Source Link
Frankie
  • 11.9k
  • 7
  • 59
  • 62

You're setting the defaults but you're not reading back out of it:

if let string = UserDefaults.standard.object(forKey: "myKey") as? String { textext.text = string } 

Or as pointed out, since the textfields text is optional:

textext.text = UserDefaults.standard.object(forKey: "myKey") as? String 

You're setting the defaults but you're not reading back out of it:

if let string = UserDefaults.standard.object(forKey: "myKey") as? String { textext.text = string } 

You're setting the defaults but you're not reading back out of it:

if let string = UserDefaults.standard.object(forKey: "myKey") as? String { textext.text = string } 

Or as pointed out, since the textfields text is optional:

textext.text = UserDefaults.standard.object(forKey: "myKey") as? String 
Source Link
Frankie
  • 11.9k
  • 7
  • 59
  • 62

You're setting the defaults but you're not reading back out of it:

if let string = UserDefaults.standard.object(forKey: "myKey") as? String { textext.text = string }