Develop in Swift Data Collections
Xcode 12
От издателя
Students expand on the knowledge and skills they developed in Develop in Swift Fundamentals by extending their work in iOS app development, creating more complex and capable apps. They’ll work with data from a server and explore new iOS APIs that allow for much richer app experiences—including displaying large collections of data in multiple formats. Three guided app projects help students build an app in Xcode from the ground up with step-by-step instructions. Xcode playgrounds help students learn key programming concepts in an interactive coding environment that lets them experiment with code and see the results immediately. They’ll explore app design by brainstorming, planning, prototyping, and evaluating an app idea of their own.
Отзывы покупателей
Not bad so far but...
Currently at the end of Unit 1. The book itself good so far, but has bug in code for guided ToDo list project. Particularly on page 287 we rewrite our unwindToToDoList method, but do not update “prepare” method in ToDoDetailViewController, because of this each time we edit certain todo, we create a new one, because of nature of Array.firstIndex(of:) method, which depends on equality of elements. We had conform equatable protocol on ToDo model, but on page 283 in prepare method we always create a new ToDo instance which cause brand new id to structure and equality of compared todos fails. For this exact reason we have to override prepare method in ToDoDetailViewController to keep id of edited todo.
TL; DR
on page 287 we need to add updated code for prepare method.
mine is:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
guard segue.identifier == "saveUnwind" else { return }
let title = titleTextField.text!
let isComplete = isCompleteButton.isSelected
let dueDate = dueDatePicker.date
let notes = notesTextView.text
if var foundTodo = todo {
foundTodo.title = title
foundTodo.isComplete = isComplete
foundTodo.dueDate = dueDate
foundTodo.notes = notes
todo = foundTodo
} else {
todo = ToDo(title: title, isComplete: isComplete, dueDate: dueDate, notes: notes)
}
}