Reader-submitted Objective-C / XCode tips of 2012
11–20 of 22 posts
Re: Reader-submitted Objective-C / XCode tips of 2012
#12For clarification, this is a list of some reader-submitted tricks and tips from the last month, as a way to bring in the New Year. I'm looking forward to doing more of these in the future, so if anyone has any ideas or suggestions, feel free to tweet them to @NSHipster. Thanks!
Hey Matt, I have some amazing tricks for you but I want to save it for a Cocoaheads talk first. :-) We should get around to doing another. Reimplementing the runtime and foundation and hacking on our Clang fork at Apportable the last 6 months, I've learned some amazingly interesting things.
Also, on the tricks front: I was proxying UITableViews to override their layout before UICollectionViews were cool :)
Re: Reader-submitted Objective-C / XCode tips of 2012
#13Displaying his characteristic brilliance and familiarity of Cocoa internals Cédric Luthi submitted a reverse-engineered implementation of the NString equality methods. Fascinating! Forgive my ignorance, but how do you go about and reverse engineer NSString equality? Looking at the code is interesting but what I'd really like to understand is where it comes from and how it was extracted; is it supposed to be close to…
Re: Reader-submitted Objective-C / XCode tips of 2012
#14The LLDB View Hierarchy Dump tip is something that I think I can use again and again and again.
(lldb) po [self.view recursiveDescription]
from one of your view controllers to dump the hierarchy of that view. This of course will work on any object that is a subclass of UIView, such as a UITableView (subclass of UIScrollView, which is in turn a subclass of UIView), a UITableViewCell (directly inherited from UIView), etc.There's a lot of good information provided by Apple on debugging here: http://developer.apple.com/library/ios/#technotes/tn2239/
It's definitely worth the time to go through it all if you spend any time debugging iOS code (and there's a Mac OS X equivalent but I can't speak for its usefulness).
I've also started writing a little piece on debugging code with lldb and Xcode, but it's a work in progress: https://gist.github.com/3943317
Re: Reader-submitted Objective-C / XCode tips of 2012
#15The LLDB View Hierarchy Dump tip is something that I think I can use again and again and again.
I mentioned this to Mattt on Twitter but I don't think he saw it. There's a lot you can do at the debugger and recursiveDescription can be called on any UIView or UIView subclass. So if you set a breakpoint you can do something like: (lldb) po [self.view recursiveDescription] from one of your view controllers to dump the hierarchy of that view. This of course will work on any object that is a subclass of UIView, such…
Re: Reader-submitted Objective-C / XCode tips of 2012
#16Displaying his characteristic brilliance and familiarity of Cocoa internals Cédric Luthi submitted a reverse-engineered implementation of the NString equality methods. Fascinating! Forgive my ignorance, but how do you go about and reverse engineer NSString equality? Looking at the code is interesting but what I'd really like to understand is where it comes from and how it was extracted; is it supposed to be close to…
Re: Reader-submitted Objective-C / XCode tips of 2012
#17The LLDB View Hierarchy Dump tip is something that I think I can use again and again and again.
Typing “rd” by itself does “po [[UIApp keyWindow] recursiveDescription]”, so it dumps your entire on-screen view hierarchy.
Typing “rd someview” does “po [someview recursiveDescription]”, so it dumps the view hierarchy starting at a specific view.
For Mac (Cocoa) apps, the equivalent message is _subtreeDescription, but since a window is not a view, the entire-hierarchy command needs to be “po [[[NSApp frontWindow] contentView] _subtreeDescription]”.
Re: Reader-submitted Objective-C / XCode tips of 2012
#18Re: Reader-submitted Objective-C / XCode tips of 2012
#19Re: Reader-submitted Objective-C / XCode tips of 2012
#20For clarification, this is a list of some reader-submitted tricks and tips from the last month, as a way to bring in the New Year. I'm looking forward to doing more of these in the future, so if anyone has any ideas or suggestions, feel free to tweet them to @NSHipster. Thanks!
Hey Matt, I have some amazing tricks for you but I want to save it for a Cocoaheads talk first. :-) We should get around to doing another. Reimplementing the runtime and foundation and hacking on our Clang fork at Apportable the last 6 months, I've learned some amazingly interesting things.