How to Check if You're Running on the Simulator in Swift

I spend a lot of my time developing iOS apps that work with our web applications. When I run the app in the simulator I want it to talk to the copy of that web application that's running on my development machine and when I run it on a device (or issue a beta build) it should talk to the staging server. Unfortunately, This isn't as simple in Swift as it is in Objective C.

Read more…

Trim a String in Swift

I needed to trim whitespace from some user input in a Swift app I'm working on. I could have used the ability to bridge to NSString and called `stringByTrimmingCharactersInSet:` but doing it in Swift seemed like a fun little exercise.

Read more…

Simple Auto Layout in Swift

I haven't had much time to spend with Swift lately but with the release of Swift 1.2 it seemed like a good time to refresh my memory. I have one (very unfinished) project written entirely in Swift that helps me keep track of the changes in the language. This project has come to the point where I can no longer rely on storyboards and nibs for layout so the time had come to look seriously at writing Auto Layout code in Swift.

Read more…

Free as in Baby

I've been meaning to write this post but Daniel Compton beat me to it. "It takes a village to raise a library" and "free as in 'baby'" are too perfect not to repeat.

Read more…

OnePad Finally Updated

OnePad 1.4 is mostly me playing catch-up. The UI has been iOS 7-ified, it has 50% less capitol letters in the name and 100% less skeuomorphism in the icon. I did have a chance to add a few new features though.

Read more…

Two Great Programming Videos

I want to share a couple of exceptional software programming talks that I've watched recently. They are both engaging, and if you're anything like me, will likely challenge many of your assumptions while enforcing other suspicions about the "right" way to write software.

Read more…

Get Your Free Build Numbers Here

You'd think something as simple as an automatically incrementing build number would be a solved problem by now. Instead it seems to be one of those areas where everyone has their own workaround. At least for those of us not blessed, or cursed, with a monolithic shared build system. For Cocoa apps the build number is also known as a `CFBundleVersion` and it's a very useful thing for lining up bug reports with exact points in your code history.

Read more…

First Class Functions and Delayed Evaluation in Swift

Functions are first-class citizens in Swift. They can be stored in a variable or constant, passed to another function as a parameter, or returned as the result of another function. This concept of "functions as data" enables the development of complex systems composed of small bits of reusable logic in an elegant and concise way.

Read more…