Reputation: 1861
In my UIViewController
, I would like to add code as soon as my view property is set:
var view:UIView! {
didSet {
//(view as MyView).delegate ...
}
}
Obviously, it doesn't work because I cannot override variable of super class.
Is there any workaround to achieve what I want?
Upvotes: 0
Views: 547
Reputation: 534958
The view will be set just once, and at that time viewDidLoad
will be called. So go with the flow and override viewDidLoad
and set the delegate there.
Upvotes: 1