I am doing a demo to learn how @IBInspectable works.
First, I made two variables in a subclass of UIViewController:
@IBInspectable var intTest:Int = 10
@IBInspectable var flag:Bool = false
So that he appears in the storyboard. After that, I change the value of these variables in the storyboard:

Then I try to print these variables in the viewDidLoad () method as follows:
override func viewDidLoad() {
super.viewDidLoad()
print("intTest value: \(String(describing: intTest))")
print("flag value: \(String(describing: flag)))")
}
Conclusion:
IntTest value: 90
Flag value: true
It works great, except when I change the declaration of variables, for example,
@IBInspectable var intTest:Int? = 10
@IBInspectable var flag:Bool? = false
After that, I changed the value as indicated above in the storyboard, but the values do not change.
Output:
intTest value: optional (10)
Flag Value: Optional (false)
So my question is: why is the value not updated when I declare the variable as optional?
, , . - ?