Debugging Basics
The simplest debugging uses the console. Interpreting the information provided in the console when an application crashes or intentionally logging information to the console allows you to observe and zero in on your code’s failures. Let’s look at some examples of how the console can support your quest for bug-free code.
Interpreting console messages
Time to add some mayhem to the Buggy project. Suppose that after considering the UI for a while, you decide that a switch would be a better control than a button. Open ViewController.swift and make the following changes to the buttonTapped(_:) method.
@IBAction func buttonTapped(_ sender: UIButton) {@IBAction func switchToggled(_ sender: UISwitch) { print("Called ...
Get iOS Programming: The Big Nerd Ranch Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.