Init instead of viewDidLoad in chapter 10

hi thx for the very great book

really RW books are high quality books ever

why in ch10 the checkItems array initialized in init not viewDidLoad func ??

  required init?(coder aDecoder: NSCoder) {
    items = [ChecklistItem]()

let row0item = ChecklistItem()
row0item.text = "Walk the dog"
row0item.checked = false

let row1item = ChecklistItem()
row1item.text = "Brush my teeth"
row1item.checked = true

let row2item = ChecklistItem()
row2item.text = "Learn iOS development"
row2item.checked = true

let row3item = ChecklistItem()
row3item.text = "Soccer practice"
row3item.checked = false

let row4item = ChecklistItem()
row4item.text = "Eat ice cream"
row4item.checked = true

super.init(coder: aDecoder)


override func viewDidLoad() {
	// Do any additional setup after loading the view, typically from a nib.

It’s mostly just a matter of preference - you can do it in either place.

1 Like

Th x very much dear …

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