iOS Cool Stuff: Storyboards

Storyboards are one of the coolest features of Xcode and iOS development. New to Xcode 4.2, they not only give you a visual overview of all the screens in your application, but they show you the transitions – or segues – between the screens.

This is a few steps above and beyond the likes of what Visual Studio can do. Instead of seeing a single control or a single window at a time, you can see all of them, plus the way they relate to each other.

Some of the features of storyboards are not particularly discoverable, though, such as the Ctrl-clicking and dragging to create a segue (or an outlet, but I believe that’s just part of Interface Builder that’s been there for a while, not a feature specific to storyboards). There are also some fairly unintuitive behaviors with regards to zooming and selecting. It appears that there are only four zoom levels – you can’t zoom in or zoom out arbitrarily. And selection works differently at the different zoom levels. For example, if you aren’t zoomed in all the way, you can’t select individual controls; you can only select entire views. But if you click on a control in the document outline, you are suddenly zoomed in to it. Not deal breakers, of course; just things that might initially surprise you.

Minor quibbles aside, storyboards are a terrific step forward in the realm of visual designers, and one that I would love to see in Visual Studio.

By the way, if you’re looking for a great storyboard tutorial, check out Ray Wenderlich’s Beginning Storyboards Tutorial.

iOS Cool Stuff – Immutability by default

This is the first entry in the iOS Cool Stuff series. As the opposite of the iOS Pain Points series, it will talk about some of the nifty parts of iOS development – the kind of stuff I wish I had in the .NET world.

One very cool feature of Objective-C is that data structures tend to be immutable by default. Your standard array data structure, NSArray, is immutable. If you want a mutable version, you have to specifically ask for NSMutableArray. This is the way things should be.

In .NET, immutability is a bit harder to come by. Sure, strings are immutable, but what about collections? Sure, you can use the ReadOnlyCollection<T> wrappers, or expose an IEnumerable property, but neither of these options is as slick as simply having built-in immutability.