IB/UIStoryboard and UIViewController

//IB/UIStoryboard and UIViewController

IB/UIStoryboard and UIViewController

It was always an error prone  procedure when I was working in IB specifying Storyboard or Reuse Identifier as identification for UIViewController/UITableViewCell or UICollectionViewCell, so I soon started with a convention that every identifier in IB gets the name of its Type. In Code I used two static functions (NameOfClass/ReuseIdentifierForClass) which turned my class into a String. I was quite happy with it but felt a bit uncomfortable though.

Now in Swift I came across a blog entry from Natasha which help to get rid of both method in favor of String(MyClass) and than I found an article from Andyy Hope to make it even more savvy.

But in a current project we’re working with independent moduls  and link them together in the final project, so the implementation for getting a specific UIStoryboard Andyy relied on the fact that the storyboard name is part of the enum Storyboard and that would meant, that our all SupportModul where most of all support functionality is provided would need knowledge about a specific modul, which didn’t seemed right.

So here are my changes I made, which guarantee, that the new protocol can only be implemented on Types that conform to RawRepresentable where the RawValue is a String, as that is what we need to load a storyboard, and every modul can establish there own enum to specify the storyboards in use.

 

 

 

By |2018-06-06T20:31:43+00:00Montag, Februar 8th, 2016|Uncategorized|0 Comments

About the Author:

Leave A Comment

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.