Found an issue in Design Patterns by Tutorials, 3rd edition? Post it here!
Hello I found one small issue I haven’t seen others post about. In the Strategy chapter, in the example code for when refactoring the QuestionViewController delegate there is a parameter name that should be changed:
func questionViewController( _ viewController: QuestionViewController, didCancel questionGroup: QuestionStrategy)
should be:
func questionViewController( _ viewController: QuestionViewController, didCancel questionStratgey: QuestionStrategy)
Very small thing, but I thought it was worth pointing out. I really love the book and all this websites content! Keep up the great work at RW!
Chapter 23: Coordinator Pattern, Page 363
Should the name of presentSelectPainLevelCoordinator() method be rather presentSelectPainLevelViewController()?
Chapter 3:
`public final class AddressViewController: UIViewController {
// MARK: - Properties
public var address: Address?
public var addressView: AddressView! {
guard isViewLoaded else { return nil }
return (view as! AddressView)
}
}`
The AddressView should be optional (?) no force unwrapped (!). If we force unwrapped and if it is still nil, the controller will crash. Also because on the next page, we keep unwrapping it before we proceed, so clear indication that it suppose to be an optional property.
private func updateViewFromAddress() {
guard let addressView = addressView,
let address = address else { return }
addressView.streetTextField.text = address.street
addressView.cityTextField.text = address.city
addressView.stateTextField.text = address.state
addressView.zipCodeTextField.text = address.zipCode
}
Design Patter Chapter 3:
Where it says: Select both the red circle image view and the red-colored label… Align and do the following:
- check the box for Horizontal Centers
- Press add 1 constraint
The error is on the actual image because it shows to check the Horizontally in Container instead of Horizontal Center (misleading). If we check the Horizontally in Container, XCode will move both button and label to the center of the screen instead. Same issue with the image with the green-colored label and the button