4

So I have a base class with generics that inherits from UIView

class TemplateView<T: ViewData.View>: UIView {
    ...
}

I have several subclasses of this for example:

class TemplateLabel: TemplateView<ViewData.View.Label> {
    ...
}

In Storyboard I have views with Custom Class set to the correct subclass of TemplateView<T> ex: TemplateLabel and it finds the source code when I press the arrow and the Module is also found, but auto fill does not find it.

I get the views with Storyboard ID and then take the ViewController.view property.

On build time everything works but on runtime I get exception:

Unknown class _TtC7Project13TemplateLabel in Interface Builder file.

Why?

Arbitur
  • 38,684
  • 22
  • 91
  • 128
  • Hi, can not check it right now, but may be the reason is that subclass of generic class must also be a generic class. – Alex Kosyakov Apr 19 '16 at 15:25
  • 1
    Possible duplicate of [Use a generic class as a custom view in Interface Builder](http://stackoverflow.com/questions/25263882/use-a-generic-class-as-a-custom-view-in-interface-builder) – Nicolas Massart Jul 18 '16 at 11:27

0 Answers0