All Projects → ortuman → Swiftforms

ortuman / Swiftforms

Licence: mit
A small and lightweight library written in Swift that allows you to easily create forms.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Swiftforms

Eureka
Elegant iOS form builder in Swift
Stars: ✭ 11,345 (+753.65%)
Mutual labels:  cocoapods, carthage, forms
Silentscrolly
Scroll to hide navigationBar, tabBar and toolBar.
Stars: ✭ 79 (-94.06%)
Mutual labels:  cocoapods, carthage
Soundable
Soundable allows you to play sounds, single and in sequence, in a very easy way
Stars: ✭ 78 (-94.13%)
Mutual labels:  cocoapods, carthage
Cocoapods Playgrounds
🃏 Generate Swift Playgrounds for any library.
Stars: ✭ 1,307 (-1.66%)
Mutual labels:  cocoapods, carthage
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-93.23%)
Mutual labels:  cocoapods, carthage
Swiftlinkpreview
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
Stars: ✭ 1,216 (-8.5%)
Mutual labels:  cocoapods, carthage
Hdwallet
Simple Swift library for creating HD cryptocurrencies wallets and working with crypto Coins/ERC20 tokens.
Stars: ✭ 80 (-93.98%)
Mutual labels:  cocoapods, carthage
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (-11.21%)
Mutual labels:  cocoapods, carthage
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (-93.68%)
Mutual labels:  cocoapods, forms
Yndropdownmenu
✨ Awesome Dropdown menu for iOS with Swift 5.0
Stars: ✭ 1,259 (-5.27%)
Mutual labels:  cocoapods, carthage
Quick
The Swift (and Objective-C) testing framework.
Stars: ✭ 9,303 (+600%)
Mutual labels:  cocoapods, carthage
Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (-94.21%)
Mutual labels:  cocoapods, carthage
Notificationz
📡 Helping you own NotificationCenter in Swift!
Stars: ✭ 74 (-94.43%)
Mutual labels:  cocoapods, carthage
Mbpopup
macOS status bar popups done right 😎
Stars: ✭ 89 (-93.3%)
Mutual labels:  cocoapods, carthage
Ctshowcase
A simple to use Showcase library that can highlight arbitrary views in an iOS app
Stars: ✭ 73 (-94.51%)
Mutual labels:  cocoapods, carthage
Hover
🎈 The smartest floating button
Stars: ✭ 81 (-93.91%)
Mutual labels:  cocoapods, carthage
Swiftyattributes
A Swifty API for attributed strings
Stars: ✭ 1,303 (-1.96%)
Mutual labels:  cocoapods, carthage
Corenavigation
📱📲 Navigate between view controllers with ease. 💫 🔜 More stable version (written in Swift 5) coming soon.
Stars: ✭ 69 (-94.81%)
Mutual labels:  cocoapods, carthage
Sheeeeeeeeet
Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.
Stars: ✭ 1,177 (-11.44%)
Mutual labels:  cocoapods, carthage
Magnetic
SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲
Stars: ✭ 1,252 (-5.79%)
Mutual labels:  cocoapods, carthage

Version Carthage compatible

License Platform

SwiftForms

Purpose

SwiftForms is a powerful and extremely flexible library written in Swift that allows to create forms by just defining them in a couple of lines. It also provides the ability to customize cells appearance, use custom cells and define your own selector controllers.

Here is an screenshot from an example application using SwiftForms

Screenshot of Example application

How to create a form

Creating a form using SwiftForms is pretty straightforward. All you need is to derive your controller from FormViewController and define a FormDescriptor instance along with its sections and rows. Here is an example of how to create a simple form to input an email and a user password.

// Create form instace
var form = FormDescriptor()
form.title = "Example form"

// Define first section
var section1 = FormSectionDescriptor()

var row = FormRowDescriptor(tag: "name", rowType: .Email, title: "Email")
section1.rows.append(row)

row = FormRowDescriptor(tag: "pass", rowType: .Password, title: "Password")
section1.rows.append(row)

// Define second section
var section2 = FormSectionDescriptor()

row = FormRowDescriptor(tag: "button", rowType: .Button, title: "Submit")
section2.rows.append(row)

form.sections = [section1, section2]

self.form = form

To see a more complex form definition you can take a look to the example application.

Cell appearance

Every row descriptor has a configuration dictionary that allows to customize cell's appearance and behavior. In order to change concrete visual aspects of a row simply set row.configuration.cell.appearance value to a dictionary containing custom key-value coding properties.

Here's an example:

row.configuration.cell.appearance = ["titleLabel.font" : UIFont.boldSystemFontOfSize(30.0), "segmentedControl.tintColor" : UIColor.redColor()]

Custom cells

In addition, it is possible to create 100% custom cells by deriving from FormBaseCell class. In that case, don't forget to override configure and update methods. First method will be called only once and after cell has been created, and the second one every time cell content should be refreshed.

Here are the methods that help you to define custom cell behavior.

func configure() {
    /// override
}

func update() {
    /// override
}

class func formRowCellHeight() -> CGFloat {
    return 44.0
}

class func formViewController(formViewController: FormViewController, didSelectRow: FormBaseCell) {
}

Once you have defined your custom cell, and in order to use it for a concrete row, you'll have to set FormRowDescriptor cellClass property.

Custom selector controllers

In order to customize selector controller your class should conform to FormSelector protocol. That way you'll have access to the cell instance that pushed the controller, being able to alter its properties or setting it's row value accordingly to user interaction.

After defining your class, don't forget to set row.configuration.selection.controllerClass value in the configuration dictionary to use your custom selector controller.

Requirements

  • iOS 8.0 and above

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate SwiftForms into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'SwiftForms'

Then, run the following command:

$ pod install

Carthage

Simply add the following line to your Cartfile:

github "ortuman/SwiftForms"

Then run:

$ carthage update

For more information on Carthage see the README

Copyright

SwiftForms is originally based on XLForm github project. (https://github.com/xmartlabs/XLForm)

Check LICENSE file for more details.

Contact

If you are using SwiftForms in your project and have any suggestion or question:

Miguel Angel Ortuño, [email protected]

@ortuman

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