Morten Bøgh

My personal blog.

Xcode 6 Live Rendering From Nib

When Apple announced Xcode 6 at WWDC14, one feature in particular excited me namely Xcode Live Rendering. This means an end to all the empty white views in place for our custom views.

But as Apple states in What’s new in Xcode 6, it is intended for hand-written UI code.

Live rendering within Interface Builder displays your hand-written UI code within the design canvas, instantly reflecting changes you type in code.

This is unsatisfying for me, since I went all in on Interface Builder when Storyboards and Auto Layout were introduced. Also I find it strange that Apple has not made it easier to do custom views using nibs.

Swift Makes the Little Things More Simple

On monday 2014-06-02 Apple introduced a new scripting-style programming language called Swift. As an iOS developer I find this extremely interesting and looking forward to learn this new language and hopefully boost my productivity :)

Swift introduces a lot of nitfy new functions which makes your life as a developer much easier and hides away the boring details. Here is a showcase of map, reduce and filter.

Map

Objective-C
1
2
3
4
5
6
NSArray *names = @[@"John", @"Steve", @"Tim"];
NSMutableArray *namesTemporary = [NSMutableArray new];
names enumerateObjectsUsingBlock:^(NSString *name, NSUInteger idx, BOOL *stop) {
    [namesTemporary addObject:name.lowercaseString];
}];
names = [namesTemporary copy];
Swift
1
2
var names: String[] = ["John", "Steve", "Tim"]
names = names.map{ name in name.lowercaseString }
Swift (Alternative)
1
names = names.map{ $0.lowercaseString }

Empty Back Button on iOS7

On iOS7 the UINavigationBar features a nice little back arrow when used together with a UINavigationItem and/or UINavigationController.

But what if you wanted the back button text to disappear leaving the back arrow there by itself, turns out it is not as simple as you might expect.

Auto Layout and UIRotationGestureRecognizer + UIPinchGestureRecognizer

On a new project I recently joined, I was given the task to implement a feature which involved panning, zooming and rotating a UIImageView. A straightforward task and something I have done a few times before, so I went and wired up everything in the storyboard and found some old code for handling the three required actions. So far so good.

Octopress More Productive Than WordPress

Welcome to my new blog powered by Octopress.

This is a reboot of my blog and hopefully switching from WordPress to Octopress will make it easier for me to finish all the blog posts I have drafted in the old WordPress install. I find Octopress more suited for me since it is out of the browser and hopefully less distracting, so far I have only productive plugins installed for Sublime Text 2.
Using the tutorial Create a Blog With Octopress and Host It in Github Pages it was fairly easy to setup my blog on GitHub Pages. You can find the repository for this blog on mbogh.github.io.

Currently I am working on finalizing two posts. First one is a tutorial on integrating and using Unity as a component in your app rather than using Unity for every aspect of your app.
The second one is about symbolicating crash reports using LLDB which is useful when symbolicatecrash fails to do so.

I will add an About page when I find the time between changing diapers :)

Catch me on Twitter @mbogh