0

In Objective-C,I can use the following command to view the properties of some view objects:

// 1. Sending messages directly to memory addresses
po [0x10daab000 contentInset] 

// 2. or convert to the corresponding type and then send the message.
po [((UITableView *)0x10daab000) contentInset]

But when I develop projects with Swift, I can't do that. When I use this command, Xcode only prints the 0x10daab000 object, as if I were using po 0x10daab000.

Also, I can't access contentInset here using swift-like syntax, i.e. 0x10daab000.contentInset. But I think this is normal.

I think it should be possible to do the same in a Swift project as in an Objective-C project, right? So if anyone knows how to do it, then I would appreciate it.

Rakuyo
  • 390
  • 3
  • 15
  • Have you tried `(0x10daab000 as! UITableView).contentInset`?. Also as far as I know `lipo` is a CLI command to create fat architecture probably in your case is a typo – Andrea Dec 14 '21 at 05:33
  • See [Advanced Debugging with Xcode and LLDB](https://developer.apple.com/videos/play/wwdc2018/412/) for tips on how to use Objective-C syntax in Swift frames. Effectively, you can use `expr` with `-l` to specify language, for define your own command alias in `~/.lldbinit` if you need to do this a lot. – Rob Dec 14 '21 at 05:43

0 Answers0