Awesome LLDB Trick

Ever get tired of trying to inspect CGRect values in LLDB?

(lldb) po self.view.bounds
error: property 'bounds' not found on object of type 'UIView *'
error: 1 errors parsing expression

I know, so annoying, right? Fortunately Craig Hockenberry has found a great trick in Xcode to make inspecting UIKit structures easier.

(lldb) expr @import UIKit
(lldb) po self.view.bounds
(origin = (x = 0, y = 0), size = (width = 375, height = 667))
(origin = (x = 0, y = 0), size = (width = 375, height = 667))

Read his article for all the details.


It has been a while since I posted… yeah, this site is kind of a cobweblog… but here is the announcement for my new son! (No, this is not an April Fools joke!)

Dominic Wilson Weis Hart

Black Cat Appreciation Day!

Yesterday was National Black Cat Appreciation Day!  Black cats have a low rate of adoption because of superstition. I’ve also heard it claimed this is because they don’t stand out as well in photographs–but we all know how silly and irrational humans can be (even more so than cats), so I believe it’s because of human foibles and not technical difficulties.

In honor of this day and to highlight the plight of poor, unadopted black cats everwhere, here is my Haiku Deck about Clifton, our silly black cat.

Also: NEVER DECLAW A CAT! If you do I will find you, take your cat from you and give him/her to a human who loves and protects animals instead of one who mutilates them.

Dr. Strangecat – Created with Haiku Deck, presentation software that inspires

CocoaPods > Git Submodules

I must take a moment to recant some comments I made over a year ago about CocoaPods in a post about OCMock.  The first time I came across CocoaPods I thought it was pretty awesome, but then reality set in.  I had problems getting my project configured.  It would sometimes crash with cryptic errors (and still does if you have syntax issues).  I had trouble getting it to work with our continuous integration system.  Then a developer I have much respect for told me to just use Git submodules–it does what CocoaPods tries to do the “right way” I was informed.

Fast forward a year and I have changed my tune.  Git submodules is a reasonable solution to the problem of integrating other projects–but that’s not the primary problem that CocoaPods solves.  The real power of CocoaPods is having a searchable repository of open source frameworks at your fingertips.  In addition, with Git submodules there is usually a messy bit of configuration to do in order to get the framework integrated–and if you decide you don’t want to use it, additionally messy work to remove it.

CocoaPods makes it simple to find and include thousands of open source frameworks into your project.  It does the heavy lifting of dealing with dependencies and integrating into your project.  It works with Xcode’s Bots and Jenkins.  You can even configure it to use a private repository which contains your own frameworks that are not to be distributed to the public.

What’s even cooler? It makes it drop-dead simple to create and distribute a framework for iOS or Mac.

The only thing you need to do is evaluate the quality of the code you’re using.  There’s a lot of stuff out there and not all of it is great.  Buyer beware (the linked article is about Ruby Gems, but applies to all open source code).


Testing Your Software: Or How To Make Changes With Confidence

Writing unit tests is important.  Without unit tests, how do you know that your software still works when someone makes a change?  Sure, you can deploy a small army of manual testers to double-check that it still “works.”  But maybe the change you made has subtle effects in disparate parts of your code–are your testers going to cover everything?

The best way to have confidence that your code is functioning properly is to build and maintain a suite of unit tests.  There are entire books written about this topic (for iOS developers I like Test-Drive iOS Development by Graham Lee), but the most recent issue of covers just this very topic and is a great place to start if you’ve never written tests in Objective C.


Top 10 CoreData Tools

Matthew Morey on the Ray Wenderlich website has written a great post on his top 10 CoreData tools to help make one’s life easier. I’ve written a bunch of code to manage CoreData stacks, make fetch requests, ingest JSON in to CoreData and serialize back into JSON… some of these tools are a big time saver.

One thing I would note though: the author’s own framework (MDMCoreData) looks helpful–but I wouldn’t initialize it on the main thread, as it could take a long time if there is a migration required. You wouldn’t want your app to become unresponsive and get killed with everyone’s favorite 0x8badf00d