# Tutorial 2: Checklists p. 136-138

**URL:** <https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389>\
**Category:** iOS Apprentice\
**Created:** [November 28, 2016, 8:23pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389 "2016-11-28T20:23:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![beijkido](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/beijkido/32/57458_2.png) [@beijkido](https://forums.kodeco.com/u/beijkido)\
**Post date:** [November 28, 2016, 8:23pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/1 "2016-11-28T20:23:15Z")

</div>

Hi, I’m working on the Checklists app and I’m getting these errors;  
import Foundation

class ChecklistItem: NSObject, NSCoding { **Type ‘ChecklistItem’ does not conform to protocol ‘NSCoding’**

```
var text = ""
var checked = false

```

func toggleChecked() {  
checked = !checked  
}  
func encodeWithCoder(aCoder: NSCoder) {  
aCoder.encodeObject(text, forKey: “Text”) **‘encodeObject(_:forKey:)’ has been renamed to 'encode(_:forKey:)’**  
aCoder.encodeBool(checked, forKey: “Checked”) **‘encodeBool(_:forKey:)’ has been renamed to 'encode(_:forKey:)’**  
}

```
required init?(coder aDecoder: NSCoder) {
    super.init()
}

override init() {
    super.init()
}

```

}

This is my code (the bold sentences are the errors I get…)  
I have the newer version of XCode, is this the problem?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![narrativium](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/narrativium/32/110937_2.png) [@narrativium](https://forums.kodeco.com/u/narrativium)\
**Post date:** [November 29, 2016, 12:09am UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/2 "2016-11-29T00:09:55Z")

</div>

Yes. Some of the Foundation types and functions have been renamed in Swift 3, and Xcode can frequently tell you what the more up to date names are for the functions you’re using. (You may have to use a bit of judgement to get the right result).

I think as far as we’re concerned, the question is ‘are you using the most up to date version of the book?’, because we may have to make corrections on the book! So if you do spot more things like this let us know.

---

<div class="post-metadata">

**Author:** ![beijkido](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/beijkido/32/57458_2.png) [@beijkido](https://forums.kodeco.com/u/beijkido)\
**Post date:** [November 29, 2016, 6:59am UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/3 "2016-11-29T06:59:55Z")

</div>

Yeah, I’ve got the latest version of the book… But do you have an idea how to solve these errors?

---

<div class="post-metadata">

**Author:** ![fr33rid3r](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fr33rid3r/32/79544_2.png) [@fr33rid3r](https://forums.kodeco.com/u/fr33rid3r)\
**Post date:** [November 29, 2016, 8:20am UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/4 "2016-11-29T08:20:19Z")

</div>

You need to edit the method names which have been renamed.  
You can’t continue using **aCoder.encodeObject(text, forKey: “Text”)** Change encodeObject to encode.

As for the NSCoding error, you need to read the book!  
You have told ChecklistItem it conforms to the NSCoding protocol, but possibly haven’t provided it with the methods it requires.

---

<div class="post-metadata">

**Author:** ![hollance](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/hollance/32/109009_2.png) [@hollance](https://forums.kodeco.com/u/hollance)\
**Post date:** [November 29, 2016, 12:45pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/5 "2016-11-29T12:45:42Z")

</div>

I don’t think you have the latest version of the book. The latest version is v5.0 and all the methods have been renamed for Swift 3 in this edition.

If you’re a PDF customer, then go to [www.raywenderlich.com/loot](http://www.raywenderlich.com/loot) to download the latest version.

---

<div class="post-metadata">

**Author:** ![beijkido](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/beijkido/32/57458_2.png) [@beijkido](https://forums.kodeco.com/u/beijkido)\
**Post date:** [November 29, 2016, 12:48pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/6 "2016-11-29T12:48:31Z")

</div>

Thanks!  
I changed the removed the Object piece and it worked…

For the NSCoding error I had to add the bold bit…

class ChecklistItem: NSObject, NSCoding {  
**public func encode(with aCoder: NSCoder) {**

* * *

\*\* }\*\*

```
var text = ""
var checked = false

```

---

<div class="post-metadata">

**Author:** ![beijkido](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/beijkido/32/57458_2.png) [@beijkido](https://forums.kodeco.com/u/beijkido)\
**Post date:** [November 29, 2016, 12:49pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/7 "2016-11-29T12:49:23Z")

</div>

I’ve gotten the latest version (v5.0) of the Checklists tutorial… But I already figured out how to fix it 🙂

---

<div class="post-metadata">

**Author:** ![noah8610](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/noah8610/32/81494_2.png) [@noah8610](https://forums.kodeco.com/u/noah8610)\
**Post date:** [December 15, 2018, 4:14pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/8 "2018-12-15T16:14:07Z")

</div>

Hi,  
On Which page did you find the below code?  
required init?(coder aDecoder: NSCoder) {  
super.init()  
}

override init() {  
super.init()  
}

Regards

Tibor

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 9, 2019, 10:40pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/9 "2019-01-09T22:40:28Z")

</div>

@noah8610 Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![noah8610](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/noah8610/32/81494_2.png) [@noah8610](https://forums.kodeco.com/u/noah8610)\
**Post date:** [January 13, 2019, 7:34pm UTC](https://forums.kodeco.com/t/tutorial-2-checklists-p-136-138/23389/10 "2019-01-13T19:34:03Z")

</div>

Hi, I just wanted to read about it in the book, but the book version is using Codable protocol, which was introduced in Swift 4. I thought if I download the book which used Swift 3, then I thought I find more info about NSCoder System and I was right 🙂 I found satisfying amount of info there.  
Anyone needs more info just download the version using Swift 3…  
Many thanks!
