-
-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Description
import UIKit
class ViewController: UIViewController {
@IBOutlet var notesTextView: UITextView!
@IBOutlet var titleTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func saveButton(_ sender: Any) {
UserDefaults.standard.set(titleTextField, forKey: "Title")
UserDefaults.standard.set(notesTextView, forKey: "Body")
}
@IBAction func loadNote(_ sender: Any) {
let title = titleTextField.text
print("my title is: \(title!)")
let notes = notesTextView.text
print("my body is: \(notes!)")
titleTextField.text =
UserDefaults.standard.object(forKey:
"Title") as? String
notesTextView.text =
UserDefaults.standard.object(forKey:
"Body") as? String
}
}
i don't know how to fix the problem plz help
Metadata
Metadata
Assignees
Labels
No labels