Better Printing
While debugging, it can be easy to get overloaded with irrelevant and poorly formatted logs in the console. Here are some strategies that can help.
Custom Type Summaries
From: (25:07) WWDC24: Run, Break, Inspect: Explore effective debugging in LLDB | Apple - YouTube
Annotate your types with the @DebugDescription
macro (after Swift 6).1
@DebugDescription
struct WatchLaterItem {
let video: Video
let name: String
let addedOn: Date
var debugDescription: String {
"\ (name) - \(addedOn)"
}
}