Checklists, chapter 16, page 372


Working my way through the book. The second project is a lot harder than Bull’s Eye!

I have a problem in chapter 16, where the book says:

➤ Add the prepare(for:sender:) method to AllListsViewController.swift:
// MARK:- Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == “ShowChecklist” {
let controller = segue.destination
as! ChecklistViewController
controller.checklist = sender as? Checklist
} }

When I do this, I get the error “Value of type ‘ChecklistViewController’ has no member ‘checklist’”.

I won’t pretend I understand completely what’s happening in this chapter – I need to go back and redo the entire chapter once I finish, but has anyone else encountered this error?

About a page before that block of code in the tutorial, right below the section title “Setting the title of the screen”, it says:

Add a new instance variable to ChecklistViewController.swift:

var checklist: Checklist!

Thanks! I had done it, but turns out I added it outside of the class.

This topic was automatically closed after 166 days. New replies are no longer allowed.