eureka wtb presentation - mathias classen

15
Eureka Mathias Claassen @mClaassen26 Elegant form builder in Swift www.github.com/xmartlabs/eureka

Upload: withthebest

Post on 14-Jan-2017

70 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Eureka wtb presentation - Mathias Classen

Eureka

Mathias Claassen @mClaassen26

”“

Elegant form builder in Swift

www.github.com/xmartlabs/eureka

Page 2: Eureka wtb presentation - Mathias Classen

Some of the apps using Eureka:

Dropbox, Chase Mobile, SoundCloud, Foursquare, AOL Radio, MLB.com,

Restaurant Story

Page 3: Eureka wtb presentation - Mathias Classen

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

Page 4: Eureka wtb presentation - Mathias Classen

Rows and cells

● One-To-One Relation● They define each field of the form● Cells => UI part ● Rows => Logic part

Page 5: Eureka wtb presentation - Mathias Classen

Operators● +++ (Appends Sections to forms)

● <<< (Appends rows to sections)

An example:

Page 6: Eureka wtb presentation - Mathias Classen

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

Page 7: Eureka wtb presentation - Mathias Classen

Creating the first form

Some basic fields

Page 8: Eureka wtb presentation - Mathias Classen

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

Page 9: Eureka wtb presentation - Mathias Classen

Let’s add a submit button to our form

Page 10: Eureka wtb presentation - Mathias Classen

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

Page 11: Eureka wtb presentation - Mathias Classen

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

Page 12: Eureka wtb presentation - Mathias Classen

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.

Page 13: Eureka wtb presentation - Mathias Classen

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

Page 14: Eureka wtb presentation - Mathias Classen

Other features

● SelectableSection: a list of options● Hidden and disabled conditions

Page 15: Eureka wtb presentation - Mathias Classen

Demo

Thanks for watching!!