Swift: is it possible to use generic and storyboard for UIViewController

generics, swift, xcode

Solution

Create a concrete class that inherits from the generic class:

class SpecificInformationServiceMenuVC : InformationServiceMenuVC<Specific> {}

Then you can use the specific subclass as your class type in storyboard.

It might even work to just make a typealias:

typealias SpecificInformationServiceMenuVC = InformationServiceMenuVC<Specific>

Problem

let's say, I have UIViewController subclass: ``` class InformationServiceMenuVC <T : InformationServiceItemProtocol>: UITableViewController { } ``` normally I can create instance of view controller by calling something like: ``` let vc = InformationServiceSideMenuVC<InformationServiceMenuItem>() ``` but how do I pass needed generic type when use storyboard?

Original source