Storyboards in Xcode

Recently I have used storyboards to build an client. After many hours with it I have to say, I won’t use storyboard in future project unless Apple improves it tremendously.


One of the main problems I have with the storyboard of this rather simple app can be summarized in one picture.

The storyboard of hAppy, my client.

The storyboard is very complex and there is a lot of repeated information. The app has several tabs holding similar views. I did not accomplish to use the same view in storyboard for these views. The problem is, that these different but similar views have different view controller which are embedded in navigation controllers. The navigation controllers themselfes are hosted in a tab bar controller.

I am not saying it is not possible to reuse one view, but all my attempts did not solve the problem. So if it is possible it is to complicated for me.

Repeated information in software development is a problem. During the development of hAppy I had to change the views a lot and this led to changing the same part of the user interface in different parts of the storyboard. Without the use of storyboards I just would have changed a few lines of code for all views at once.

Missing Method Parameter

A lot of the segues I use in hAppy push another view onto the navigation stack when the user touches an action button beneath a post cell. Let’s say the user touches the profile button to show the profile of the user who posted the status. The first thing is to find the indexPath of the cell which contains the post.

CGPoint buttonOrigin = [self.tableView convertPoint:sender.frame.origin fromView:sender.superview];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonOrigin];

Then I call a method to get the dictionary for the post and extract the user from this dictionary.

NSDictionary *postDictionay = [self postDictionaryForControlCellIndexPath:indexPath];
NSDictionary *userDict = [postDictionay objectForKey:@"user"];

And now it becomes ugly. I want to push the profile view onto the navigation stack with the profile of the user I just found. The pushing is done by calling performSegueWithIdentifier:sender:. But who is the sender in this case? Normally you would think the sender is the button which was touched. But then the code to find the user should have been in the performSegueWithIdentifier:sender: method. Fair enough. But in hAppy you can also get to the profile by touching the avatar in the post. In this case the sender would be different and I would need two segues to the profile view. Which again is repeated information.
To solve this I call performSegueWithIdentifier:sender: with the user id (which is a string) as the sender.

[self performSegueWithIdentifier:@"ShowProfile" sender:[userDict objectForKey:@"id"]];

Doing so I can use one segue for one transition between the post view and the profile view.

Yes, I know what you think. This is awful and inconsistent. But the other possibilities I can think of are worse. I my opinion Apple could fix this with a method like performSegueWithIdentifier:sender:userInfo: with userInfo being of type NSDictionary. Then one could give the actual segue preparation additional information for the view to be shown.

Follow me on

Flattr this

This entry was posted in Development and tagged . Bookmark the permalink.