neoneye/SwiftyFORM

SwiftyFORM fatal error: init(coder:) has not been implemented

adrianha opened this issue · 4 comments

Hello, I am using SwiftyFORM on my ios 9 application..
I've a trouble when implement FormViewController..
The result was: fatal error: init(coder:) has not been implemented
What should i do?

My code was like this:
import UIKit
import SwiftyFORM

class MySwiftyFORMController: FormViewController {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}

override func loadView() {
    super.loadView()
    form_installSubmitButton()
}

override func populate(builder: FormBuilder) {
    builder.navigationTitle = "Sign Up"
    builder.toolbarMode = .Simple
    builder.demo_showInfo("SocialNetwork 123\nSign up form")
    builder += SectionHeaderTitleFormItem().title("Details")
    builder += userName
}

lazy var userName: TextFieldFormItem = {
    let instance = TextFieldFormItem()
    instance.title("User Name").placeholder("required")
    instance.keyboardType = .ASCIICapable
    instance.autocorrectionType = .No
    instance.validate(CharacterSetSpecification.lowercaseLetterCharacterSet(), message: "Must be lowercase letters")
    instance.submitValidate(CountSpecification.min(6), message: "Length must be minimum 6 letters")
    instance.validate(CountSpecification.max(8), message: "Length must be maximum 8 letters")
    return instance
    }()

}

Need your advice. Cheers!

Hi @adrianha

I have just made it possible to use FormViewController inside a storyboard, see the Area51 storyboard.

Does this work for you?

Hello @neoneye,
I can run your example area51.
But i've still faced the problem, when i extends my controller to FormViewController, it will raised an error..
I've uploaded my source code..
I am implementing tab bar controller and want to use SwiftyFORM as the main engine to manage form..
You can check at MySwiftyFORMController.swift ..

Edited:
But if i create a project that using view controller instead of using tab bar controller, it works well. Is it possible the error cause of using tab bar controller?

The UIKit tab bar controller is annoying to use. I rarely do apps with tab bars maybe because of this.

Mail me your code as a zip file and I can look at it. Maybe I can fix

neoneye@gmail.com

I've sent you the code..
Many thanks