IvanPavliuk IvanPavliuk - 3 months ago 39
Swift Question

Hello! I want to create constructor for my class and I have an error: Super.init isn't called on all paths before returning from initializer swift

class MyPicker: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource {

var pickerContent: [String] = [""]
var textField = UITextField()

var form: Form!

init(form: Form, content: [String]) {
self.form = form
self.pickerContent = content
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}


}

Lu_ Lu_
Answer

Add

super.init(frame: CGRectZero)

in your init, class need to init it's super class

Comments