eureka wtb presentation - mathias classen
TRANSCRIPT
Eureka
Mathias Claassen @mClaassen26
”“
Elegant form builder in Swift
www.github.com/xmartlabs/eureka
Some of the apps using Eureka:
Dropbox, Chase Mobile, SoundCloud, Foursquare, AOL Radio, MLB.com,
Restaurant Story
Key concepts:
● Form: Represents the form. Is a collection of sections● Section: Represents the sections of an UITableView● Row: Contains information about the rows of the form
○ Most important: value● Cell: The cells shown in an UITableView● FormViewController: subclass of UIViewController
Rows and cells
● One-To-One Relation● They define each field of the form● Cells => UI part ● Rows => Logic part
Operators● +++ (Appends Sections to forms)
● <<< (Appends rows to sections)
An example:
Tags
● Tags identify rows and sections● They are optional● They are used to get values out of the form and other features like
making a row depend on the value of another
Creating the first form
Some basic fields
Section headers and footers
● Each section has header and footer basing on how UITableView works● Can be String or UIView● UIView can be loaded from Nib file, by calling a class init or created in a
callback block
Let’s add a submit button to our form
Customising cells
● All cells of a type: default row callbacks● One specific cell in a form:
○ cellSetup: One time customisation○ cellUpdate: When cell is re-displayed○ others
cellSetup or cellUpdate?
cellSetup
● Called once after the cell is instantiated● Should set things that don’t change with
time (fonts, margins, etc.)
cellUpdate
● Called in cellForRowAtIndexPath● Should update the cell according to the
current value of the row● If you need the frame of the cell to be set
correctly: this is the place to customise
Global cell settings
This are closures that can be set to a row class and which will be called for each instance of this type of row.
onChange
● Called when the value of a row is changed ● We often want to execute something when the value of a row changes● This can be used to react to user interaction events
Other features
● SelectableSection: a list of options● Hidden and disabled conditions
Demo
Thanks for watching!!