by Cesare Rocchi

Aren't Storyboards supposed to tell a story?

by Cesare Rocchi

In the last few months I have read some interesting articles about “Coordinator” objects. Some they call it Flow Controllers, some coordinators. I admit I like the idea of having an object collecting the navigation logic. As a side effect you end up with slimmer and easier-to-test view controllers. Win-win.

Now. Maybe it’s the word itself, maybe I conceptualized it in a wrong way. Isn’t a storyboard supposed to do exactly that? Scenario. I am new to the project, I barely know the names of my colleagues. What do I do after opening the Xcode project? I open the storyboard. And there I am supposed to find the map of the application, what is wired with what, possible paths and so on.

If the project builds views in code I am fine. If the code uses one xib per view controller it’s my preferred solution. But when I see a storyboard with many segues and components and layout constraints I think: “it looks like they spent much time in here, there’s probably no code that changes the logic of this board”. And next thing you know you discover a first case, then a second and after a bit the mental picture you built by looking at the storyboard is not complete, at all.

I know there’s a ton of reasons why projects end up in this situation: churn in the development team, manager rushing deadlines, etc. I don’t blame the developers for this. I probably blame this grey area, where everything can happen and you don’t know until you discover it with logs or breakpoints, which is the some hybrid usage of storyboards and code.

Before Storyboards, if I had to change a view, either I looked at the Xib or at the code. And it was stressful already :) Now I need to find the controller, find in which storyboard it is linked and then wonder in the storyboard to actually find it.

I always thought the utility of the storyboard was in being a map, to get oriented within the guts of an application. Maybe I have been unlucky with the projects I saw, maybe I have a too high expectation, but storyboards have been more of a hurdle than a support tool for me.

That’s one more reason I like Coordinator objects that take care of the presentation logic. At least I know right away where to look when I need to change the flow of the presentation in the app.