Xcode and LLDB – Print Frame and Bounds

Until recently, printing the bounds or frame of a view with LLDB required more effort than seemed necessary. However…

Craig Hockenberry:

“Buried deep within the Xcode 6.3 release notes there is a true gem that can relieve this daily frustration.”

That gem is an @import statement which paves the way for code like this:

// Before
(lldb) p (CGRect) [self frame]
(CGRect) $0 = (origin = (x = 0, y = 0), size = (width = 50, height = 100))
 
// After
(lldb) expr @import UIKit
(lldb) p self.frame
(CGRect) $1 = (origin = (x = 0, y = 0), size = (width = 50, height = 100))