All Projects → fcanas → Formulary

fcanas / Formulary

Licence: MIT license
Declarative iOS TableView Forms in Swift (pre-SwiftUI)

Programming Languages

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

Projects that are alternatives of or similar to Formulary

core
🔥 Antares Core Implemenation. Most important project layer, this is the heart for your app. ACL, notifiter, console, geoip, areas, utils and many more...
Stars: ✭ 24 (-71.08%)
Mutual labels:  form-validation, form-builder
React Hook Form
📋 React Hooks for form state management and validation (Web + React Native)
Stars: ✭ 24,831 (+29816.87%)
Mutual labels:  form-validation, form-builder
grav-plugin-form
Grav Form Plugin
Stars: ✭ 48 (-42.17%)
Mutual labels:  form-validation, form-builder
React Reactive Form
Angular like reactive forms in React.
Stars: ✭ 259 (+212.05%)
Mutual labels:  form-validation, form-builder
react-declarative
A React form builder which interacts with a JSON endpoint to generate nested 12-column grids with input fields and automatic state management in a declarative style. Endpoint is typed by TypeScript guards (IntelliSense available). This tool is based on material-ui components, so your application will look beautiful on any device...
Stars: ✭ 17 (-79.52%)
Mutual labels:  form-validation, form-builder
formio
Formio, form definition and binding library for Java platform
Stars: ✭ 24 (-71.08%)
Mutual labels:  form-validation, form-builder
react-cool-form
😎 📋 React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+196.39%)
Mutual labels:  form-validation, form-builder
smart-schema
A Laravel package to enable auto generation of forms
Stars: ✭ 18 (-78.31%)
Mutual labels:  form-validation, form-builder
Form For
ReactJS forms made easy
Stars: ✭ 118 (+42.17%)
Mutual labels:  form-validation, form-builder
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (+1.2%)
Mutual labels:  form-validation, form-builder
Usetheform
React library for composing declarative forms, manage their state, handling their validation and much more.
Stars: ✭ 40 (-51.81%)
Mutual labels:  form-validation, form-builder
Elm Form
Dynamic forms handling in Elm
Stars: ✭ 189 (+127.71%)
Mutual labels:  form-validation, form-builder
Formr
Create and Validate PHP Forms in Seconds.
Stars: ✭ 163 (+96.39%)
Mutual labels:  form-validation, form-builder
antd-react-form-builder
Example
Stars: ✭ 74 (-10.84%)
Mutual labels:  form-validation, form-builder
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (-60.24%)
Mutual labels:  form-builder
jquery.niceform
The jQuery plugin for validation and post form data to server
Stars: ✭ 16 (-80.72%)
Mutual labels:  form-validation
flexcss
A simple css pattern-library using flexbox, build for hellofellow
Stars: ✭ 85 (+2.41%)
Mutual labels:  form-validation
typiform
⚛️ A serverless React powered online form builder that works like a doc.
Stars: ✭ 16 (-80.72%)
Mutual labels:  form-builder
ember-formly
JavaScript powered forms for Ember
Stars: ✭ 24 (-71.08%)
Mutual labels:  form-builder
CoreDataToSwiftUI
Rule based CRUD CoreData Frontends for SwiftUI
Stars: ✭ 18 (-78.31%)
Mutual labels:  declarative-ui

Formulary Build Status

Formulary is a Swift library for creating dynamic, declarative, table view forms for iOS.

Formulary is in early stages of design and development, so if you jump in now, you can have a big impact on its design, power, and utility.

Formulary is inspired by XLForm, written in Swift, and designed for simplicity and development speed.

Basic Use

Text Entry

A basic text entry form shows Formulary's simple declarative style. A row's name is shown as placeholder text and as a label for the row. A row may also specify the kind of text entry it expects, controlling the keyboard style.

let form = Form(sections: [FormSection(rows: [TextEntryFormRow(name:"Name"),
                                              TextEntryFormRow(name: "Email", textType: TextEntryType.Email),
                                              TextEntryFormRow(name:"Age", textType: TextEntryType.Number)],
                                       name:"Profile")])
let formViewController = FormViewController(form: form)
presentViewController(formViewController, animated: true, completion: nil)

Screen-Capture of Basic Example Form

NSFormatters in Text Entry

NSFormatters can be injected to format text entry or enforce valid text. In this example the number formatter will prevent the user from entering more than two decimal places, more than one decimal point, or any non-numeric characters.

let decimalFormatter = NSNumberFormatter()
decimalFormatter.maximumFractionDigits = 2

TextEntryFormRow(name:"Age", textType: .Decimal, formatter: decimalFormatter)

Validations

Text entry rows can have validations. Validations are assertions about the value of a row. Validations show users error messages. Validation results for individual rows are aggregated to validate the overall Form. Some Validations are provided such as MaximumNumber, MinimumNumber, and RequiredString.

TextEntryFormRow(name:"Name", validation: RequiredString("Name"))
TextEntryFormRow(name:"Age", textType: TextEntryType.Number, validation:MinimumNumber("Age", 13))

A Validation is any function that accepts a String and returns a tuple indicating the validity of the input and any reason for it.

typealias Validation = (String?) -> (valid: Bool, reason: String)

This allows for powerful and flexible composition of Validations, which Formulary facilitates with logical operations on Validations.

Screen-Capture of a Form with Validations

Other Row Types

Toggle Switch

FormRow(name:"Do you like goats?", type: .Switch)

Buttons

FormRow(name:"Show an Alert", type: .Button, action: { _ in
    let alert = UIAlertController(title: "Hi!", message: "Somebody pressed a button.", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
    self.presentViewController(alert, animated: true, completion: nil)
})

Options

OptionSection(rowValues:["Ice Cream", "Pizza", "Beer"], name: "Food")

Example

Screen-Capture of Example Form

let decimalFormatter = NSNumberFormatter()
decimalFormatter.maximumFractionDigits = 5

let integerFormatter = NSNumberFormatter()

self.form = Form(sections: [
    FormSection(rows: [
        TextEntryFormRow(name:"Name", tag: "name", validation: RequiredString("Name")),
        TextEntryFormRow(name: "Email", tag: "email", textType: TextEntryType.Email),
        TextEntryFormRow(name:"Age", tag: "age", textType: TextEntryType.Number, validation: MinimumNumber("Age", 13), formatter: integerFormatter)],
        name:"Profile"),
    FormSection(rows: [
        TextEntryFormRow(name:"Favorite Number", tag: "favoriteNumber", value: nil, textType: .Decimal, validation: MinimumNumber("Your favorite number", 47) && MaximumNumber("Your favorite number", 47), formatter: decimalFormatter),
        FormRow(name:"Do you like goats?", tag: "likesGoats", type: .Switch, value: false),
        TextEntryFormRow(name:"Other Thoughts?", tag: "thoughts", textType: .Plain),],
        name:"Preferences",
        footerName: "Fin"),
    OptionSection(rowValues:["Ice Cream", "Pizza", "Beer"], name: "Food", value: ["Pizza", "Ice Cream"]),
    FormSection(rows: [
        FormRow(name:"Show Values", tag: "show", type: .Button, value: nil, action: { _ in

            let data = NSJSONSerialization.dataWithJSONObject(values(self.form), options: nil, error: nil)!
            let s = NSString(data: data, encoding: NSUTF8StringEncoding)

            let alert = UIAlertController(title: "Form Values", message: s as? String, preferredStyle: UIAlertControllerStyle.Alert)
            alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)
        })
    ])
])

Development Status

I'm using this in production, and the way I'm using works fine. YMMV.

Before a 1.0.0 release, this project follows a modified SemVer.

Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

Reasonable effort is put forth to use Patch version Z (x.y.Z | x = 0) when new, backwards compatible functionality is introduced to the public API. And for Minor version Y (x.Y.z | x = 0) when any backwards incompatible changes are introduced to the public API.

I intend to release a 1.0.0 early and have the major version number jump quickly rather than continuing with 0.y.z releases. Check Formulary's pulse if you're wondering about the health of the project.

Author

Fabian Canas (@fcanas)

License

Formulary is available under the MIT license.

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].