Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Formkit

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Avatar for Meiwin Fu Meiwin Fu
September 22, 2014

 Formkit

Objective-C library for easily building forms UI.

Avatar for Meiwin Fu

Meiwin Fu

September 22, 2014

Other Decks in Programming

Transcript

  1. Observations/Problems • Typically most forms are rows of field •

    Field is usually combination of label and input control • They look trivial, but not so trivial to implement • UI interactions (sometimes) require quite some code too
  2. Motivation/Goals • To make form creation trivial, less effort •

    To start minimum, consistent iteration over time • No/minimal third-party dependency • Easy to extend • Open-source
  3. • Example: FKForm *form = [[FKForm alloc] init]; form.title =

    @"Sign In"; FKRowItem *row1 = [form addRow]; [row1 addColumnWithItem:[FKTextFieldItem textFieldItemWithName:@"username" label:@"Username" text:nil placeholder:@"Email address"]]; FKRowItem *row2 = [form addRow]; [row2 addColumnWithItem:[FKTextFieldItem textFieldItemWithName:@"password" label:@"Password" text:nil placeholder:nil]]; form.purpose = FKFormPurposeSubmit; form.submitLabel = @“Sign In”;
  4. Design • It’s a tree of items with FKForm as

    the root • Form contains 0-N rows • Row contains 0-N columns • Column contains 1 item • FKInputItem represents user input element
  5. FKFormViewController • Convenient base class • Manage instance of FKForm

    • Convenient methods to present success/error message • Conforms to FKFormDelegate