Chapter 1 - improvement for consistent use of data type

Chapter 1 - improvement for consistent use of data type

Page 20 declares the function argument datatype as UIBarButtonItem
@IBAction func addName(_ sender: UIBarButtonItem) { }

Page 22 defines the function argument datatype as AnyObject
// Implement the addName IBAction
@IBAction func addName(_ sender: AnyObject) { … }

@rogers Thanks very much for your post, and my apologies in the delay in responding. You are correct. On page 22, the code indeed says “AnyObject”, and should be “UIBarButtonItem”. I will inform the book author to let them know so that they make the necessary changes in future editions!

Much appreciated!