I'm not sure how to save a title from a textfield into Realm. CurrentNote and note are both from Note, a swift file with dynamic vars including title.
func saveNote() {
currentNote = Note()
note = currentNote
if let note = note {
let realm = Realm()
var index = tableView[]
var changingNote:Note = Note()
changingNote.title = index
realm.write{
realm.add(note)
self.notes = realm.objects(Note)
}
}
tableView.reloadData()
}
Could something like the following work?
func saveNote(noteIndex: Int) {
let note = notes[noteIndex]
note.realm.write {
note.title = TITLE
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.