Debugging Swift Objects in LLDB

Given an address of the object, one can interact with it via LLDB. To do this, you need to import the corresponding module (like UIKit, or your app’s module) and then cast the address to a new variable using Swift’s unsafeBitCast like this:

(lldb) expr -l Swift -- import UIKit
(lldb) expr -l Swift -- let $view = unsafeBitCast(0x7fb75d8349c0, to: UIView.self)

You may also be interested in this SO question. And especially, in the article referenced in one of the answers to the question.

comments powered by Disqus