Madlib style form view
- Text fields expand while users are entering text, reflowing to the next line if necessary
- Labels are broken up as individual words
- All text fields are validated via passed in lambda and appearance is updatable via the
NarrativeTextFieldSettableAppearance
protocol - Appearance of fields, buttons, and labels is completely customizable
- Create an instance of Narrative view via either IB or programatically.
- Implement the NarrativeViewDelegate delegate on your VC and set
narrativeViewDelegate
- Describe your view by chaining together
label
,textfield
orbutton
methods followed by a call toinitialLayout
e.g.
narrativeView.label(createLabel: newLabel, text: "Enter your")
.textField(createTextField: newField("user name")) { field in
return self.validateUsername(field.text)
}
.label(createLabel: newLabel, text: "and")
.textField(createTextField: newField("password")) { field in
return self.validatePassword(field.text)
}
.label(createLabel: newLabel, text: "to log in.")
.initialLayout()
Simple Madlib style form with primitive field validation. After you complete the madlib the view is updated to congratulate you.