I have one last finishing touch on my first app and need some advice.
It is a list view with a detail view. In the detail view there is a UITextView that is pre-populated with content. However it is set up so the user can edit and save changes to that content. I also have a functioning Save button in the navigation bar.
The thing I am trying to do is to disable the Save button until the user actually makes an edit to the text. I have the following code in the view controller for the detail view, but I know it is not exactly right because I am not checking for empty but for changed.
@IBAction func textEditingChanged(_ sender: UITextView) {
updateSaveButtonState()
}
func updateSaveButtonState() {
// let titleText = titleTextField.text ?? ""
let descriptionText = descriptionTextView.text ?? ""
saveButton.isEnabled = !descriptionText.isEmpty
}
Any help in finding a solution to this will be greatly appreciated.
Thanks.