How to Generate Beautiful Apple-Style Documentation in Xcode 5

Good code should be self-documenting, but sometimes you also need to generate external documentation for reference purposes. In this post I’ll show you how to use two open-source tools and a build script to create beautiful, Apple-style HTML documentation files in Xcode. I’ll also show you how to create docsets for Xcode so that your class references show up right along side Apple’s! It will be a seamless and dare I say, enjoyable, process for generating documentation.

Continue reading

How to Get Back the iOS 6 SDK After Upgrading to Xcode 5

iOS 7 finally launched on September 18, and with it, the public release of Xcode 5. However, after upgrading you will notice that you can no longer compile using the iOS 6.1 base SDK. This is a problem for any app that isn’t yet compatible with the iOS 7 SDK. To see what SDK’s you have installed, open the Terminal app on your Mac and enter:

ls /Applications/

If you only see the iOS7 SDK folder listed, you will need to extract the iOS6 SDK folder from an old copy of Xcode 4.6. Or you can just download it here. Copy your extracted iPhoneOS6.1.sdk folder into the folder shown above. Shut down and restart Xcode. You will then be able to select from both SDK’s when building or running.

If you just need to download the iOS 6 simulator, open Xcode and go to Xcode > Preferences > Downloads.

Editable UITableViewController


A common use case in iOS is creating a form or an editable list of records directly inside a UITableView. We could send the user to a separate “detail” view controller for editing, but that complicates and slows down the user experience. In this post, I’ll show you how to create your own subclass of UITableViewController that can support any number of UITextFields inside your table cells and use them to update any backing data source. This code can then be reused in any project that needs an editable table view!

Continue reading

Why NSNotificationCenter is Bad


A lot of talk about good coding practices centers around the idea of loose coupling. That is, writing classes that interact based on behavior, not by identity. If class A needs to interact with class B, it should do so on the basis of what class B does, not because of what it is. That way we can easily swap out class B for another one that behaves the same and not worry about breaking class A. This makes our applications easier to maintain and update. Continue reading

How to Swap Two Variables Without Using a Temp Variable


With all the high-level languages in widespread use today, it is often easy to forget that at the end of the day, everything boils down to binary: ones and zeroes. This is shielded from us via multiple layers of abstraction. There is nothing wrong with using these abstractions; they have made great modern-day development possible. At the same time, they conceal some of the more intriguing quirks that are inherent in the binary system. This includes bitwise operations, and specifically an operation called a bitwise swap. This is a very efficient operation that can exchange the values of two variables of the same type without using an intermediary variable, and looks like this in C:

Continue reading

The Great Pointer Syntax Debate


In Objective-C and other C-based languages, pointers are declared using the asterisk character. So, to declare a pointer to a UIView object called foo, in most examples and documentation you will see:

Continue reading

Double Pointers in Objective-C


Ah, pointers. Nothing strikes more fear into the heart of novice C programmers, or developers who aren’t used to them. Add to that the notion of double pointers (**) and address-of operators (&) and you are pretty much guaranteed to scare them away. But they are really not that hard, as long as you understand 3 things:

Continue reading

What is a Business Logic Layer Anyway?


Most developers are familiar with the concept of N-Tier Architecture. It is a software pattern that separates components of an application into separate logical layers to establish code boundaries, promote flexibility, and allow reuse. Most commonly this is accomplished using 3 layers:

Continue reading

Why Static Code is Bad


Most object-oriented developers are familiar with static methods and classes. They are present in most programming languages including C# and Objective-C (where they are known as class methods). Here are some common cases in which they are used: Continue reading

Definition of a Great Agile Company


Last night I attended the inaugural meetup of the Great Agile Companies of NYC group at AppNexus‘ beautiful headquarters in New York. The event was moderated by Josh Grob, a member of AppNexus’ Agile Strategy & Execution team, with the intent of open-sourcing the definition for what it means to be a great Agile company. AppNexus’s own Agile team is less than a year old and has quickly grown to 11 full-time scrum masters. With over 500 developers building the company’s flagship online ad auctioning platform, the need for a dynamic and scalable software development process has never been stronger.

Continue reading