IvanPavliuk IvanPavliuk - 1 year ago 192
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 Source


super.init(frame: CGRectZero)

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download