Swift Error Handling and Objective-C Interop in Depth

For the impatient reader:


  • The ErrorType protocol has hidden requirements that are automatically fullfilled if you use an enum to implement the protocol
  • Objective-C methods can only be translated to Swift’s error handling mechanism if they return Objective-C objects or boolean values
  • Swift will invoke the catch block if the Objective-C method returns nil/false, independent of whether an NSError was produced or not
  • If an Objective-C method produces an NSError and returns a value the catch blocks is not invoked and the error cannot be retrieved
  • GitHub project with examples


Switching iOS devices and the Keychain

Unfortunately some of my MovieLoggr users ran into the following issue: After switching to a new phone and restoring it from a Backup MovieLoggr would behave unexpectetly (and in some cases crash) because the App could no longer access the user’s password and unfortunately did not handle this gracefully.


Using SSH for private and work account on a Mac

Disclaimer: I’m not a huge fan of configuring software; I’m primarily writing this to remember it for the future.

Using SSH instead of HTTPS to authenticate against services such as GitHub, Bitbucket or Heroku is very convenient, instead of typing a password for every interaction Mac OS simply exchanges SSH keys behind the scene. However, one can run into trouble when trying to use multiple accounts of the same service with SSH authentication.


The downside of Web APIs

Web APIs have done a lot for the world of technology. Services that have formerly been isolated islands can now be connected through a few simple HTTP Requests. Posting to Facebook on every GitHub commit? Printing a Postcard as soon as a new Photo is uploaded to a Dropbox folder? Basically anything is possible through Web Services.


Arithmetic Expressions in Swift

While I still cannot fully understand how the release of a new programming language didn’t leak before WWDC, most of us got surprised by the announcement of Apple’s new Programming Language Swift.

Like most iOS Developers I immediately took a look at the new language. Most language details seem fairly straightforward - however, arithmetic expressions were the first small pitfall for me.