I need to set a property of a UIView
before awakeFromNib
is fired.
This is what I tried:
if let views = Bundle.main.loadNibNamed("MyNib", owner: self, options: nil) as? [MyNib],
views.count > 0 {
let v = views.first!
v.count = 78
// or
v.configureContent(n: 78)
return v...
configureContent
gets called but after awakeFromNib
, so I can't use the value of count
inside the body of awakeFromNib
.
I red here about the options parameter, but I'm not sure it can be of any help.
Another option would be to avoid any sort of injection and ask for data from some source directly from the awakeFromNib
.
Any help is appreciated.