I have a custom subclass of UIButton:
import UIKit
@IBDesignable
class MyButton: UIButton {
var array : [String]?
}
It is IBDesignab
It is possible to use generic UIView in Interface Builder. Let's say you have:
class A: UIView {}
First you have to inherit your generic view to make it non-generic:
class B: A {}
Go ahead and use B class in Interface Builder.
After it you can make @IBOutlet connection in your code:
@IBOutlet var b: B
It will produce error, so to get rid of it make it use UIView class instead, and downcast it like so:
@IBOutlet var b: UIView
var _b: B {
b as! B
}
Done, now your _b variable is type of B, and it works.