Chapter 13 Confusion about the source code

HI, I am new in swift. I first notice that on page 301 there is a screenshot showing a few lines of code, however, the code is different from the previous chapters and has no explanation. In Chapter 13 Source Code files, in ChecklistViewcontroller, the code looks like this:

What does the code mean here? required init and NSCoder? Thank you for whoever can help me with this!

In the PDF version of the book, page 301 is the first page of Chapter 13 and I don’t see the screenshot you mention. Can you please provide the correct page number or the section name so that I can find out which screenshot you’re talking about?

Thank you for replying to me. The screenshot I mentioned is in Chapter 13, under a subtopic named “Conform to the delegate protocol”. page 301 is the number for the paperback version of the book.

It looks as if this might be an error with the book since I don’t see this in the PDF version and I don’t have access to a copy of the book to check. If you have access to the PDF version, I’d suggest comparing the book and the PDF version to see if they are the same?

required init?(coder aDecoder: NSCoder) {...

was used in version 6 of IOS Apprentice to setup the test array, but not in the current version 7, which does it in viewDidLoad. (I can tell because I have both.)

It was introduced in chapter 10, under “Initialize Objects”.

Is it possible you have version 7 of the book, but version 6 of the source code?

I downloaded the source code from the link provided in the book which is the Seventh Edition. Maybe the code has not been updated yet.

Thanks for the suggestion

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