Your Second Swift 4 & iOS 11 App - Part 16: | Ray Wenderlich

One good practice is to keep your model objects out of your view controller. You'll do that in this video by creating your own model class.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4284-your-second-swift-4-ios-11-app/lessons/16

Hello. I’m running into a problem. I have gone back to make sure I have it correct and I do. The issue arises when I start typing " var row0Item = CheckListItem
var row1Item = CheckListItem
var row2Item = CheckListItem
var row3Item = CheckListItem
var row4Item = CheckListItem"
I listened to you and went on to the next section called “override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)” I replaced “row0Checked = !row0Checked” with “row0Item.checked = !row0Item.checked” but its not working on the auto complete and still says “Instance member ‘checked’ cannot be used on type ‘CheckListItem’”

Hey There,

The code in the video defines the type of the CheckListItem as opposed to creating instances. So it should look like the following:

var row1Item: CheckListItem

as opposed to:

var row1Item = CheckListItem

Give that a shot and those errors should go away. Note, the errors won’t go completely away until you implement an initializer.

Cheers!


really? Bone head mistake, sorry and thank you for checking. Working on no sleep is killing me!

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