All Projects → unboxme → PureForm

unboxme / PureForm

Licence: MIT license
No description or website provided.

Programming Languages

objective c
16641 projects - #2 most used programming language
c
50402 projects - #5 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to PureForm

django-siteforms
Django reusable app to simplify form construction
Stars: ✭ 15 (-31.82%)
Mutual labels:  forms
Framer-CollectionComponent
Framer Module
Stars: ✭ 22 (+0%)
Mutual labels:  prototype
hookahjs
Add empty/dirty/touched CSS hooks to input and textarea elements automatically (1056 bytes)
Stars: ✭ 21 (-4.55%)
Mutual labels:  forms
multi-step-form
A free WordPress plugin for dynamic multi-step forms.
Stars: ✭ 32 (+45.45%)
Mutual labels:  forms
reCAPTCHA
‼️ Google reCAPTCHA (security) for Nette Framework \ Forms
Stars: ✭ 35 (+59.09%)
Mutual labels:  forms
DynamicProto-JS
Generates dynamic prototype methods for JavaScript objects (classes) by supporting method definition within their "class" constructor (like an instance version), this removes the need to expose internal properties on the instance (this) which results in better code minfication and therefore improved load times for your users.
Stars: ✭ 16 (-27.27%)
Mutual labels:  prototype
tags
HTML tags in Go
Stars: ✭ 50 (+127.27%)
Mutual labels:  forms
dokuwiki-plugin-bureaucracy
Create forms and generate pages or emails from them
Stars: ✭ 43 (+95.45%)
Mutual labels:  forms
municipios-br
Dados em formato aberto sobre municípios e unidades federativas do Brasil.
Stars: ✭ 58 (+163.64%)
Mutual labels:  forms
Fields
Good, solid base to build custom forms in iOS apps, using self-sizing compositional layout.
Stars: ✭ 80 (+263.64%)
Mutual labels:  forms
react-cool-form
😎 📋 React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+1018.18%)
Mutual labels:  forms
sirius
Modern coffeescript/javascript framework
Stars: ✭ 20 (-9.09%)
Mutual labels:  prototype
OneKeyChangeXIBColor
快速修改XIB或者Storyboard的控件颜色
Stars: ✭ 25 (+13.64%)
Mutual labels:  storyboard
chatty-form
A highly theme-able and customisable form in the shape of a chat based interface for React.
Stars: ✭ 27 (+22.73%)
Mutual labels:  forms
StaticPage
静态页面大杀器 ------三行代码搞定常用静态页面
Stars: ✭ 40 (+81.82%)
Mutual labels:  tableview
a11y-map
A11y map testing
Stars: ✭ 18 (-18.18%)
Mutual labels:  prototype
forms-typed
Want types in your forms? Want to have nested forms? This is the place to be...
Stars: ✭ 79 (+259.09%)
Mutual labels:  forms
dead-simple-text
Minimalist plain text editor for the web
Stars: ✭ 34 (+54.55%)
Mutual labels:  prototype
Python-MongoDB-Example
A Live working Example Application of Python, Qt, PySide2, MongoDB, PyMongo, QTreeView, QAbstractTableModel
Stars: ✭ 41 (+86.36%)
Mutual labels:  tableview
NSVLocalizationKit
Localize directly from Storyboard or Xib, it will automatically update all texts after in app language changing, without any line of code
Stars: ✭ 21 (-4.55%)
Mutual labels:  storyboard

PureForm — the easiest way to build form such as login, questionnaire and etc. screens from JSON file. PureForm provides parsing properties and special params into objects for further manipulation of them.

Setup

Manually

Download the source files from the PureForm subdirectory. Then just add source files to your Xcode project and import the PureLayout.h header.

Cocoapods

Add the pod PureForm to your Podfile:

platform :ios, '8.0'

target 'YourProject' do
    pod 'PureForm'
end

Then, run the following command:

$ pod install

Usage

PureForm is clean and pretty easy to use in several steps:

  1. Describe your form in a JSON file using JSON Rules paragraph below;

  2. Create settings via PFSettings using Settings paragraph below:

    PFSettings *settings = [[PFSettings alloc] init];
    settings.keyboardTypeValidation = YES;
    settings.keyboardAvoiding = YES;
    settings.formDelegate = self;
    settings.tableViewDelegate = self;
    
    // etc.
  3. Create a PFFormController instance with a UITableView and settings which were created at the previous step:

    self.formController = [[PFFormController alloc] initWithTableView:self.tableView settings:settings];
  4. Just use a makeFormWithJSONFile: method to create and display your form from the JSON file from the first step:

    [self.formController makeFormWithJSONFile:@"form"];
  5. That's it!

Settings

The settings header is fully documented. There are main params here you can set:

  • keyboardTypeValidation
  • keyboardAvoiding
  • failureReasons
  • cellHeight

As well as delegates for UIKit controls:

  • PFFormDelegate
  • UITableViewDelegate
  • UITextFieldDelegate
  • PFSegmentedControlDelegate
  • PFSwitchControlDelegate
  • PFSliderControlDelegate
  • PFStepperControlDelegate

JSON Rules

Describe your custom cell in JSON just using property names and values for them. Of course, reserved words and special chars are used too. You can find reserved words and special chars in a constants header.

Basics

  • Pairs of class cell name or cell identifier and reserved words are segregated by < and >.
  • The base structure for 2 cells looks like (pay attention on levels):
[									   		    /// 0 level
 {
   "<cell_class_name + cell_identifier>": {   // First cell
     property_name_1: {					   /// 1 level
       in_property_name_1.1: value,		   /// 2 level
       in_property_name_1.2: value
     },
     property_name_2: {
       in_property_name_2.1: value
     }
   }
 },
 {
   "<cell_class_name + cell_identifier>": { 	// Second cell
   // Setup
 },
 {
 // etc.
 }
]

Note that JSON parsing supports only 2 levels of nesting yet.

  • If a cell class name or a cell identifier equals to the previous one, you can simplify it using = like that:
{
   "<= + =>": { 									// Any cell
   // Setup
},
  • Usage of reserved words and special chars:
Reserved word Level Value
<section> 0 index of section
<value> 1 current value
<key> 1 save key for output dictionary
<validators> 1 array of validators
<display> 1 property name to display value after change
All reserved words and special chars are optional.
Char Usage in Example Description
? property name textField? Shows that it's a form for validation — not just a view
! validator name min_value! Starts validation immediately after value change
* property name text* Shows that this value is a key for NSLocalizedString macros
# value ic_turtle#6F3F83 or #6F3F83 Uses as it is or for hex coloring image by their name
  • Available validator keys for <validators>:
Validator Value
equal string or number
equal_next true
equal_previous true
equal_length number
min_length number
max_length number
min_value number
max_value number
required true
type email or full_name
custom regex string
Validators are used in 2 level and they should be nested into <validators>.
  • Enums are just numeric values in JSON. By the way there are some enums which are associated with string values:
    • UIKeyboardType
    • UITextAutocapitalizationType
    • UITextAutocorrectionType
    • UITextSpellCheckingType
    • UIKeyboardAppearance
    • UIReturnKeyType
    • UITextFieldViewMode

Examples

  • Well, how it looks in a real example:
[
 {
   "<TextFieldCell + TextFieldCellIdentifier>": {
     "textField?": {
       "placeholder": "Huh, centered?",
       "textAlignment": 1
     }
   }
 }
]

  • Now let's make a login form with validators:
[
 {
   "<TextFieldCell + TextFieldCellIdentifier>": {
     "textField?": {
       "placeholder": "Login",
       "textAlignment": 1,
       "keyboardType": "UIKeyboardTypeEmailAddress",
       "<key>": "login",
       "<validators>": {
         "type": "email"
       }
     }
   }
 },
 {
   "<= + =>": {
     "textField?": {
       "placeholder": "Password",
       "textAlignment": 1,
       "secureTextEntry": true,
       "<key>": "password",
       "<validators>": {
         "min_length!": 6,
         "max_length!": 25
       }
     }
   }
 },
 {
 "<section>": 1
 },
 {
   "<ButtonCell + ButtonCellIdentifier>": {
     "titleLabel": {
       "text": "Login",
       "textColor": "#6F3F83"
     }
   }
 }
]

  • It remains only to validate entered values and save they into the dictionary. Credentials from left form satisfies the validators and [self.formController validate] will return YES:
if ([self.formController validate]) {
   NSDictionary *loginInfo = [self.formController allKeyValuePairs];
   // Send it to server
}

Notes

  • Example project files will open properly only in Xcode 8.

TODO

  • Remove limit of nesting
  • Keyboard avoiding (issue #2)
  • Targets for buttons
  • Support of UITextView
  • Wrapper for editing common properties
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].