Search code examples
iosuiviewswiftios8

How do I subclass a variable with an IBOutlet?


All descendants of my specific class are to have a UILabel instance variable. So in my parent class I have var label: UILabel. I want to have it in the sublclass as well, but as an IBOutlet. How do I do this?

I added the IBOutlet of the same name, and added weak to both variable declarations. But I get an error about "Cannot override with a stored property".

How should I be doing this? And is it possible to not have to instantiate the superclass' version as I just want it for subclassing?


Solution

  • Just add the IBOutlet modifier in the superclass.