For the impatient reader:
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
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
A couple of months ago I was faced with an issue that was fairly hard to debug:
Back in April I gave a talk at NSMeetup in San Francisco on Functional Reactive Programming on iOS.
Today, while trying to implement a generic data source in Swift, I ran into my first Swift compiler segmentation fault, yay (looking at Open Radar there seem to be many out there)!
This is no original thought. Nevertheless I’ve been thinking about it often enough to make it worth spending a few minutes framing it in my own words.
I’m currently working as a Software Engineer. According to Wikipedia that makes me a Knowledge Worker.
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.
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.
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.
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.
Most Objective-C developers have a fairly good understanding of properties and instance variables and how these two work together.
Today I want to discuss an interesting case that will force you to understand the details of the relationship between instance variables and properties. In case you already know these details, this remains an interesting example of how complicated Objective-C can be every once in a while.