I have a few properties set as @IBInspectable
, so I can edit them in the Interface Builder, but during runtime when are those properties set?
I tried using them during the init but they were not set yet.
This is what I am trying to do. But I can't even move the Timer Init to the TimerView Init because the @IBInspectable
vars are not set by the time the init is called.
class TimerView {
var timer:Timer? = Timer(timeInterval: time1, alertTimeInterval: time2)
@IBInspectable var time1: Double = 0
@IBInspectable var time: Double = 0
}
Like anything set in IB, it will be set when the xib file is loaded. You want to set your timer in awakeFromNib()
override func awakeFromNib() {
super.awakeFromNib()
timer = //IBInspectable elements now set
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With