TheJoyOfHack

For people who like to make things

Running External Commands in LLDB via Python

Many iOS apps today are clients of some sort. They request data from a remote server. Typically this data is served over HTTP (with SSL) and formatted as JSON. At FastModel Sports our iOS app is constantly requesting large amounts of JSON data. While debugging the app I inevitably have to compare what I’m displaying in my views to what the server sent me.

This meant saving the server response into an NSString, printing it out to the console with NSLog, copying that output, switching to Terminal, pasting that output into a file and then running jq on that file. That’s a lot of steps. In this post I’ll show you how to do all of that directly from the LLDB command prompt.

more ...

Rotation and Adaptive Layouts

Another in a series of posts documenting my process of updating an aging app.

For this rewrite of Qur’an Memorizer I’m using Auto Layout. This is the first time I’ve used Auto Layout for this app. You know when the Apple Engineers said Auto Layout makes things easy? They weren’t kidding. Even though Qur’an Memorizer has some unique behaviors for autorotation, I was able to implement this in a few hours with Auto Layout and about 25 lines of code. Read on to see what I did.

more ...

Code Coverage Without Pod Files

Another in a series of posts documenting my process of updating an aging app.

I noticed that the code coverage reports from XCode 8 recently started showing me coverage for .m files that were in the CocoaPods that I’m using. In this post I document how I fixed that.

more ...


Optionals In Swift

I’d like to share with you the way I teach optionals in Swift. I’m pretty sure I’m not the first person who thought of this method, but since I haven’t seen anyone else write this up, I’ve taken it upon myself to do so.

more ...

Performance Improvement with FMDB

Looking out at Hyderabad
Looking out at Hyderabad

When you have to execute SQL statements inside large loops, you may find that your app slows down considerably. In this post I show you one way of improving the performance of your app when database access is the bottleneck.

more ...

Viewing OmniGraffle Files in XCode

When I work on complex iOS apps, I like to diagram the complex relationships between classes and subsystems in OmniGraffle. In this post I’ll show you how to add OmniGraffle files to XCode, view them from within XCode and keep them updated automatically.

more ...

Unit Testing Private Methods with XCode

Now that I’m starting a new iOS development project, I’m trying to have close-to-complete test coverage of critical parts of my code. I’m using XCTest pretty extensively, and found that I needed to test a rather complicated private method that is critical to my app’s user experience. This post shows you how I did it.

more ...


Emotional Changes To The User Interface

Scrabble for iPhone
Scrabble for iPhone

I love word games. I’ve played Scrabble on my iPhone more than 1200 times. Then, a couple of weeks ago they changed their user interface. Now I’m afraid I’ll never play it again. In this post I’ll tell you what I don’t like about the changes, and how I plan to avoid similarly alienating users of my own apps.

more ...