April 2026
Intermediate
683 pages
25h 29m
English
Despite the availability of various debug techniques and Xcode tools, printing out values may be the most practical choice in some cases. In this approach, the programmer resorts to printing out values of variables to understand the state of the app.
For this, Swift offers several commands to send information to the console.
It’s possible to demonstrate all those commands at once. For this purpose, we will use the sample code in Listing B.5, in which each command is called sequentially.
struct Person { let name: String let age: Int}let person = Person(name: "Kerem", age: 30)print(person, terminator: "\n\n")debugPrint(person, terminator: "\n\n")dump(person)
Listing B.5 Demonstration of Debug Support Commands
The output ...
Read now
Unlock full access