I am trying to do a custom UIPickerView. In my custom class, I have to override "init(coder aDecoder: NSCoder)" initializer.
In the same time I want to have an initialiser without any parameter. According to error message, my class variables initialization is mandatory, but their initialization is not detected if done in a separate function.
class MyPickerView: UIPickerView{
var maxInt:CInt;
func baseInit(){
maxInt = 10;
}
override init() {
maxInt = 10;
super.init();
}
required init(coder aDecoder: NSCoder) {
maxInt = 10;
super.init(coder: aDecoder)
}
}
There, I do have redundant code for my "maxInt" initialization.
If I replace the intialization of maxInt in the initializer, I have this error message:
Property 'self.maxInt' not initialized at super.init call
What should I do. What should the best practice?
Thank you for your help.