2024 SwiftDeveloper Tools
WWDC24 · 29 min · Swift / Developer Tools
Run, Break, Inspect: Explore effective debugging in LLDB
Learn how to use LLDB to explore and debug codebases. We’ll show you how to make the most of crashlogs and backtraces, and how to supercharge breakpoints with actions and complex stop conditions. We’ll also explore how the “p” command and the latest features in Swift 6 can enhance your debugging experience.
Watch at developer.apple.com ↗Chapters
Code shown on screen · 5 snippets
WatchLater button
Button(action: { watchLater.toggle(video: video) }) {
let inList = watchLater.isInList(video: video)
Label(inList ? "In Watch Later" : "Add to Watch Later",
systemImage: inList ? "checkmark" : "plus")
} Printing watch later list information
p watchLater.count
p watchLater.last!.name Breakpoint actions: Printing name of the most recently added video
p "last video is \(watchLater.last?.name)" Breakpoint actions: on the command line
b DetailView.swift:70
break command add
p "last video is \(watchLater.last?.name)"
continue
DONE @DebugDescriptio macro example
// Type summaries
struct WatchLaterItem {
let video: Video
let name: String
let addedOn: Date
var debugDescription: String {
"\(name) - \(addedOn)"
}
} Resources
Related sessions
-
37 min -
14 min