The unofficial errata reports for iOS 11 By Tutorials v1.0.
There’s quite a few typos and issues with the v1.0 of the book (including some chapters not being updated for Swift 4.0 syntax when assigning
$1 as default scoped variables for closures with tuples).
One controversial clause I highly advice changing is on page 54.
“You could use the delegate pattern, or update NewsAPI so its methods accept a completion handler, but both of those options tightly couple the API service to the view controller. Instead, you’re going to use KVO to observe when the sources array changes and then respond accordingly. This allows you to loosely couple the NewsAPI and the view controllers consuming its data.”
Excerpt From: By Richard Critz. “iOS 11 by Tutorials.” iBooks.
The excerpt noting that a callback couples with view controllers (let alone encouraging KVO usage for this situation) is a highly false and frowned upon statement. I would advise revisiting this. Newer developers may be enticed to believe this which will lead to bad code being deployed.
This is ignoring the fact that a generic completion of success or failure on an API has any coupling based structure against a view controller or any other class for that matter. This basically just stated that Apple’s networking classes have horrible interfaces.
Thanks @thegamingart for the feedback! I’ve flagged this thread up with the authors to consider for future amendments. Hope you’re enjoying the book
This topic was automatically closed after 166 days. New replies are no longer allowed.