├── .build └── manifest.db ├── .gitignore ├── .swift-version ├── LICENSE ├── Package.swift ├── README.md ├── Sources └── SwiftFormsPackage │ ├── FormErrorType.swift │ ├── SwiftForms.h │ ├── cells │ ├── FormButtonCell.swift │ ├── FormCheckCell.swift │ ├── FormDateCell.swift │ ├── FormLabelCell.swift │ ├── FormPickerCell.swift │ ├── FormSegmentedControlCell.swift │ ├── FormSelectorCell.swift │ ├── FormSliderCell.swift │ ├── FormStepperCell.swift │ ├── FormSwitchCell.swift │ ├── FormTextFieldCell.swift │ ├── FormTextViewCell.swift │ └── base │ │ ├── FormBaseCell.swift │ │ ├── FormTitleCell.swift │ │ └── FormValueCell.swift │ ├── controllers │ ├── FormOptionsViewController.swift │ ├── FormSelector.swift │ └── FormViewController.swift │ └── descriptors │ ├── FormDescriptor.swift │ ├── FormRowDescriptor.swift │ └── FormSectionDescriptor.swift ├── SwiftForms.podspec ├── SwiftForms.xcodeproj ├── SwiftForms_Info.plist ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── SwiftForms-Package.xcscheme ├── SwiftFormsApplication.xcodeproj └── project.pbxproj └── SwiftFormsApplication ├── AppDelegate.swift ├── Base.lproj └── Main.storyboard ├── Example.gif ├── ExampleFormViewController.swift ├── Images.xcassets ├── AppIcon.appiconset │ └── Contents.json └── LaunchImage.launchimage │ ├── Contents.json │ └── iphone5_splash.png ├── Info.plist ├── Launch.storyboard ├── Screenshot.png └── ViewController.swift /.build/manifest.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ortuman/SwiftForms/9723a32dd15b7f341abb99d2a530f756f7098026/.build/manifest.db -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.db 37 | Thumbs.db 38 | 39 | # Pods # 40 | ######## 41 | Pods/ 42 | 43 | # Xcode # 44 | ######### 45 | build/ 46 | *.pbxuser 47 | !default.pbxuser 48 | *.mode1v3 49 | !default.mode1v3 50 | *.mode2v3 51 | !default.mode2v3 52 | *.perspectivev3 53 | !default.perspectivev3 54 | *.xcworkspace 55 | !default.xcworkspace 56 | xcuserdata 57 | profile 58 | *.moved-aside 59 | DerivedData 60 | .idea/ 61 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 4.2 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com ) 4 | Copyright (c) 2014 Miguel Ángel Ortuño ( ortuman@gmail.com ) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "SwiftForms", 8 | platforms: [ 9 | .iOS(.v10), 10 | ], 11 | products: [ 12 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 13 | .library( 14 | name: "SwiftForms", 15 | targets: ["SwiftForms"]), 16 | ], 17 | dependencies: [ 18 | // Dependencies declare other packages that this package depends on. 19 | // .package(url: /* package url */, from: "1.0.0"), 20 | ], 21 | targets: [ 22 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 23 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 24 | .target( 25 | name: "SwiftForms", 26 | dependencies: [], 27 | path: "Sources"), 28 | ] 29 | ) 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Version](https://img.shields.io/badge/pod-1.8.4-orange.svg)](http://cocoadocs.org/docsets/SwiftForms) 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | 5 | [![License](https://img.shields.io/badge/license-MIT-gray.svg)](http://cocoadocs.org/docsets/SwiftForms) 6 | [![Platform](https://img.shields.io/badge/platform-iOS-lightgrey.svg)](http://cocoadocs.org/docsets/SwiftForms) 7 | 8 | SwiftForms 9 | ========== 10 | 11 | Purpose 12 | ------- 13 | 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. 14 | 15 | Here is an screenshot from an example application using SwiftForms 16 | 17 | ![Screenshot of Example application](SwiftFormsApplication/Example.gif) 18 | 19 | How to create a form 20 | -------------------- 21 | 22 | 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. 23 | 24 | ```swift 25 | 26 | // Create form instace 27 | var form = FormDescriptor() 28 | form.title = "Example form" 29 | 30 | // Define first section 31 | var section1 = FormSectionDescriptor() 32 | 33 | var row = FormRowDescriptor(tag: "name", rowType: .Email, title: "Email") 34 | section1.rows.append(row) 35 | 36 | row = FormRowDescriptor(tag: "pass", rowType: .Password, title: "Password") 37 | section1.rows.append(row) 38 | 39 | // Define second section 40 | var section2 = FormSectionDescriptor() 41 | 42 | row = FormRowDescriptor(tag: "button", rowType: .Button, title: "Submit") 43 | section2.rows.append(row) 44 | 45 | form.sections = [section1, section2] 46 | 47 | self.form = form 48 | ``` 49 | To see a more complex form definition you can take a look to the example application. 50 | 51 | Cell appearance 52 | ---------------------- 53 | 54 | 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. 55 | 56 | Here's an example: 57 | 58 | ```swift 59 | row.configuration.cell.appearance = ["titleLabel.font" : UIFont.boldSystemFontOfSize(30.0), "segmentedControl.tintColor" : UIColor.redColor()] 60 | ``` 61 | 62 | Custom cells 63 | ----------------- 64 | 65 | 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. 66 | 67 | Here are the methods that help you to define custom cell behavior. 68 | ```swift 69 | func configure() { 70 | /// override 71 | } 72 | 73 | func update() { 74 | /// override 75 | } 76 | 77 | class func formRowCellHeight() -> CGFloat { 78 | return 44.0 79 | } 80 | 81 | class func formViewController(formViewController: FormViewController, didSelectRow: FormBaseCell) { 82 | } 83 | ``` 84 | 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. 85 | 86 | Custom selector controllers 87 | ------------------------------------- 88 | 89 | 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. 90 | 91 | After defining your class, don't forget to set `row.configuration.selection.controllerClass` value in the configuration dictionary to use your custom selector controller. 92 | 93 | Requirements 94 | --------------------- 95 | 96 | * iOS 8.0 and above 97 | 98 | ### CocoaPods 99 | 100 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. 101 | 102 | CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command: 103 | 104 | ```bash 105 | $ gem install cocoapods 106 | ``` 107 | 108 | To integrate SwiftForms into your Xcode project using CocoaPods, specify it in your `Podfile`: 109 | 110 | ```ruby 111 | source 'https://github.com/CocoaPods/Specs.git' 112 | platform :ios, '8.0' 113 | use_frameworks! 114 | 115 | pod 'SwiftForms' 116 | ``` 117 | 118 | Then, run the following command: 119 | 120 | ```bash 121 | $ pod install 122 | ``` 123 | 124 | ### Carthage 125 | 126 | Simply add the following line to your `Cartfile`: 127 | 128 | ``` 129 | github "ortuman/SwiftForms" 130 | ``` 131 | 132 | Then run: 133 | 134 | ```bash 135 | $ carthage update 136 | ``` 137 | 138 | For more information on [Carthage](https://github.com/Carthage/Carthage) see the [README](https://github.com/Carthage/Carthage/blob/master/README.md) 139 | 140 | Copyright 141 | --------- 142 | 143 | SwiftForms is originally based on XLForm github project. (https://github.com/xmartlabs/XLForm) 144 | 145 | Check LICENSE file for more details. 146 | 147 | Contact 148 | ------- 149 | 150 | If you are using SwiftForms in your project and have any suggestion or question: 151 | 152 | Miguel Angel Ortuño, 153 | 154 | [@ortuman](http://twitter.com/ortuman) 155 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/FormErrorType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormErrorType.swift 3 | // SwiftFormsApplication 4 | // 5 | // Created by Miguel Angel Ortuno Ortuno on 2/1/16. 6 | // Copyright © 2016 Miguel Angel Ortuno Ortuno. All rights reserved. 7 | // 8 | 9 | public enum FormErrorType: Error { 10 | case sectionOutOfIndex 11 | case rowOutOfIndex 12 | } 13 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/SwiftForms.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftForms.h 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno Ortuno on 14/5/15. 6 | // Copyright (c) 2015 Miguel Angel Ortuno Ortuno. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SwiftForms. 12 | FOUNDATION_EXPORT double SwiftFormsVersionNumber; 13 | 14 | //! Project version string for SwiftForms. 15 | FOUNDATION_EXPORT const unsigned char SwiftFormsVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormButtonCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormButtonCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 21/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormButtonCell: FormTitleCell { 12 | 13 | // MARK: FormBaseCell 14 | 15 | open override func configure() { 16 | super.configure() 17 | titleLabel.textAlignment = .center 18 | } 19 | 20 | open override func update() { 21 | super.update() 22 | titleLabel.text = rowDescriptor?.title 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormCheckCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormCheckCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 22/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormCheckCell: FormTitleCell { 12 | 13 | // MARK: FormBaseCell 14 | 15 | open override func configure() { 16 | super.configure() 17 | selectionStyle = .default 18 | accessoryType = .none 19 | } 20 | 21 | open override func update() { 22 | super.update() 23 | 24 | titleLabel.text = rowDescriptor?.title 25 | 26 | var rowValue: Bool 27 | if let value = rowDescriptor?.value as? Bool { 28 | rowValue = value 29 | } else { 30 | rowValue = false 31 | rowDescriptor?.value = rowValue as AnyObject 32 | } 33 | 34 | accessoryType = (rowValue) ? .checkmark : .none 35 | } 36 | 37 | open override class func formViewController(_ formViewController: FormViewController, didSelectRow selectedRow: FormBaseCell) { 38 | guard let row = selectedRow as? FormCheckCell else { return } 39 | row.check() 40 | } 41 | 42 | // MARK: Private interface 43 | 44 | fileprivate func check() { 45 | var newValue: Bool 46 | if let value = rowDescriptor?.value as? Bool { 47 | newValue = !value 48 | } 49 | else { 50 | newValue = true 51 | } 52 | rowDescriptor?.value = newValue as AnyObject 53 | update() 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormDateCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormDateCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 22/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormDateCell: FormValueCell { 12 | 13 | // MARK: Properties 14 | 15 | private let datePicker = UIDatePicker() 16 | private let hiddenTextField = UITextField(frame: CGRect.zero) 17 | 18 | private let defaultDateFormatter = DateFormatter() 19 | 20 | // MARK: FormBaseCell 21 | 22 | open override func configure() { 23 | super.configure() 24 | contentView.addSubview(hiddenTextField) 25 | hiddenTextField.inputView = datePicker 26 | hiddenTextField.isAccessibilityElement = false 27 | datePicker.datePickerMode = .date 28 | datePicker.addTarget(self, action: #selector(FormDateCell.valueChanged(_:)), for: .valueChanged) 29 | } 30 | 31 | open override func update() { 32 | super.update() 33 | 34 | if let showsInputToolbar = rowDescriptor?.configuration.cell.showsInputToolbar , showsInputToolbar && hiddenTextField.inputAccessoryView == nil { 35 | hiddenTextField.inputAccessoryView = inputAccesoryView() 36 | } 37 | 38 | titleLabel.text = rowDescriptor?.title 39 | 40 | if let rowType = rowDescriptor?.type { 41 | switch rowType { 42 | case .date: 43 | datePicker.datePickerMode = .date 44 | defaultDateFormatter.dateStyle = .long 45 | defaultDateFormatter.timeStyle = .none 46 | case .time: 47 | datePicker.datePickerMode = .time 48 | defaultDateFormatter.dateStyle = .none 49 | defaultDateFormatter.timeStyle = .short 50 | default: 51 | datePicker.datePickerMode = .dateAndTime 52 | defaultDateFormatter.dateStyle = .long 53 | defaultDateFormatter.timeStyle = .short 54 | } 55 | } 56 | 57 | if let date = rowDescriptor?.value as? Date { 58 | datePicker.date = date 59 | valueLabel.text = getDateFormatter().string(from: date) 60 | } 61 | } 62 | 63 | open override class func formViewController(_ formViewController: FormViewController, didSelectRow selectedRow: FormBaseCell) { 64 | guard let row = selectedRow as? FormDateCell else { return } 65 | 66 | if row.rowDescriptor?.value == nil { 67 | let date = Date() 68 | row.rowDescriptor?.value = date as AnyObject 69 | row.valueLabel.text = row.getDateFormatter().string(from: date) 70 | row.update() 71 | } 72 | 73 | row.hiddenTextField.becomeFirstResponder() 74 | } 75 | 76 | open override func firstResponderElement() -> UIResponder? { 77 | return hiddenTextField 78 | } 79 | 80 | open override class func formRowCanBecomeFirstResponder() -> Bool { 81 | return true 82 | } 83 | 84 | // MARK: Actions 85 | 86 | @objc internal func valueChanged(_ sender: UIDatePicker) { 87 | rowDescriptor?.value = sender.date as AnyObject 88 | valueLabel.text = getDateFormatter().string(from: sender.date) 89 | update() 90 | } 91 | 92 | // MARK: Private interface 93 | 94 | fileprivate func getDateFormatter() -> DateFormatter { 95 | guard let dateFormatter = rowDescriptor?.configuration.date.dateFormatter else { return defaultDateFormatter } 96 | return dateFormatter 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormLabelCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormTextFieldCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 20/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormLabelCell: FormValueCell { 12 | 13 | /// MARK: FormBaseCell 14 | 15 | override open func configure() { 16 | super.configure() 17 | 18 | accessoryType = .none 19 | 20 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 21 | valueLabel.translatesAutoresizingMaskIntoConstraints = false 22 | 23 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 24 | valueLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 25 | 26 | valueLabel.textColor = UIColor.lightGray 27 | valueLabel.textAlignment = .right 28 | 29 | contentView.addSubview(titleLabel) 30 | contentView.addSubview(valueLabel) 31 | 32 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 33 | titleLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1000), for: .horizontal) 34 | 35 | // apply constant constraints 36 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 37 | contentView.addConstraint(NSLayoutConstraint(item: valueLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 38 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 39 | contentView.addConstraint(NSLayoutConstraint(item: valueLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 40 | } 41 | 42 | override open func update() { 43 | super.update() 44 | 45 | titleLabel.text = rowDescriptor?.title 46 | valueLabel.text = rowDescriptor?.configuration.cell.placeholder 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormPickerCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormPickerCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 22/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormPickerCell: FormValueCell, UIPickerViewDelegate, UIPickerViewDataSource { 12 | 13 | // MARK: Properties 14 | 15 | private let picker = UIPickerView() 16 | private let hiddenTextField = UITextField(frame: CGRect.zero) 17 | 18 | // MARK: FormBaseCell 19 | 20 | open override func configure() { 21 | super.configure() 22 | accessoryType = .none 23 | 24 | picker.delegate = self 25 | picker.dataSource = self 26 | hiddenTextField.inputView = picker 27 | hiddenTextField.isAccessibilityElement = false 28 | 29 | contentView.addSubview(hiddenTextField) 30 | } 31 | 32 | open override func update() { 33 | super.update() 34 | picker.reloadAllComponents() 35 | 36 | if let showsInputToolbar = rowDescriptor?.configuration.cell.showsInputToolbar , showsInputToolbar && hiddenTextField.inputAccessoryView == nil { 37 | hiddenTextField.inputAccessoryView = inputAccesoryView() 38 | } 39 | 40 | titleLabel.text = rowDescriptor?.title 41 | valueLabel.text = "" 42 | 43 | if let selectedValue = rowDescriptor?.value { 44 | valueLabel.text = rowDescriptor?.configuration.selection.optionTitleClosure?(selectedValue) 45 | if let options = rowDescriptor?.configuration.selection.options , !options.isEmpty { 46 | var selectedIndex: Int? 47 | for (index, value) in options.enumerated() { 48 | if value === selectedValue { 49 | selectedIndex = index 50 | break 51 | } 52 | } 53 | if let index = selectedIndex { 54 | picker.selectRow(index, inComponent: 0, animated: false) 55 | } 56 | } 57 | } 58 | } 59 | 60 | open override func firstResponderElement() -> UIResponder? { 61 | return hiddenTextField 62 | } 63 | 64 | open override class func formViewController(_ formViewController: FormViewController, didSelectRow selectedRow: FormBaseCell) { 65 | guard let row = selectedRow as? FormPickerCell else { return } 66 | 67 | if selectedRow.rowDescriptor?.value == nil { 68 | guard let options = selectedRow.rowDescriptor?.configuration.selection.options , !options.isEmpty else { return } 69 | let value = options[0] 70 | selectedRow.rowDescriptor?.value = value 71 | row.valueLabel.text = selectedRow.rowDescriptor?.configuration.selection.optionTitleClosure?(value) 72 | row.hiddenTextField.becomeFirstResponder() 73 | } else { 74 | guard let value = selectedRow.rowDescriptor?.value else { return } 75 | row.valueLabel.text = selectedRow.rowDescriptor?.configuration.selection.optionTitleClosure?(value) 76 | row.hiddenTextField.becomeFirstResponder() 77 | } 78 | } 79 | 80 | // MARK: UIPickerViewDelegate 81 | 82 | open func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { 83 | guard let options = rowDescriptor?.configuration.selection.options , !options.isEmpty else { return nil } 84 | guard row < options.count else { return nil } 85 | return rowDescriptor?.configuration.selection.optionTitleClosure?(options[row]) 86 | } 87 | 88 | open func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { 89 | guard let options = rowDescriptor?.configuration.selection.options , !options.isEmpty else { return } 90 | guard row < options.count else { return } 91 | let newValue = options[row] 92 | rowDescriptor?.value = newValue 93 | valueLabel.text = rowDescriptor?.configuration.selection.optionTitleClosure?(newValue) 94 | } 95 | 96 | // MARK: UIPickerViewDataSource 97 | 98 | open func numberOfComponents(in pickerView: UIPickerView) -> Int { 99 | return 1 100 | } 101 | 102 | open func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { 103 | guard let options = rowDescriptor?.configuration.selection.options else { return 0 } 104 | return options.count 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormSegmentedControlCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSegmentedControlCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 21/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc(FormSegmentedControlCell) 12 | open class FormSegmentedControlCell: FormBaseCell { 13 | 14 | // MARK: Cell views 15 | 16 | @objc public let titleLabel = UILabel() 17 | @objc public let segmentedControl = UISegmentedControl() 18 | 19 | // MARK: Properties 20 | 21 | fileprivate var customConstraints: [AnyObject] = [] 22 | 23 | // MARK: FormBaseCell 24 | 25 | open override func configure() { 26 | super.configure() 27 | 28 | selectionStyle = .none 29 | 30 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 31 | segmentedControl.translatesAutoresizingMaskIntoConstraints = false 32 | 33 | titleLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 500), for: .horizontal) 34 | segmentedControl.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 500), for: .horizontal) 35 | 36 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 37 | 38 | contentView.addSubview(titleLabel) 39 | contentView.addSubview(segmentedControl) 40 | 41 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 42 | contentView.addConstraint(NSLayoutConstraint(item: segmentedControl, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 43 | 44 | segmentedControl.addTarget(self, action: #selector(FormSegmentedControlCell.valueChanged(_:)), for: .valueChanged) 45 | } 46 | 47 | open override func update() { 48 | super.update() 49 | 50 | titleLabel.text = rowDescriptor?.title 51 | updateSegmentedControl() 52 | 53 | guard let value = rowDescriptor?.value else { return } 54 | guard let options = rowDescriptor?.configuration.selection.options , !options.isEmpty else { return } 55 | 56 | var idx = 0 57 | for optionValue in options { 58 | if optionValue === value { 59 | segmentedControl.selectedSegmentIndex = idx 60 | break 61 | } 62 | idx += 1 63 | } 64 | } 65 | 66 | open override func constraintsViews() -> [String : UIView] { 67 | return ["titleLabel" : titleLabel, "segmentedControl" : segmentedControl] 68 | } 69 | 70 | open override func defaultVisualConstraints() -> [String] { 71 | if let text = titleLabel.text , text.count > 0 { 72 | return ["H:|-16-[titleLabel]-16-[segmentedControl]-16-|"] 73 | } else { 74 | return ["H:|-16-[segmentedControl]-16-|"] 75 | } 76 | } 77 | 78 | // MARK: Actions 79 | 80 | @objc internal func valueChanged(_ sender: UISegmentedControl) { 81 | guard let options = rowDescriptor?.configuration.selection.options , !options.isEmpty else { return } 82 | let value = options[sender.selectedSegmentIndex] 83 | rowDescriptor?.value = value 84 | } 85 | 86 | // MARK: Private 87 | 88 | fileprivate func updateSegmentedControl() { 89 | segmentedControl.removeAllSegments() 90 | 91 | guard let options = rowDescriptor?.configuration.selection.options , !options.isEmpty else { return } 92 | 93 | var idx = 0 94 | for value in options { 95 | let title = rowDescriptor?.configuration.selection.optionTitleClosure?(value) 96 | segmentedControl.insertSegment(withTitle: title, at: idx, animated: false) 97 | idx += 1 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormSelectorCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSelectorCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 23/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormSelectorCell: FormValueCell { 12 | 13 | // MARK: FormBaseCell 14 | 15 | open override func update() { 16 | super.update() 17 | 18 | titleLabel.text = rowDescriptor?.title 19 | 20 | var title: String? 21 | if let multipleValues = rowDescriptor?.value as? [AnyObject] { 22 | var multipleValuesTitle = "" 23 | for (index, selectedValue) in multipleValues.enumerated() { 24 | guard let selectedValueTitle = rowDescriptor?.configuration.selection.optionTitleClosure?(selectedValue) else { continue } 25 | if index != 0 { 26 | multipleValuesTitle += ", " 27 | } 28 | multipleValuesTitle += selectedValueTitle 29 | } 30 | title = multipleValuesTitle 31 | } else if let singleValue = rowDescriptor?.value { 32 | title = rowDescriptor?.configuration.selection.optionTitleClosure?(singleValue) 33 | } 34 | 35 | if let title = title , title.count > 0 { 36 | valueLabel.text = title 37 | valueLabel.textColor = UIColor.black 38 | } else { 39 | valueLabel.text = rowDescriptor?.configuration.cell.placeholder 40 | valueLabel.textColor = UIColor.lightGray 41 | } 42 | } 43 | 44 | open override class func formViewController(_ formViewController: FormViewController, didSelectRow selectedRow: FormBaseCell) { 45 | guard let row = selectedRow as? FormSelectorCell else { return } 46 | 47 | formViewController.view.endEditing(true) 48 | 49 | var selectorControllerClass: UIViewController.Type 50 | 51 | if let controllerClass = row.rowDescriptor?.configuration.selection.controllerClass as? UIViewController.Type { 52 | selectorControllerClass = controllerClass 53 | } else { // fallback to default cell class 54 | selectorControllerClass = FormOptionsSelectorController.self 55 | } 56 | 57 | let selectorController = selectorControllerClass.init() 58 | guard let formRowDescriptorViewController = selectorController as? FormSelector else { return } 59 | 60 | formRowDescriptorViewController.formCell = row 61 | formViewController.navigationController?.pushViewController(selectorController, animated: true) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormSliderCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSliderCell.swift 3 | // SwiftFormsApplication 4 | // 5 | // Created by Miguel Angel Ortuno Ortuno on 23/5/15. 6 | // Copyright (c) 2015 Miguel Angel Ortuno Ortuno. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormSliderCell: FormTitleCell { 12 | 13 | // MARK: Cell views 14 | 15 | @objc public let sliderView = UISlider() 16 | 17 | // MARK: FormBaseCell 18 | 19 | open override func configure() { 20 | super.configure() 21 | 22 | selectionStyle = .none 23 | 24 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 25 | sliderView.translatesAutoresizingMaskIntoConstraints = false 26 | 27 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 28 | 29 | contentView.addSubview(titleLabel) 30 | contentView.addSubview(sliderView) 31 | 32 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 33 | 34 | contentView.addConstraint(NSLayoutConstraint(item: sliderView, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 35 | 36 | sliderView.addTarget(self, action: #selector(FormSliderCell.valueChanged(_:)), for: .valueChanged) 37 | } 38 | 39 | open override func update() { 40 | super.update() 41 | 42 | if let maximumValue = rowDescriptor?.configuration.stepper.maximumValue { sliderView.maximumValue = Float(maximumValue) } 43 | if let minimumValue = rowDescriptor?.configuration.stepper.minimumValue { sliderView.minimumValue = Float(minimumValue) } 44 | if let continuous = rowDescriptor?.configuration.stepper.continuous { sliderView.isContinuous = continuous } 45 | 46 | titleLabel.text = rowDescriptor?.title 47 | 48 | if let value = rowDescriptor?.value as? Float { 49 | sliderView.value = value 50 | } else { 51 | sliderView.value = sliderView.minimumValue 52 | rowDescriptor?.value = sliderView.minimumValue as AnyObject 53 | } 54 | } 55 | 56 | open override func constraintsViews() -> [String : UIView] { 57 | return ["titleLabel" : titleLabel, "sliderView" : sliderView] 58 | } 59 | 60 | open override func defaultVisualConstraints() -> [String] { 61 | var constraints: [String] = [] 62 | 63 | constraints.append("V:|[titleLabel]|") 64 | constraints.append("H:|-16-[titleLabel]-16-[sliderView]-16-|") 65 | 66 | return constraints 67 | } 68 | 69 | // MARK: Actions 70 | 71 | @objc internal func valueChanged(_: UISlider) { 72 | rowDescriptor?.value = sliderView.value as AnyObject 73 | update() 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormStepperCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormStepperCell.swift 3 | // SwiftFormsApplication 4 | // 5 | // Created by Miguel Angel Ortuno Ortuno on 23/5/15. 6 | // Copyright (c) 2015 Miguel Angel Ortuno Ortuno. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormStepperCell: FormTitleCell { 12 | 13 | // MARK: Cell views 14 | 15 | public let stepperView = UIStepper() 16 | public let countLabel = UILabel() 17 | 18 | // MARK: FormBaseCell 19 | 20 | open override func configure() { 21 | super.configure() 22 | 23 | selectionStyle = .none 24 | 25 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 26 | stepperView.translatesAutoresizingMaskIntoConstraints = false 27 | countLabel.translatesAutoresizingMaskIntoConstraints = false 28 | 29 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 30 | countLabel.textAlignment = .right 31 | 32 | contentView.addSubview(titleLabel) 33 | contentView.addSubview(countLabel) 34 | contentView.addSubview(stepperView) 35 | 36 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 37 | 38 | contentView.addConstraint(NSLayoutConstraint(item: stepperView, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 39 | 40 | stepperView.addTarget(self, action: #selector(FormStepperCell.valueChanged(_:)), for: .valueChanged) 41 | } 42 | 43 | open override func update() { 44 | super.update() 45 | 46 | if let maximumValue = rowDescriptor?.configuration.stepper.maximumValue { stepperView.maximumValue = maximumValue } 47 | if let minimumValue = rowDescriptor?.configuration.stepper.minimumValue { stepperView.minimumValue = minimumValue } 48 | if let steps = rowDescriptor?.configuration.stepper.steps { stepperView.stepValue = steps } 49 | 50 | titleLabel.text = rowDescriptor?.title 51 | 52 | if let value = rowDescriptor?.value as? Double { 53 | stepperView.value = value 54 | countLabel.text = String(value) 55 | } else { 56 | stepperView.value = stepperView.minimumValue 57 | rowDescriptor?.value = stepperView.minimumValue as AnyObject 58 | countLabel.text = String(stepperView.minimumValue) 59 | } 60 | } 61 | 62 | open override func constraintsViews() -> [String : UIView] { 63 | return ["titleLabel" : titleLabel, "countLabel" : countLabel, "stepperView" : stepperView] 64 | } 65 | 66 | open override func defaultVisualConstraints() -> [String] { 67 | var constraints: [String] = [] 68 | 69 | constraints.append("V:|[titleLabel]|") 70 | constraints.append("V:|[countLabel]|") 71 | 72 | constraints.append("H:|-16-[titleLabel][countLabel]-[stepperView]-16-|") 73 | return constraints 74 | } 75 | 76 | // MARK: Actions 77 | 78 | @objc internal func valueChanged(_: UISwitch) { 79 | rowDescriptor?.value = stepperView.value as AnyObject 80 | update() 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormSwitchCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSwitchCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 21/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormSwitchCell: FormTitleCell { 12 | 13 | // MARK: Cell views 14 | 15 | public let switchView = UISwitch() 16 | 17 | // MARK: FormBaseCell 18 | 19 | open override func configure() { 20 | super.configure() 21 | 22 | selectionStyle = .none 23 | 24 | switchView.addTarget(self, action: #selector(FormSwitchCell.valueChanged(_:)), for: .valueChanged) 25 | accessoryView = switchView 26 | } 27 | 28 | open override func update() { 29 | super.update() 30 | 31 | titleLabel.text = rowDescriptor?.title 32 | 33 | if let value = rowDescriptor?.value as? Bool { 34 | switchView.isOn = value 35 | } else { 36 | switchView.isOn = false 37 | rowDescriptor?.value = false as AnyObject 38 | } 39 | } 40 | 41 | // MARK: Actions 42 | 43 | @objc internal func valueChanged(_: UISwitch) { 44 | rowDescriptor?.value = switchView.isOn as AnyObject 45 | update() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormTextFieldCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormTextFieldCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 20/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormTextFieldCell: FormBaseCell { 12 | 13 | // MARK: Cell views 14 | 15 | public let titleLabel = UILabel() 16 | @objc public let textField = UITextField() 17 | 18 | // MARK: Properties 19 | 20 | fileprivate var customConstraints: [AnyObject] = [] 21 | 22 | // MARK: FormBaseCell 23 | 24 | open override func configure() { 25 | super.configure() 26 | 27 | selectionStyle = .none 28 | 29 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 30 | textField.translatesAutoresizingMaskIntoConstraints = false 31 | 32 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 33 | textField.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 34 | 35 | contentView.addSubview(titleLabel) 36 | contentView.addSubview(textField) 37 | 38 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 39 | titleLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1000), for: .horizontal) 40 | 41 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 42 | contentView.addConstraint(NSLayoutConstraint(item: textField, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 43 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 44 | contentView.addConstraint(NSLayoutConstraint(item: textField, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 45 | 46 | textField.addTarget(self, action: #selector(FormTextFieldCell.editingChanged(_:)), for: .editingChanged) 47 | } 48 | 49 | open override func update() { 50 | super.update() 51 | 52 | if let showsInputToolbar = rowDescriptor?.configuration.cell.showsInputToolbar , showsInputToolbar && textField.inputAccessoryView == nil { 53 | textField.inputAccessoryView = inputAccesoryView() 54 | } 55 | 56 | titleLabel.text = rowDescriptor?.title 57 | textField.text = rowDescriptor?.value as? String 58 | textField.placeholder = rowDescriptor?.configuration.cell.placeholder 59 | 60 | textField.isSecureTextEntry = false 61 | textField.clearButtonMode = .whileEditing 62 | 63 | if let type = rowDescriptor?.type { 64 | switch type { 65 | case .text: 66 | textField.autocorrectionType = .default 67 | textField.autocapitalizationType = .sentences 68 | textField.keyboardType = .default 69 | case .number: 70 | textField.keyboardType = .numberPad 71 | case .numbersAndPunctuation: 72 | textField.keyboardType = .numbersAndPunctuation 73 | case .decimal: 74 | textField.keyboardType = .decimalPad 75 | case .name: 76 | textField.autocorrectionType = .no 77 | textField.autocapitalizationType = .words 78 | textField.keyboardType = .default 79 | case .phone: 80 | textField.keyboardType = .phonePad 81 | case .namePhone: 82 | textField.autocorrectionType = .no 83 | textField.autocapitalizationType = .words 84 | textField.keyboardType = .namePhonePad 85 | case .url: 86 | textField.autocorrectionType = .no 87 | textField.autocapitalizationType = .none 88 | textField.keyboardType = .URL 89 | case .twitter: 90 | textField.autocorrectionType = .no 91 | textField.autocapitalizationType = .none 92 | textField.keyboardType = .twitter 93 | case .email: 94 | textField.autocorrectionType = .no 95 | textField.autocapitalizationType = .none 96 | textField.keyboardType = .emailAddress 97 | case .asciiCapable: 98 | textField.autocorrectionType = .no 99 | textField.autocapitalizationType = .none 100 | textField.keyboardType = .asciiCapable 101 | case .password: 102 | textField.isSecureTextEntry = true 103 | textField.clearsOnBeginEditing = false 104 | default: 105 | break 106 | } 107 | } 108 | } 109 | 110 | open override func constraintsViews() -> [String : UIView] { 111 | var views = ["titleLabel" : titleLabel, "textField" : textField] 112 | if self.imageView!.image != nil { 113 | views["imageView"] = imageView 114 | } 115 | return views 116 | } 117 | 118 | open override func defaultVisualConstraints() -> [String] { 119 | if self.imageView!.image != nil { 120 | if titleLabel.text != nil && (titleLabel.text!).count > 0 { 121 | return ["H:[imageView]-[titleLabel]-[textField]-16-|"] 122 | } else { 123 | return ["H:[imageView]-[textField]-16-|"] 124 | } 125 | } else { 126 | if titleLabel.text != nil && (titleLabel.text!).count > 0 { 127 | return ["H:|-16-[titleLabel]-[textField]-16-|"] 128 | } else { 129 | return ["H:|-16-[textField]-16-|"] 130 | } 131 | } 132 | } 133 | 134 | open override func firstResponderElement() -> UIResponder? { 135 | return textField 136 | } 137 | 138 | open override class func formRowCanBecomeFirstResponder() -> Bool { 139 | return true 140 | } 141 | 142 | // MARK: Actions 143 | 144 | @objc func editingChanged(_ sender: UITextField) { 145 | guard let text = sender.text, text.count > 0 else { rowDescriptor?.value = nil; update(); return } 146 | rowDescriptor?.value = text as AnyObject 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/FormTextViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormTextViewCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Joey Padot on 12/6/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormTextViewCell : FormBaseCell, UITextViewDelegate { 12 | 13 | // MARK: Cell views 14 | 15 | @objc public let titleLabel = UILabel() 16 | @objc public let textField = UITextView() 17 | 18 | // MARK: Properties 19 | 20 | fileprivate var customConstraints: [AnyObject]! 21 | 22 | // MARK: Class Funcs 23 | 24 | open override class func formRowCellHeight() -> CGFloat { 25 | return 110.0 26 | } 27 | 28 | // MARK: FormBaseCell 29 | 30 | open override func configure() { 31 | super.configure() 32 | 33 | selectionStyle = .none 34 | 35 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 36 | textField.translatesAutoresizingMaskIntoConstraints = false 37 | 38 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 39 | textField.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 40 | 41 | contentView.addSubview(titleLabel) 42 | contentView.addSubview(textField) 43 | 44 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 45 | 46 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 47 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 48 | contentView.addConstraint(NSLayoutConstraint(item: textField, attribute: .top, relatedBy: .equal, toItem: contentView, attribute: .top, multiplier: 1.0, constant: 0.0)) 49 | contentView.addConstraint(NSLayoutConstraint(item: textField, attribute: .bottom, relatedBy: .equal, toItem: contentView, attribute: .bottom, multiplier: 1.0, constant: 0.0)) 50 | 51 | textField.delegate = self 52 | } 53 | 54 | open override func update() { 55 | 56 | titleLabel.text = rowDescriptor?.title 57 | textField.text = rowDescriptor?.value as? String 58 | 59 | textField.isSecureTextEntry = false 60 | textField.autocorrectionType = .default 61 | textField.autocapitalizationType = .sentences 62 | textField.keyboardType = .default 63 | } 64 | 65 | open override func constraintsViews() -> [String : UIView] { 66 | var views = ["titleLabel" : titleLabel, "textField" : textField] 67 | if self.imageView!.image != nil { 68 | views["imageView"] = imageView 69 | } 70 | return views 71 | } 72 | 73 | open override func defaultVisualConstraints() -> [String] { 74 | if self.imageView!.image != nil { 75 | if let text = titleLabel.text , text.count > 0 { 76 | return ["H:[imageView]-[titleLabel]-[textField]-16-|"] 77 | } else { 78 | return ["H:[imageView]-[textField]-16-|"] 79 | } 80 | } else { 81 | if let text = titleLabel.text , text.count > 0 { 82 | return ["H:|-16-[titleLabel]-[textField]-16-|"] 83 | } else { 84 | return ["H:|-16-[textField]-16-|"] 85 | } 86 | } 87 | } 88 | 89 | // MARK: UITextViewDelegate 90 | 91 | open func textViewDidChange(_ textView: UITextView) { 92 | guard let text = textView.text , text.count > 0 else { rowDescriptor?.value = nil; update(); return } 93 | rowDescriptor?.value = text as AnyObject 94 | update() 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/base/FormBaseCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormBaseCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 20/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormBaseCell: UITableViewCell { 12 | 13 | // MARK: Properties 14 | 15 | open var rowDescriptor: FormRowDescriptor? { 16 | didSet { 17 | self.update() 18 | } 19 | } 20 | 21 | open weak var formViewController: FormViewController? 22 | 23 | fileprivate var customConstraints: [NSLayoutConstraint] = [] 24 | 25 | // MARK: Init 26 | 27 | public required override init(style: UITableViewCell.CellStyle, reuseIdentifier: String!) { 28 | super.init(style: style, reuseIdentifier: reuseIdentifier) 29 | } 30 | 31 | public required init?(coder aDecoder: NSCoder) { 32 | super.init(coder: aDecoder) 33 | } 34 | 35 | // MARK: Public interface 36 | 37 | open func configure() { 38 | /// override 39 | } 40 | 41 | open func update() { 42 | /// override 43 | } 44 | 45 | open func defaultVisualConstraints() -> [String] { 46 | /// override 47 | return [] 48 | } 49 | 50 | open func constraintsViews() -> [String : UIView] { 51 | /// override 52 | return [:] 53 | } 54 | 55 | open func firstResponderElement() -> UIResponder? { 56 | /// override 57 | return nil 58 | } 59 | 60 | open func inputAccesoryView() -> UIToolbar { 61 | 62 | let actionBar = UIToolbar() 63 | actionBar.isTranslucent = true 64 | actionBar.sizeToFit() 65 | actionBar.barStyle = .default 66 | 67 | let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(FormBaseCell.handleDoneAction(_:))) 68 | let flexible = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) 69 | actionBar.items = [flexible, doneButton] 70 | 71 | return actionBar 72 | } 73 | 74 | @objc internal func handleDoneAction(_: UIBarButtonItem) { 75 | firstResponderElement()?.resignFirstResponder() 76 | } 77 | 78 | open class func formRowCellHeight() -> CGFloat { 79 | return 44.0 80 | } 81 | 82 | open class func formRowCanBecomeFirstResponder() -> Bool { 83 | return false 84 | } 85 | 86 | open class func formViewController(_ formViewController: FormViewController, didSelectRow: FormBaseCell) { 87 | } 88 | 89 | // MARK: Constraints 90 | 91 | open override func updateConstraints() { 92 | if customConstraints.count > 0 { 93 | contentView.removeConstraints(customConstraints) 94 | } 95 | 96 | let views = constraintsViews() 97 | 98 | customConstraints.removeAll() 99 | 100 | var visualConstraints = [String]() 101 | 102 | if let visualConstraintsClosure = rowDescriptor?.configuration.cell.visualConstraintsClosure { 103 | visualConstraints = visualConstraintsClosure(self) 104 | } else { 105 | visualConstraints = defaultVisualConstraints() 106 | } 107 | 108 | for visualConstraint in visualConstraints { 109 | let constraints = NSLayoutConstraint.constraints(withVisualFormat: visualConstraint, options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views) 110 | for constraint in constraints { 111 | customConstraints.append(constraint) 112 | } 113 | } 114 | 115 | contentView.addConstraints(customConstraints) 116 | super.updateConstraints() 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/base/FormTitleCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormTitleCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 13/11/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormTitleCell: FormBaseCell { 12 | 13 | // MARK: Cell views 14 | 15 | @objc public let titleLabel = UILabel() 16 | 17 | // MARK: FormBaseCell 18 | 19 | open override func configure() { 20 | super.configure() 21 | 22 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 23 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 24 | 25 | // apply constant constraints 26 | contentView.addSubview(titleLabel) 27 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 28 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 29 | } 30 | 31 | open override func constraintsViews() -> [String : UIView] { 32 | return ["titleLabel" : titleLabel] 33 | } 34 | 35 | open override func defaultVisualConstraints() -> [String] { 36 | return ["H:|-16-[titleLabel]-16-|"] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/cells/base/FormValueCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormValueCell.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 13/11/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormValueCell: FormBaseCell { 12 | 13 | // MARK: Cell views 14 | 15 | @objc public let titleLabel = UILabel() 16 | @objc public let valueLabel = UILabel() 17 | 18 | // MARK: Properties 19 | 20 | fileprivate var customConstraints: [AnyObject]! 21 | 22 | // MARK: FormBaseCell 23 | 24 | open override func configure() { 25 | super.configure() 26 | 27 | accessoryType = .disclosureIndicator 28 | 29 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 30 | valueLabel.translatesAutoresizingMaskIntoConstraints = false 31 | 32 | titleLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 33 | valueLabel.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) 34 | 35 | valueLabel.textColor = UIColor.lightGray 36 | valueLabel.textAlignment = .right 37 | 38 | contentView.addSubview(titleLabel) 39 | contentView.addSubview(valueLabel) 40 | 41 | titleLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 500), for: .horizontal) 42 | titleLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1000), for: .horizontal) 43 | 44 | // apply constant constraints 45 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 46 | contentView.addConstraint(NSLayoutConstraint(item: valueLabel, attribute: .height, relatedBy: .equal, toItem: contentView, attribute: .height, multiplier: 1.0, constant: 0.0)) 47 | contentView.addConstraint(NSLayoutConstraint(item: titleLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 48 | contentView.addConstraint(NSLayoutConstraint(item: valueLabel, attribute: .centerY, relatedBy: .equal, toItem: contentView, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 49 | } 50 | 51 | open override func constraintsViews() -> [String : UIView] { 52 | return ["titleLabel" : titleLabel, "valueLabel" : valueLabel] 53 | } 54 | 55 | open override func defaultVisualConstraints() -> [String] { 56 | 57 | // apply default constraints 58 | var rightPadding = 0 59 | if accessoryType == .none { 60 | rightPadding = 16 61 | } 62 | 63 | if titleLabel.text != nil && (titleLabel.text!).count > 0 { 64 | return ["H:|-16-[titleLabel]-[valueLabel]-\(rightPadding)-|"] 65 | } 66 | else { 67 | return ["H:|-16-[valueLabel]-\(rightPadding)-|"] 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/controllers/FormOptionsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormOptionsSelectorController.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 23/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormOptionsSelectorController: UITableViewController, FormSelector { 12 | 13 | // MARK: FormSelector 14 | 15 | open var formCell: FormBaseCell? 16 | 17 | // MARK: Init 18 | 19 | public init() { 20 | super.init(style: .grouped) 21 | } 22 | 23 | public required init(coder aDecoder: NSCoder) { 24 | super.init(coder: aDecoder)! 25 | } 26 | 27 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 28 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 29 | } 30 | 31 | open override func viewDidLoad() { 32 | super.viewDidLoad() 33 | self.navigationItem.title = formCell?.rowDescriptor?.title 34 | } 35 | 36 | // MARK: UITableViewDataSource 37 | 38 | open override func numberOfSections(in tableView: UITableView) -> Int { 39 | return 1 40 | } 41 | 42 | open override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 43 | guard let options = formCell?.rowDescriptor?.configuration.selection.options , !options.isEmpty else { return 0 } 44 | return options.count 45 | } 46 | 47 | open override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 48 | return 0.1 49 | } 50 | 51 | open override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 52 | 53 | let reuseIdentifier = NSStringFromClass(type(of: self)) 54 | 55 | var cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier) 56 | if cell == nil { 57 | cell = UITableViewCell(style: .default, reuseIdentifier: reuseIdentifier) 58 | } 59 | 60 | let options = formCell!.rowDescriptor!.configuration.selection.options 61 | let optionValue = options[(indexPath as NSIndexPath).row] 62 | 63 | cell?.textLabel?.text = formCell?.rowDescriptor?.configuration.selection.optionTitleClosure?(optionValue) 64 | 65 | if let selectedOptions = formCell?.rowDescriptor?.value as? [AnyObject] { 66 | if let _ = selectedOptions.firstIndex(where: { $0 === optionValue }) { 67 | cell?.accessoryType = .checkmark 68 | } else { 69 | cell?.accessoryType = .none 70 | } 71 | 72 | } else if let selectedOption = formCell?.rowDescriptor?.value { 73 | if optionValue === selectedOption { 74 | cell?.accessoryType = .checkmark 75 | } else { 76 | cell?.accessoryType = .none 77 | } 78 | } 79 | 80 | return cell! 81 | } 82 | 83 | // MARK: UITableViewDelegate 84 | 85 | open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 86 | 87 | let cell = tableView.cellForRow(at: indexPath) 88 | 89 | var allowsMultipleSelection = false 90 | if let allowsMultipleSelectionValue = formCell?.rowDescriptor?.configuration.selection.allowsMultipleSelection { 91 | allowsMultipleSelection = allowsMultipleSelectionValue 92 | } 93 | 94 | let options = formCell!.rowDescriptor!.configuration.selection.options 95 | let selectedOption = options[(indexPath as NSIndexPath).row] 96 | 97 | if allowsMultipleSelection { 98 | if var selectedOptions = formCell?.rowDescriptor?.value as? [AnyObject] { 99 | if let index = selectedOptions.firstIndex(where: { $0 === selectedOption }) { 100 | selectedOptions.remove(at: index) 101 | cell?.accessoryType = .none 102 | } else { 103 | selectedOptions.append(selectedOption) 104 | cell?.accessoryType = .checkmark 105 | } 106 | formCell?.rowDescriptor?.value = selectedOptions as AnyObject 107 | 108 | } else { 109 | formCell?.rowDescriptor?.value = [AnyObject](arrayLiteral: selectedOption) as AnyObject 110 | cell?.accessoryType = .checkmark 111 | } 112 | 113 | } else { 114 | formCell?.rowDescriptor?.value = selectedOption 115 | } 116 | 117 | formCell?.update() 118 | 119 | if allowsMultipleSelection { 120 | tableView.deselectRow(at: indexPath, animated: true) 121 | } else { 122 | let _ = self.navigationController?.popViewController(animated: true) 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/controllers/FormSelector.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSelector.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 23/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc public protocol FormSelector: NSObjectProtocol { 12 | var formCell: FormBaseCell? { get set } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/controllers/FormViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormViewController.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuño on 20/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | open class FormViewController : UITableViewController { 12 | 13 | private static var __once: () = { 14 | FormViewController.defaultCellClasses[.text] = FormTextFieldCell.self 15 | FormViewController.defaultCellClasses[.label] = FormLabelCell.self 16 | FormViewController.defaultCellClasses[.number] = FormTextFieldCell.self 17 | FormViewController.defaultCellClasses[.numbersAndPunctuation] = FormTextFieldCell.self 18 | FormViewController.defaultCellClasses[.decimal] = FormTextFieldCell.self 19 | FormViewController.defaultCellClasses[.name] = FormTextFieldCell.self 20 | FormViewController.defaultCellClasses[.phone] = FormTextFieldCell.self 21 | FormViewController.defaultCellClasses[.url] = FormTextFieldCell.self 22 | FormViewController.defaultCellClasses[.twitter] = FormTextFieldCell.self 23 | FormViewController.defaultCellClasses[.namePhone] = FormTextFieldCell.self 24 | FormViewController.defaultCellClasses[.email] = FormTextFieldCell.self 25 | FormViewController.defaultCellClasses[.asciiCapable] = FormTextFieldCell.self 26 | FormViewController.defaultCellClasses[.password] = FormTextFieldCell.self 27 | FormViewController.defaultCellClasses[.button] = FormButtonCell.self 28 | FormViewController.defaultCellClasses[.booleanSwitch] = FormSwitchCell.self 29 | FormViewController.defaultCellClasses[.booleanCheck] = FormCheckCell.self 30 | FormViewController.defaultCellClasses[.segmentedControl] = FormSegmentedControlCell.self 31 | FormViewController.defaultCellClasses[.picker] = FormPickerCell.self 32 | FormViewController.defaultCellClasses[.date] = FormDateCell.self 33 | FormViewController.defaultCellClasses[.time] = FormDateCell.self 34 | FormViewController.defaultCellClasses[.dateAndTime] = FormDateCell.self 35 | FormViewController.defaultCellClasses[.stepper] = FormStepperCell.self 36 | FormViewController.defaultCellClasses[.slider] = FormSliderCell.self 37 | FormViewController.defaultCellClasses[.multipleSelector] = FormSelectorCell.self 38 | FormViewController.defaultCellClasses[.multilineText] = FormTextViewCell.self 39 | }() 40 | 41 | // MARK: Class variables 42 | 43 | fileprivate static var onceDefaultCellClass: Int = 0 44 | fileprivate static var defaultCellClasses: [FormRowDescriptor.RowType : FormBaseCell.Type] = [:] 45 | 46 | // MARK: Properties 47 | 48 | open var form = FormDescriptor() 49 | 50 | // MARK: Init 51 | 52 | public convenience init() { 53 | self.init(style: .grouped) 54 | } 55 | 56 | public convenience init(form: FormDescriptor) { 57 | self.init(style: .grouped) 58 | self.form = form 59 | } 60 | 61 | public override init(style: UITableView.Style) { 62 | super.init(style: style) 63 | } 64 | 65 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 66 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 67 | } 68 | 69 | public required init(coder aDecoder: NSCoder) { 70 | super.init(coder: aDecoder)! 71 | } 72 | 73 | // MARK: View life cycle 74 | 75 | open override func viewDidLoad() { 76 | super.viewDidLoad() 77 | navigationItem.title = form.title 78 | } 79 | 80 | // MARK: Public interface 81 | 82 | open func valueForTag(_ tag: String) -> AnyObject? { 83 | for section in form.sections { 84 | for row in section.rows { 85 | if row.tag == tag { 86 | return row.value 87 | } 88 | } 89 | } 90 | return nil 91 | } 92 | 93 | open func setValue(_ value: AnyObject, forTag tag: String) { 94 | for (sectionIndex, section) in form.sections.enumerated() { 95 | for (rowIndex, row) in section.rows.enumerated() { 96 | if row.tag == tag { 97 | form.sections[sectionIndex].rows[rowIndex].value = value 98 | if let cell = self.tableView.cellForRow(at: IndexPath(row: rowIndex, section: sectionIndex)) as? FormBaseCell { 99 | cell.update() 100 | } 101 | return 102 | } 103 | } 104 | } 105 | } 106 | 107 | // MARK: UITableViewDataSource 108 | 109 | open override func numberOfSections(in tableView: UITableView) -> Int { 110 | return form.sections.count 111 | } 112 | 113 | open override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 114 | return form.sections[section].rows.count 115 | } 116 | 117 | open override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 118 | 119 | let rowDescriptor = formRowDescriptorAtIndexPath(indexPath) 120 | 121 | let formBaseCellClass = formBaseCellClassFromRowDescriptor(rowDescriptor) 122 | 123 | let reuseIdentifier = NSStringFromClass(formBaseCellClass!) 124 | 125 | var cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier) as? FormBaseCell 126 | if cell == nil { 127 | cell = formBaseCellClass?.init(style: .default, reuseIdentifier: reuseIdentifier) 128 | cell?.formViewController = self 129 | cell?.configure() 130 | } 131 | 132 | cell?.rowDescriptor = rowDescriptor 133 | 134 | // apply cell custom design 135 | for (keyPath, value) in rowDescriptor.configuration.cell.appearance { 136 | cell?.setValue(value, forKeyPath: keyPath) 137 | } 138 | return cell! 139 | } 140 | 141 | open override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { 142 | return form.sections[section].headerTitle 143 | } 144 | 145 | open override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { 146 | return form.sections[section].footerTitle 147 | } 148 | 149 | open override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 150 | guard let headerView = form.sections[section].headerView else { return nil } 151 | return headerView 152 | } 153 | 154 | open override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { 155 | guard let footerView = form.sections[section].footerView else { return nil } 156 | return footerView 157 | } 158 | 159 | open override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 160 | guard let headerView = form.sections[section].headerView , headerView.translatesAutoresizingMaskIntoConstraints else { 161 | return form.sections[section].headerViewHeight 162 | } 163 | return headerView.frame.size.height 164 | } 165 | 166 | open override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { 167 | guard let footerView = form.sections[section].footerView , footerView.translatesAutoresizingMaskIntoConstraints else { 168 | return form.sections[section].footerViewHeight 169 | } 170 | return footerView.frame.size.height 171 | } 172 | 173 | // MARK: UITableViewDelegate 174 | 175 | open override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 176 | 177 | let rowDescriptor = formRowDescriptorAtIndexPath(indexPath) 178 | 179 | if let formBaseCellClass = formBaseCellClassFromRowDescriptor(rowDescriptor) { 180 | return formBaseCellClass.formRowCellHeight() 181 | } 182 | return super.tableView(tableView, heightForRowAt: indexPath) 183 | } 184 | 185 | open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 186 | 187 | let rowDescriptor = formRowDescriptorAtIndexPath(indexPath) 188 | 189 | if let selectedRow = tableView.cellForRow(at: indexPath) as? FormBaseCell { 190 | if let formBaseCellClass = formBaseCellClassFromRowDescriptor(rowDescriptor) { 191 | formBaseCellClass.formViewController(self, didSelectRow: selectedRow) 192 | } 193 | } 194 | 195 | if let didSelectClosure = rowDescriptor.configuration.button.didSelectClosure { 196 | didSelectClosure(rowDescriptor) 197 | } 198 | 199 | tableView.deselectRow(at: indexPath, animated: true) 200 | } 201 | 202 | fileprivate class func defaultCellClassForRowType(_ rowType: FormRowDescriptor.RowType) -> FormBaseCell.Type { 203 | _ = FormViewController.__once 204 | return FormViewController.defaultCellClasses[rowType]! 205 | } 206 | 207 | fileprivate func formRowDescriptorAtIndexPath(_ indexPath: IndexPath) -> FormRowDescriptor { 208 | 209 | let section = form.sections[(indexPath as NSIndexPath).section] 210 | let rowDescriptor = section.rows[(indexPath as NSIndexPath).row] 211 | return rowDescriptor 212 | } 213 | 214 | fileprivate func formBaseCellClassFromRowDescriptor(_ rowDescriptor: FormRowDescriptor) -> FormBaseCell.Type! { 215 | 216 | var formBaseCellClass: FormBaseCell.Type 217 | 218 | if let cellClass = rowDescriptor.configuration.cell.cellClass as? FormBaseCell.Type { 219 | formBaseCellClass = cellClass 220 | } else { 221 | formBaseCellClass = FormViewController.defaultCellClassForRowType(rowDescriptor.type) 222 | } 223 | return formBaseCellClass 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/descriptors/FormDescriptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormDescriptor.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 20/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public final class FormDescriptor { 12 | 13 | // MARK: Properties 14 | 15 | public var title: String 16 | public var sections: [FormSectionDescriptor] = [] 17 | 18 | // MARK: Init 19 | 20 | public init() { 21 | self.title = "" 22 | } 23 | 24 | public init(title: String) { 25 | self.title = title 26 | } 27 | 28 | // MARK: Public 29 | 30 | public func formValues() -> [String : AnyObject] { 31 | 32 | var formValues: [String : AnyObject] = [:] 33 | 34 | for section in sections { 35 | for row in section.rows { 36 | if row.type != .button { 37 | if let value = row.value { 38 | formValues[row.tag] = value 39 | } else { 40 | formValues[row.tag] = NSNull() 41 | } 42 | } 43 | } 44 | } 45 | return formValues 46 | } 47 | 48 | public func validateForm() -> FormRowDescriptor? { 49 | for section in sections { 50 | for row in section.rows { 51 | if row.configuration.cell.required && row.value == nil { 52 | return row 53 | } 54 | } 55 | } 56 | return nil 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/descriptors/FormRowDescriptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormRowDescriptor.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Ángel Ortuño Ortuño on 23/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public final class FormRowDescriptor { 12 | 13 | // MARK: Types 14 | 15 | public enum RowType { 16 | case unknown 17 | case label 18 | case text 19 | case url 20 | case number 21 | case numbersAndPunctuation 22 | case decimal 23 | case name 24 | case phone 25 | case namePhone 26 | case email 27 | case twitter 28 | case asciiCapable 29 | case password 30 | case button 31 | case booleanSwitch 32 | case booleanCheck 33 | case segmentedControl 34 | case picker 35 | case date 36 | case time 37 | case dateAndTime 38 | case stepper 39 | case slider 40 | case multipleSelector 41 | case multilineText 42 | } 43 | 44 | public struct CellConfiguration { 45 | public var cellClass: AnyClass? 46 | public var appearance: [String : AnyObject] 47 | public var placeholder: String? 48 | public var showsInputToolbar: Bool 49 | public var required: Bool 50 | public var willUpdateClosure: ((FormRowDescriptor) -> Void)? 51 | public var didUpdateClosure: ((FormRowDescriptor) -> Void)? 52 | public var visualConstraintsClosure: ((FormBaseCell) -> [String])? 53 | 54 | public init() { 55 | cellClass = nil 56 | appearance = [:] 57 | placeholder = nil 58 | showsInputToolbar = false 59 | required = true 60 | willUpdateClosure = nil 61 | didUpdateClosure = nil 62 | visualConstraintsClosure = nil 63 | } 64 | } 65 | 66 | public struct SelectionConfiguration { 67 | public var controllerClass: AnyClass? 68 | public var options: [AnyObject] 69 | public var optionTitleClosure: ((AnyObject) -> String)? 70 | public var allowsMultipleSelection: Bool 71 | 72 | public init() { 73 | controllerClass = nil 74 | options = [] 75 | optionTitleClosure = nil 76 | allowsMultipleSelection = false 77 | } 78 | } 79 | 80 | public struct ButtonConfiguration { 81 | public var didSelectClosure: ((FormRowDescriptor) -> Void)? 82 | 83 | public init() { 84 | didSelectClosure = nil 85 | } 86 | } 87 | 88 | public struct StepperConfiguration { 89 | public var maximumValue: Double 90 | public var minimumValue: Double 91 | public var steps: Double 92 | public var continuous: Bool 93 | 94 | public init() { 95 | maximumValue = 0.0 96 | minimumValue = 0.0 97 | steps = 0.0 98 | continuous = false 99 | } 100 | } 101 | 102 | public struct DateConfiguration { 103 | public var dateFormatter: DateFormatter? 104 | } 105 | 106 | public struct RowConfiguration { 107 | public var cell: CellConfiguration 108 | public var selection: SelectionConfiguration 109 | public var button: ButtonConfiguration 110 | public var stepper: StepperConfiguration 111 | public var date: DateConfiguration 112 | public var userInfo: [String : AnyObject] 113 | 114 | init() { 115 | cell = CellConfiguration() 116 | selection = SelectionConfiguration() 117 | button = ButtonConfiguration() 118 | stepper = StepperConfiguration() 119 | date = DateConfiguration() 120 | userInfo = [:] 121 | } 122 | } 123 | 124 | // MARK: Properties 125 | 126 | public let tag: String 127 | public let type: RowType 128 | 129 | public var title: String? 130 | 131 | public var value: AnyObject? { 132 | willSet { 133 | guard let willUpdateBlock = configuration.cell.willUpdateClosure else { return } 134 | willUpdateBlock(self) 135 | } 136 | didSet { 137 | guard let didUpdateBlock = configuration.cell.didUpdateClosure else { return } 138 | didUpdateBlock(self) 139 | } 140 | } 141 | 142 | public var configuration: RowConfiguration 143 | 144 | // MARK: Init 145 | 146 | public init(tag: String, type: RowType, title: String, configuration: RowConfiguration) { 147 | self.tag = tag 148 | self.type = type 149 | self.title = title 150 | self.configuration = configuration 151 | } 152 | 153 | public init(tag: String, type: RowType, title: String) { 154 | self.tag = tag 155 | self.type = type 156 | self.title = title 157 | self.configuration = RowConfiguration() 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /Sources/SwiftFormsPackage/descriptors/FormSectionDescriptor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormSectionDescriptor.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 20/08/14. 6 | // Copyright (c) 2016 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public final class FormSectionDescriptor { 12 | 13 | // MARK: Properties 14 | 15 | public var rows: [FormRowDescriptor] = [] 16 | 17 | public var headerTitle: String? 18 | public var footerTitle: String? 19 | 20 | public var headerView: UIView? 21 | public var footerView: UIView? 22 | 23 | public var headerViewHeight: CGFloat = UITableView.automaticDimension 24 | public var footerViewHeight: CGFloat = UITableView.automaticDimension 25 | 26 | // MARK: Init 27 | 28 | public init(headerTitle: String?, footerTitle: String?) { 29 | self.headerTitle = headerTitle 30 | self.footerTitle = footerTitle 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SwiftForms.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "SwiftForms" 3 | s.version = "1.8.4" 4 | s.summary = "A small and lightweight library written in Swift that allows you to easily create forms" 5 | s.homepage = "https://github.com/ortuman/SwiftForms" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.authors = "Miguel Ángel Ortuño" 8 | s.ios.deployment_target = "8.0" 9 | s.source = { :git => "https://github.com/trusk89/SwiftForms.git", :tag => '1.8.4' } 10 | s.source_files = 'SwiftForms/*.swift','SwiftForms/descriptors/*.swift', 'SwiftForms/cells/base/*.swift', 'SwiftForms/cells/*.swift', 'SwiftForms/controllers/*.swift' 11 | end 12 | -------------------------------------------------------------------------------- /SwiftForms.xcodeproj/SwiftForms_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftForms.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | OBJ_48 /* FormErrorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* FormErrorType.swift */; }; 11 | OBJ_49 /* FormButtonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_11 /* FormButtonCell.swift */; }; 12 | OBJ_50 /* FormCheckCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_12 /* FormCheckCell.swift */; }; 13 | OBJ_51 /* FormDateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* FormDateCell.swift */; }; 14 | OBJ_52 /* FormLabelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_14 /* FormLabelCell.swift */; }; 15 | OBJ_53 /* FormPickerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_15 /* FormPickerCell.swift */; }; 16 | OBJ_54 /* FormSegmentedControlCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_16 /* FormSegmentedControlCell.swift */; }; 17 | OBJ_55 /* FormSelectorCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_17 /* FormSelectorCell.swift */; }; 18 | OBJ_56 /* FormSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_18 /* FormSliderCell.swift */; }; 19 | OBJ_57 /* FormStepperCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_19 /* FormStepperCell.swift */; }; 20 | OBJ_58 /* FormSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_20 /* FormSwitchCell.swift */; }; 21 | OBJ_59 /* FormTextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_21 /* FormTextFieldCell.swift */; }; 22 | OBJ_60 /* FormTextViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_22 /* FormTextViewCell.swift */; }; 23 | OBJ_61 /* FormBaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_24 /* FormBaseCell.swift */; }; 24 | OBJ_62 /* FormTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_25 /* FormTitleCell.swift */; }; 25 | OBJ_63 /* FormValueCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_26 /* FormValueCell.swift */; }; 26 | OBJ_64 /* FormOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_28 /* FormOptionsViewController.swift */; }; 27 | OBJ_65 /* FormSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_29 /* FormSelector.swift */; }; 28 | OBJ_66 /* FormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_30 /* FormViewController.swift */; }; 29 | OBJ_67 /* FormDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_32 /* FormDescriptor.swift */; }; 30 | OBJ_68 /* FormRowDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_33 /* FormRowDescriptor.swift */; }; 31 | OBJ_69 /* FormSectionDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_34 /* FormSectionDescriptor.swift */; }; 32 | OBJ_76 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; 33 | /* End PBXBuildFile section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | OBJ_11 /* FormButtonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormButtonCell.swift; sourceTree = ""; }; 37 | OBJ_12 /* FormCheckCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormCheckCell.swift; sourceTree = ""; }; 38 | OBJ_13 /* FormDateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormDateCell.swift; sourceTree = ""; }; 39 | OBJ_14 /* FormLabelCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabelCell.swift; sourceTree = ""; }; 40 | OBJ_15 /* FormPickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormPickerCell.swift; sourceTree = ""; }; 41 | OBJ_16 /* FormSegmentedControlCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSegmentedControlCell.swift; sourceTree = ""; }; 42 | OBJ_17 /* FormSelectorCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSelectorCell.swift; sourceTree = ""; }; 43 | OBJ_18 /* FormSliderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSliderCell.swift; sourceTree = ""; }; 44 | OBJ_19 /* FormStepperCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormStepperCell.swift; sourceTree = ""; }; 45 | OBJ_20 /* FormSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSwitchCell.swift; sourceTree = ""; }; 46 | OBJ_21 /* FormTextFieldCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormTextFieldCell.swift; sourceTree = ""; }; 47 | OBJ_22 /* FormTextViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormTextViewCell.swift; sourceTree = ""; }; 48 | OBJ_24 /* FormBaseCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormBaseCell.swift; sourceTree = ""; }; 49 | OBJ_25 /* FormTitleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormTitleCell.swift; sourceTree = ""; }; 50 | OBJ_26 /* FormValueCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormValueCell.swift; sourceTree = ""; }; 51 | OBJ_28 /* FormOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormOptionsViewController.swift; sourceTree = ""; }; 52 | OBJ_29 /* FormSelector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSelector.swift; sourceTree = ""; }; 53 | OBJ_30 /* FormViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormViewController.swift; sourceTree = ""; }; 54 | OBJ_32 /* FormDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormDescriptor.swift; sourceTree = ""; }; 55 | OBJ_33 /* FormRowDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormRowDescriptor.swift; sourceTree = ""; }; 56 | OBJ_34 /* FormSectionDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormSectionDescriptor.swift; sourceTree = ""; }; 57 | OBJ_40 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 58 | OBJ_41 /* README.MD */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.MD; sourceTree = ""; }; 59 | OBJ_42 /* SwiftForms.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = SwiftForms.podspec; sourceTree = ""; }; 60 | OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 61 | OBJ_9 /* FormErrorType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormErrorType.swift; sourceTree = ""; }; 62 | "SwiftForms::SwiftForms::Product" /* SwiftForms.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftForms.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | OBJ_70 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 0; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | OBJ_10 /* cells */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | OBJ_11 /* FormButtonCell.swift */, 80 | OBJ_12 /* FormCheckCell.swift */, 81 | OBJ_13 /* FormDateCell.swift */, 82 | OBJ_14 /* FormLabelCell.swift */, 83 | OBJ_15 /* FormPickerCell.swift */, 84 | OBJ_16 /* FormSegmentedControlCell.swift */, 85 | OBJ_17 /* FormSelectorCell.swift */, 86 | OBJ_18 /* FormSliderCell.swift */, 87 | OBJ_19 /* FormStepperCell.swift */, 88 | OBJ_20 /* FormSwitchCell.swift */, 89 | OBJ_21 /* FormTextFieldCell.swift */, 90 | OBJ_22 /* FormTextViewCell.swift */, 91 | OBJ_23 /* base */, 92 | ); 93 | path = cells; 94 | sourceTree = ""; 95 | }; 96 | OBJ_23 /* base */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | OBJ_24 /* FormBaseCell.swift */, 100 | OBJ_25 /* FormTitleCell.swift */, 101 | OBJ_26 /* FormValueCell.swift */, 102 | ); 103 | path = base; 104 | sourceTree = ""; 105 | }; 106 | OBJ_27 /* controllers */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | OBJ_28 /* FormOptionsViewController.swift */, 110 | OBJ_29 /* FormSelector.swift */, 111 | OBJ_30 /* FormViewController.swift */, 112 | ); 113 | path = controllers; 114 | sourceTree = ""; 115 | }; 116 | OBJ_31 /* descriptors */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | OBJ_32 /* FormDescriptor.swift */, 120 | OBJ_33 /* FormRowDescriptor.swift */, 121 | OBJ_34 /* FormSectionDescriptor.swift */, 122 | ); 123 | path = descriptors; 124 | sourceTree = ""; 125 | }; 126 | OBJ_35 /* Tests */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | ); 130 | name = Tests; 131 | sourceTree = SOURCE_ROOT; 132 | }; 133 | OBJ_36 /* Products */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | "SwiftForms::SwiftForms::Product" /* SwiftForms.framework */, 137 | ); 138 | name = Products; 139 | sourceTree = BUILT_PRODUCTS_DIR; 140 | }; 141 | OBJ_5 = { 142 | isa = PBXGroup; 143 | children = ( 144 | OBJ_6 /* Package.swift */, 145 | OBJ_7 /* Sources */, 146 | OBJ_35 /* Tests */, 147 | OBJ_36 /* Products */, 148 | OBJ_40 /* LICENSE */, 149 | OBJ_41 /* README.MD */, 150 | OBJ_42 /* SwiftForms.podspec */, 151 | ); 152 | sourceTree = ""; 153 | }; 154 | OBJ_7 /* Sources */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | OBJ_8 /* SwiftFormsPackage */, 158 | ); 159 | path = Sources; 160 | sourceTree = SOURCE_ROOT; 161 | }; 162 | OBJ_8 /* SwiftFormsPackage */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | OBJ_9 /* FormErrorType.swift */, 166 | OBJ_10 /* cells */, 167 | OBJ_27 /* controllers */, 168 | OBJ_31 /* descriptors */, 169 | ); 170 | path = SwiftFormsPackage; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXGroup section */ 174 | 175 | /* Begin PBXNativeTarget section */ 176 | "SwiftForms::SwiftForms" /* SwiftForms */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = OBJ_44 /* Build configuration list for PBXNativeTarget "SwiftForms" */; 179 | buildPhases = ( 180 | OBJ_47 /* Sources */, 181 | OBJ_70 /* Frameworks */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | ); 187 | name = SwiftForms; 188 | productName = SwiftForms; 189 | productReference = "SwiftForms::SwiftForms::Product" /* SwiftForms.framework */; 190 | productType = "com.apple.product-type.framework"; 191 | }; 192 | "SwiftForms::SwiftPMPackageDescription" /* SwiftFormsPackageDescription */ = { 193 | isa = PBXNativeTarget; 194 | buildConfigurationList = OBJ_72 /* Build configuration list for PBXNativeTarget "SwiftFormsPackageDescription" */; 195 | buildPhases = ( 196 | OBJ_75 /* Sources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | ); 202 | name = SwiftFormsPackageDescription; 203 | productName = SwiftFormsPackageDescription; 204 | productType = "com.apple.product-type.framework"; 205 | }; 206 | /* End PBXNativeTarget section */ 207 | 208 | /* Begin PBXProject section */ 209 | OBJ_1 /* Project object */ = { 210 | isa = PBXProject; 211 | attributes = { 212 | LastSwiftMigration = 9999; 213 | LastUpgradeCheck = 1230; 214 | }; 215 | buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "SwiftForms" */; 216 | compatibilityVersion = "Xcode 3.2"; 217 | developmentRegion = en; 218 | hasScannedForEncodings = 0; 219 | knownRegions = ( 220 | en, 221 | ); 222 | mainGroup = OBJ_5; 223 | productRefGroup = OBJ_36 /* Products */; 224 | projectDirPath = ""; 225 | projectRoot = ""; 226 | targets = ( 227 | "SwiftForms::SwiftForms" /* SwiftForms */, 228 | "SwiftForms::SwiftPMPackageDescription" /* SwiftFormsPackageDescription */, 229 | ); 230 | }; 231 | /* End PBXProject section */ 232 | 233 | /* Begin PBXSourcesBuildPhase section */ 234 | OBJ_47 /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 0; 237 | files = ( 238 | OBJ_48 /* FormErrorType.swift in Sources */, 239 | OBJ_49 /* FormButtonCell.swift in Sources */, 240 | OBJ_50 /* FormCheckCell.swift in Sources */, 241 | OBJ_51 /* FormDateCell.swift in Sources */, 242 | OBJ_52 /* FormLabelCell.swift in Sources */, 243 | OBJ_53 /* FormPickerCell.swift in Sources */, 244 | OBJ_54 /* FormSegmentedControlCell.swift in Sources */, 245 | OBJ_55 /* FormSelectorCell.swift in Sources */, 246 | OBJ_56 /* FormSliderCell.swift in Sources */, 247 | OBJ_57 /* FormStepperCell.swift in Sources */, 248 | OBJ_58 /* FormSwitchCell.swift in Sources */, 249 | OBJ_59 /* FormTextFieldCell.swift in Sources */, 250 | OBJ_60 /* FormTextViewCell.swift in Sources */, 251 | OBJ_61 /* FormBaseCell.swift in Sources */, 252 | OBJ_62 /* FormTitleCell.swift in Sources */, 253 | OBJ_63 /* FormValueCell.swift in Sources */, 254 | OBJ_64 /* FormOptionsViewController.swift in Sources */, 255 | OBJ_65 /* FormSelector.swift in Sources */, 256 | OBJ_66 /* FormViewController.swift in Sources */, 257 | OBJ_67 /* FormDescriptor.swift in Sources */, 258 | OBJ_68 /* FormRowDescriptor.swift in Sources */, 259 | OBJ_69 /* FormSectionDescriptor.swift in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | OBJ_75 /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 0; 266 | files = ( 267 | OBJ_76 /* Package.swift in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXSourcesBuildPhase section */ 272 | 273 | /* Begin XCBuildConfiguration section */ 274 | OBJ_3 /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 279 | CLANG_WARN_BOOL_CONVERSION = YES; 280 | CLANG_WARN_COMMA = YES; 281 | CLANG_WARN_CONSTANT_CONVERSION = YES; 282 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 290 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 291 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 292 | CLANG_WARN_STRICT_PROTOTYPES = YES; 293 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 294 | CLANG_WARN_UNREACHABLE_CODE = YES; 295 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 296 | COMBINE_HIDPI_IMAGES = YES; 297 | COPY_PHASE_STRIP = NO; 298 | DEBUG_INFORMATION_FORMAT = dwarf; 299 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 300 | ENABLE_NS_ASSERTIONS = YES; 301 | ENABLE_STRICT_OBJC_MSGSEND = YES; 302 | ENABLE_TESTABILITY = YES; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "$(inherited)", 307 | "SWIFT_PACKAGE=1", 308 | "DEBUG=1", 309 | ); 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | MACOSX_DEPLOYMENT_TARGET = 10.10; 317 | ONLY_ACTIVE_ARCH = YES; 318 | OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | SDKROOT = macosx; 321 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 322 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE DEBUG"; 323 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 324 | USE_HEADERMAP = NO; 325 | }; 326 | name = Debug; 327 | }; 328 | OBJ_4 /* Release */ = { 329 | isa = XCBuildConfiguration; 330 | buildSettings = { 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 333 | CLANG_WARN_BOOL_CONVERSION = YES; 334 | CLANG_WARN_COMMA = YES; 335 | CLANG_WARN_CONSTANT_CONVERSION = YES; 336 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INFINITE_RECURSION = YES; 340 | CLANG_WARN_INT_CONVERSION = YES; 341 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 343 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 344 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 345 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 346 | CLANG_WARN_STRICT_PROTOTYPES = YES; 347 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | COMBINE_HIDPI_IMAGES = YES; 351 | COPY_PHASE_STRIP = YES; 352 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 353 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 354 | ENABLE_STRICT_OBJC_MSGSEND = YES; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_OPTIMIZATION_LEVEL = s; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "$(inherited)", 359 | "SWIFT_PACKAGE=1", 360 | ); 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | MACOSX_DEPLOYMENT_TARGET = 10.10; 368 | OTHER_SWIFT_FLAGS = "$(inherited) -DXcode"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | SDKROOT = macosx; 371 | SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator"; 372 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) SWIFT_PACKAGE"; 373 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 374 | USE_HEADERMAP = NO; 375 | }; 376 | name = Release; 377 | }; 378 | OBJ_45 /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ENABLE_TESTABILITY = YES; 382 | FRAMEWORK_SEARCH_PATHS = ( 383 | "$(inherited)", 384 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 385 | ); 386 | HEADER_SEARCH_PATHS = "$(inherited)"; 387 | INFOPLIST_FILE = SwiftForms.xcodeproj/SwiftForms_Info.plist; 388 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 390 | MACOSX_DEPLOYMENT_TARGET = 10.10; 391 | OTHER_CFLAGS = "$(inherited)"; 392 | OTHER_LDFLAGS = "$(inherited)"; 393 | OTHER_SWIFT_FLAGS = "$(inherited)"; 394 | PRODUCT_BUNDLE_IDENTIFIER = SwiftForms; 395 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 396 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 397 | SKIP_INSTALL = YES; 398 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 399 | SWIFT_VERSION = 5.0; 400 | TARGET_NAME = SwiftForms; 401 | TVOS_DEPLOYMENT_TARGET = 12.0; 402 | WATCHOS_DEPLOYMENT_TARGET = 5.0; 403 | }; 404 | name = Debug; 405 | }; 406 | OBJ_46 /* Release */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | ENABLE_TESTABILITY = YES; 410 | FRAMEWORK_SEARCH_PATHS = ( 411 | "$(inherited)", 412 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 413 | ); 414 | HEADER_SEARCH_PATHS = "$(inherited)"; 415 | INFOPLIST_FILE = SwiftForms.xcodeproj/SwiftForms_Info.plist; 416 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(TOOLCHAIN_DIR)/usr/lib/swift/macosx"; 418 | MACOSX_DEPLOYMENT_TARGET = 10.10; 419 | OTHER_CFLAGS = "$(inherited)"; 420 | OTHER_LDFLAGS = "$(inherited)"; 421 | OTHER_SWIFT_FLAGS = "$(inherited)"; 422 | PRODUCT_BUNDLE_IDENTIFIER = SwiftForms; 423 | PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)"; 424 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 425 | SKIP_INSTALL = YES; 426 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)"; 427 | SWIFT_VERSION = 5.0; 428 | TARGET_NAME = SwiftForms; 429 | TVOS_DEPLOYMENT_TARGET = 12.0; 430 | WATCHOS_DEPLOYMENT_TARGET = 5.0; 431 | }; 432 | name = Release; 433 | }; 434 | OBJ_73 /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | LD = /usr/bin/true; 438 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1"; 439 | SWIFT_VERSION = 5.0; 440 | }; 441 | name = Debug; 442 | }; 443 | OBJ_74 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | LD = /usr/bin/true; 447 | OTHER_SWIFT_FLAGS = "-swift-version 5 -I $(TOOLCHAIN_DIR)/usr/lib/swift/pm/4_2 -target x86_64-apple-macosx10.10 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -package-description-version 5.1"; 448 | SWIFT_VERSION = 5.0; 449 | }; 450 | name = Release; 451 | }; 452 | /* End XCBuildConfiguration section */ 453 | 454 | /* Begin XCConfigurationList section */ 455 | OBJ_2 /* Build configuration list for PBXProject "SwiftForms" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | OBJ_3 /* Debug */, 459 | OBJ_4 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | OBJ_44 /* Build configuration list for PBXNativeTarget "SwiftForms" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | OBJ_45 /* Debug */, 468 | OBJ_46 /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | OBJ_72 /* Build configuration list for PBXNativeTarget "SwiftFormsPackageDescription" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | OBJ_73 /* Debug */, 477 | OBJ_74 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | /* End XCConfigurationList section */ 483 | }; 484 | rootObject = OBJ_1 /* Project object */; 485 | } 486 | -------------------------------------------------------------------------------- /SwiftForms.xcodeproj/xcshareddata/xcschemes/SwiftForms-Package.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 53 | 54 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /SwiftFormsApplication.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0CCA33DD1B04FA5A006D9666 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CCA33DC1B04FA5A006D9666 /* AppDelegate.swift */; }; 11 | 0CCA33DF1B04FA5A006D9666 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CCA33DE1B04FA5A006D9666 /* ViewController.swift */; }; 12 | 0CCA33E21B04FA5A006D9666 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0CCA33E01B04FA5A006D9666 /* Main.storyboard */; }; 13 | 0CCA33E41B04FA5A006D9666 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0CCA33E31B04FA5A006D9666 /* Images.xcassets */; }; 14 | 0CCA34141B04FAD3006D9666 /* ExampleFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CCA33FC1B04FAD3006D9666 /* ExampleFormViewController.swift */; }; 15 | 0CCA34611B0502B5006D9666 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0CCA34601B0502B5006D9666 /* Launch.storyboard */; }; 16 | FACA6699233B601D00F05015 /* FormSegmentedControlCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA667F233B601D00F05015 /* FormSegmentedControlCell.swift */; }; 17 | FACA669A233B601D00F05015 /* FormTextFieldCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6680233B601D00F05015 /* FormTextFieldCell.swift */; }; 18 | FACA669B233B601D00F05015 /* FormTextViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6681233B601D00F05015 /* FormTextViewCell.swift */; }; 19 | FACA669C233B601D00F05015 /* FormPickerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6682233B601D00F05015 /* FormPickerCell.swift */; }; 20 | FACA669D233B601D00F05015 /* FormSelectorCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6683233B601D00F05015 /* FormSelectorCell.swift */; }; 21 | FACA669E233B601D00F05015 /* FormButtonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6684233B601D00F05015 /* FormButtonCell.swift */; }; 22 | FACA669F233B601D00F05015 /* FormSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6685233B601D00F05015 /* FormSwitchCell.swift */; }; 23 | FACA66A0233B601D00F05015 /* FormCheckCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6686233B601D00F05015 /* FormCheckCell.swift */; }; 24 | FACA66A1233B601D00F05015 /* FormSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6687233B601D00F05015 /* FormSliderCell.swift */; }; 25 | FACA66A2233B601D00F05015 /* FormLabelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6688233B601D00F05015 /* FormLabelCell.swift */; }; 26 | FACA66A3233B601D00F05015 /* FormDateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6689233B601D00F05015 /* FormDateCell.swift */; }; 27 | FACA66A4233B601D00F05015 /* FormTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA668B233B601D00F05015 /* FormTitleCell.swift */; }; 28 | FACA66A5233B601D00F05015 /* FormBaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA668C233B601D00F05015 /* FormBaseCell.swift */; }; 29 | FACA66A6233B601D00F05015 /* FormValueCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA668D233B601D00F05015 /* FormValueCell.swift */; }; 30 | FACA66A7233B601D00F05015 /* FormStepperCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA668E233B601D00F05015 /* FormStepperCell.swift */; }; 31 | FACA66A8233B601D00F05015 /* SwiftForms.h in Headers */ = {isa = PBXBuildFile; fileRef = FACA668F233B601D00F05015 /* SwiftForms.h */; }; 32 | FACA66A9233B601D00F05015 /* FormRowDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6691233B601D00F05015 /* FormRowDescriptor.swift */; }; 33 | FACA66AA233B601D00F05015 /* FormDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6692233B601D00F05015 /* FormDescriptor.swift */; }; 34 | FACA66AB233B601D00F05015 /* FormSectionDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6693233B601D00F05015 /* FormSectionDescriptor.swift */; }; 35 | FACA66AC233B601D00F05015 /* FormErrorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6694233B601D00F05015 /* FormErrorType.swift */; }; 36 | FACA66AD233B601D00F05015 /* FormSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6696233B601D00F05015 /* FormSelector.swift */; }; 37 | FACA66AE233B601D00F05015 /* FormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6697233B601D00F05015 /* FormViewController.swift */; }; 38 | FACA66AF233B601D00F05015 /* FormOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACA6698233B601D00F05015 /* FormOptionsViewController.swift */; }; 39 | /* End PBXBuildFile section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 0CCA33D71B04FA5A006D9666 /* SwiftFormsApplication.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftFormsApplication.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 0CCA33DB1B04FA5A006D9666 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 0CCA33DC1B04FA5A006D9666 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 0CCA33DE1B04FA5A006D9666 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 46 | 0CCA33E11B04FA5A006D9666 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 0CCA33E31B04FA5A006D9666 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 48 | 0CCA33FC1B04FAD3006D9666 /* ExampleFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleFormViewController.swift; sourceTree = ""; }; 49 | 0CCA342C1B04FBDF006D9666 /* SwiftForms.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftForms.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 0CCA34601B0502B5006D9666 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = ""; }; 51 | FACA667F233B601D00F05015 /* FormSegmentedControlCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSegmentedControlCell.swift; sourceTree = ""; }; 52 | FACA6680233B601D00F05015 /* FormTextFieldCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormTextFieldCell.swift; sourceTree = ""; }; 53 | FACA6681233B601D00F05015 /* FormTextViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormTextViewCell.swift; sourceTree = ""; }; 54 | FACA6682233B601D00F05015 /* FormPickerCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormPickerCell.swift; sourceTree = ""; }; 55 | FACA6683233B601D00F05015 /* FormSelectorCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSelectorCell.swift; sourceTree = ""; }; 56 | FACA6684233B601D00F05015 /* FormButtonCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormButtonCell.swift; sourceTree = ""; }; 57 | FACA6685233B601D00F05015 /* FormSwitchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSwitchCell.swift; sourceTree = ""; }; 58 | FACA6686233B601D00F05015 /* FormCheckCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormCheckCell.swift; sourceTree = ""; }; 59 | FACA6687233B601D00F05015 /* FormSliderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSliderCell.swift; sourceTree = ""; }; 60 | FACA6688233B601D00F05015 /* FormLabelCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormLabelCell.swift; sourceTree = ""; }; 61 | FACA6689233B601D00F05015 /* FormDateCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormDateCell.swift; sourceTree = ""; }; 62 | FACA668B233B601D00F05015 /* FormTitleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormTitleCell.swift; sourceTree = ""; }; 63 | FACA668C233B601D00F05015 /* FormBaseCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormBaseCell.swift; sourceTree = ""; }; 64 | FACA668D233B601D00F05015 /* FormValueCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValueCell.swift; sourceTree = ""; }; 65 | FACA668E233B601D00F05015 /* FormStepperCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormStepperCell.swift; sourceTree = ""; }; 66 | FACA668F233B601D00F05015 /* SwiftForms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftForms.h; sourceTree = ""; }; 67 | FACA6691233B601D00F05015 /* FormRowDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormRowDescriptor.swift; sourceTree = ""; }; 68 | FACA6692233B601D00F05015 /* FormDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormDescriptor.swift; sourceTree = ""; }; 69 | FACA6693233B601D00F05015 /* FormSectionDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSectionDescriptor.swift; sourceTree = ""; }; 70 | FACA6694233B601D00F05015 /* FormErrorType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormErrorType.swift; sourceTree = ""; }; 71 | FACA6696233B601D00F05015 /* FormSelector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormSelector.swift; sourceTree = ""; }; 72 | FACA6697233B601D00F05015 /* FormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormViewController.swift; sourceTree = ""; }; 73 | FACA6698233B601D00F05015 /* FormOptionsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormOptionsViewController.swift; sourceTree = ""; }; 74 | /* End PBXFileReference section */ 75 | 76 | /* Begin PBXFrameworksBuildPhase section */ 77 | 0CCA33D41B04FA5A006D9666 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | 0CCA34281B04FBDF006D9666 /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | /* End PBXFrameworksBuildPhase section */ 92 | 93 | /* Begin PBXGroup section */ 94 | 0CCA33CE1B04FA5A006D9666 = { 95 | isa = PBXGroup; 96 | children = ( 97 | FACA667C233B601D00F05015 /* Sources */, 98 | 0CCA33D91B04FA5A006D9666 /* SwiftFormsApplication */, 99 | 0CCA33D81B04FA5A006D9666 /* Products */, 100 | FA21947F233B53FF002B7F87 /* Frameworks */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 0CCA33D81B04FA5A006D9666 /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 0CCA33D71B04FA5A006D9666 /* SwiftFormsApplication.app */, 108 | 0CCA342C1B04FBDF006D9666 /* SwiftForms.framework */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 0CCA33D91B04FA5A006D9666 /* SwiftFormsApplication */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 0CCA33FC1B04FAD3006D9666 /* ExampleFormViewController.swift */, 117 | 0CCA33DC1B04FA5A006D9666 /* AppDelegate.swift */, 118 | 0CCA33DE1B04FA5A006D9666 /* ViewController.swift */, 119 | 0CCA33E01B04FA5A006D9666 /* Main.storyboard */, 120 | 0CCA33E31B04FA5A006D9666 /* Images.xcassets */, 121 | 0CCA33DA1B04FA5A006D9666 /* Supporting Files */, 122 | 0CCA34601B0502B5006D9666 /* Launch.storyboard */, 123 | ); 124 | path = SwiftFormsApplication; 125 | sourceTree = ""; 126 | }; 127 | 0CCA33DA1B04FA5A006D9666 /* Supporting Files */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 0CCA33DB1B04FA5A006D9666 /* Info.plist */, 131 | ); 132 | name = "Supporting Files"; 133 | sourceTree = ""; 134 | }; 135 | FA21947F233B53FF002B7F87 /* Frameworks */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | ); 139 | name = Frameworks; 140 | sourceTree = ""; 141 | }; 142 | FACA667C233B601D00F05015 /* Sources */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | FACA667D233B601D00F05015 /* SwiftFormsPackage */, 146 | ); 147 | path = Sources; 148 | sourceTree = ""; 149 | }; 150 | FACA667D233B601D00F05015 /* SwiftFormsPackage */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | FACA667E233B601D00F05015 /* cells */, 154 | FACA668F233B601D00F05015 /* SwiftForms.h */, 155 | FACA6690233B601D00F05015 /* descriptors */, 156 | FACA6694233B601D00F05015 /* FormErrorType.swift */, 157 | FACA6695233B601D00F05015 /* controllers */, 158 | ); 159 | path = SwiftFormsPackage; 160 | sourceTree = ""; 161 | }; 162 | FACA667E233B601D00F05015 /* cells */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | FACA667F233B601D00F05015 /* FormSegmentedControlCell.swift */, 166 | FACA6680233B601D00F05015 /* FormTextFieldCell.swift */, 167 | FACA6681233B601D00F05015 /* FormTextViewCell.swift */, 168 | FACA6682233B601D00F05015 /* FormPickerCell.swift */, 169 | FACA6683233B601D00F05015 /* FormSelectorCell.swift */, 170 | FACA6684233B601D00F05015 /* FormButtonCell.swift */, 171 | FACA6685233B601D00F05015 /* FormSwitchCell.swift */, 172 | FACA6686233B601D00F05015 /* FormCheckCell.swift */, 173 | FACA6687233B601D00F05015 /* FormSliderCell.swift */, 174 | FACA6688233B601D00F05015 /* FormLabelCell.swift */, 175 | FACA6689233B601D00F05015 /* FormDateCell.swift */, 176 | FACA668A233B601D00F05015 /* base */, 177 | FACA668E233B601D00F05015 /* FormStepperCell.swift */, 178 | ); 179 | path = cells; 180 | sourceTree = ""; 181 | }; 182 | FACA668A233B601D00F05015 /* base */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | FACA668B233B601D00F05015 /* FormTitleCell.swift */, 186 | FACA668C233B601D00F05015 /* FormBaseCell.swift */, 187 | FACA668D233B601D00F05015 /* FormValueCell.swift */, 188 | ); 189 | path = base; 190 | sourceTree = ""; 191 | }; 192 | FACA6690233B601D00F05015 /* descriptors */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | FACA6691233B601D00F05015 /* FormRowDescriptor.swift */, 196 | FACA6692233B601D00F05015 /* FormDescriptor.swift */, 197 | FACA6693233B601D00F05015 /* FormSectionDescriptor.swift */, 198 | ); 199 | path = descriptors; 200 | sourceTree = ""; 201 | }; 202 | FACA6695233B601D00F05015 /* controllers */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | FACA6696233B601D00F05015 /* FormSelector.swift */, 206 | FACA6697233B601D00F05015 /* FormViewController.swift */, 207 | FACA6698233B601D00F05015 /* FormOptionsViewController.swift */, 208 | ); 209 | path = controllers; 210 | sourceTree = ""; 211 | }; 212 | /* End PBXGroup section */ 213 | 214 | /* Begin PBXHeadersBuildPhase section */ 215 | 0CCA34291B04FBDF006D9666 /* Headers */ = { 216 | isa = PBXHeadersBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | FACA66A8233B601D00F05015 /* SwiftForms.h in Headers */, 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | }; 223 | /* End PBXHeadersBuildPhase section */ 224 | 225 | /* Begin PBXNativeTarget section */ 226 | 0CCA33D61B04FA5A006D9666 /* SwiftFormsApplication */ = { 227 | isa = PBXNativeTarget; 228 | buildConfigurationList = 0CCA33F61B04FA5A006D9666 /* Build configuration list for PBXNativeTarget "SwiftFormsApplication" */; 229 | buildPhases = ( 230 | 0CCA33D31B04FA5A006D9666 /* Sources */, 231 | 0CCA33D41B04FA5A006D9666 /* Frameworks */, 232 | 0CCA33D51B04FA5A006D9666 /* Resources */, 233 | ); 234 | buildRules = ( 235 | ); 236 | dependencies = ( 237 | ); 238 | name = SwiftFormsApplication; 239 | packageProductDependencies = ( 240 | ); 241 | productName = SwiftFormsApplication; 242 | productReference = 0CCA33D71B04FA5A006D9666 /* SwiftFormsApplication.app */; 243 | productType = "com.apple.product-type.application"; 244 | }; 245 | 0CCA342B1B04FBDF006D9666 /* SwiftForms */ = { 246 | isa = PBXNativeTarget; 247 | buildConfigurationList = 0CCA34451B04FBE0006D9666 /* Build configuration list for PBXNativeTarget "SwiftForms" */; 248 | buildPhases = ( 249 | 0CCA34271B04FBDF006D9666 /* Sources */, 250 | 0CCA34281B04FBDF006D9666 /* Frameworks */, 251 | 0CCA34291B04FBDF006D9666 /* Headers */, 252 | 0CCA342A1B04FBDF006D9666 /* Resources */, 253 | ); 254 | buildRules = ( 255 | ); 256 | dependencies = ( 257 | ); 258 | name = SwiftForms; 259 | productName = SwiftForms; 260 | productReference = 0CCA342C1B04FBDF006D9666 /* SwiftForms.framework */; 261 | productType = "com.apple.product-type.framework"; 262 | }; 263 | /* End PBXNativeTarget section */ 264 | 265 | /* Begin PBXProject section */ 266 | 0CCA33CF1B04FA5A006D9666 /* Project object */ = { 267 | isa = PBXProject; 268 | attributes = { 269 | LastSwiftMigration = 0700; 270 | LastSwiftUpdateCheck = 0700; 271 | LastUpgradeCheck = 1100; 272 | ORGANIZATIONNAME = "Miguel Angel Ortuno Ortuno"; 273 | TargetAttributes = { 274 | 0CCA33D61B04FA5A006D9666 = { 275 | CreatedOnToolsVersion = 6.3.1; 276 | LastSwiftMigration = 1100; 277 | }; 278 | 0CCA342B1B04FBDF006D9666 = { 279 | CreatedOnToolsVersion = 6.3.1; 280 | LastSwiftMigration = 1100; 281 | }; 282 | }; 283 | }; 284 | buildConfigurationList = 0CCA33D21B04FA5A006D9666 /* Build configuration list for PBXProject "SwiftFormsApplication" */; 285 | compatibilityVersion = "Xcode 3.2"; 286 | developmentRegion = English; 287 | hasScannedForEncodings = 0; 288 | knownRegions = ( 289 | English, 290 | en, 291 | Base, 292 | ); 293 | mainGroup = 0CCA33CE1B04FA5A006D9666; 294 | productRefGroup = 0CCA33D81B04FA5A006D9666 /* Products */; 295 | projectDirPath = ""; 296 | projectRoot = ""; 297 | targets = ( 298 | 0CCA33D61B04FA5A006D9666 /* SwiftFormsApplication */, 299 | 0CCA342B1B04FBDF006D9666 /* SwiftForms */, 300 | ); 301 | }; 302 | /* End PBXProject section */ 303 | 304 | /* Begin PBXResourcesBuildPhase section */ 305 | 0CCA33D51B04FA5A006D9666 /* Resources */ = { 306 | isa = PBXResourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 0CCA33E21B04FA5A006D9666 /* Main.storyboard in Resources */, 310 | 0CCA34611B0502B5006D9666 /* Launch.storyboard in Resources */, 311 | 0CCA33E41B04FA5A006D9666 /* Images.xcassets in Resources */, 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | 0CCA342A1B04FBDF006D9666 /* Resources */ = { 316 | isa = PBXResourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | /* End PBXResourcesBuildPhase section */ 323 | 324 | /* Begin PBXSourcesBuildPhase section */ 325 | 0CCA33D31B04FA5A006D9666 /* Sources */ = { 326 | isa = PBXSourcesBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | 0CCA33DF1B04FA5A006D9666 /* ViewController.swift in Sources */, 330 | 0CCA34141B04FAD3006D9666 /* ExampleFormViewController.swift in Sources */, 331 | 0CCA33DD1B04FA5A006D9666 /* AppDelegate.swift in Sources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | 0CCA34271B04FBDF006D9666 /* Sources */ = { 336 | isa = PBXSourcesBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | FACA66A0233B601D00F05015 /* FormCheckCell.swift in Sources */, 340 | FACA6699233B601D00F05015 /* FormSegmentedControlCell.swift in Sources */, 341 | FACA669D233B601D00F05015 /* FormSelectorCell.swift in Sources */, 342 | FACA66A6233B601D00F05015 /* FormValueCell.swift in Sources */, 343 | FACA669C233B601D00F05015 /* FormPickerCell.swift in Sources */, 344 | FACA66A4233B601D00F05015 /* FormTitleCell.swift in Sources */, 345 | FACA66AB233B601D00F05015 /* FormSectionDescriptor.swift in Sources */, 346 | FACA66AA233B601D00F05015 /* FormDescriptor.swift in Sources */, 347 | FACA669F233B601D00F05015 /* FormSwitchCell.swift in Sources */, 348 | FACA66AE233B601D00F05015 /* FormViewController.swift in Sources */, 349 | FACA66A1233B601D00F05015 /* FormSliderCell.swift in Sources */, 350 | FACA66A7233B601D00F05015 /* FormStepperCell.swift in Sources */, 351 | FACA669E233B601D00F05015 /* FormButtonCell.swift in Sources */, 352 | FACA669B233B601D00F05015 /* FormTextViewCell.swift in Sources */, 353 | FACA66A3233B601D00F05015 /* FormDateCell.swift in Sources */, 354 | FACA66AD233B601D00F05015 /* FormSelector.swift in Sources */, 355 | FACA66A2233B601D00F05015 /* FormLabelCell.swift in Sources */, 356 | FACA66A9233B601D00F05015 /* FormRowDescriptor.swift in Sources */, 357 | FACA66A5233B601D00F05015 /* FormBaseCell.swift in Sources */, 358 | FACA66AF233B601D00F05015 /* FormOptionsViewController.swift in Sources */, 359 | FACA66AC233B601D00F05015 /* FormErrorType.swift in Sources */, 360 | FACA669A233B601D00F05015 /* FormTextFieldCell.swift in Sources */, 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | }; 364 | /* End PBXSourcesBuildPhase section */ 365 | 366 | /* Begin PBXVariantGroup section */ 367 | 0CCA33E01B04FA5A006D9666 /* Main.storyboard */ = { 368 | isa = PBXVariantGroup; 369 | children = ( 370 | 0CCA33E11B04FA5A006D9666 /* Base */, 371 | ); 372 | name = Main.storyboard; 373 | sourceTree = ""; 374 | }; 375 | /* End PBXVariantGroup section */ 376 | 377 | /* Begin XCBuildConfiguration section */ 378 | 0CCA33F41B04FA5A006D9666 /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_MODULES = YES; 386 | CLANG_ENABLE_OBJC_ARC = YES; 387 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 388 | CLANG_WARN_BOOL_CONVERSION = YES; 389 | CLANG_WARN_COMMA = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 392 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 393 | CLANG_WARN_EMPTY_BODY = YES; 394 | CLANG_WARN_ENUM_CONVERSION = YES; 395 | CLANG_WARN_INFINITE_RECURSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 399 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 400 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 401 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 402 | CLANG_WARN_STRICT_PROTOTYPES = YES; 403 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 404 | CLANG_WARN_UNREACHABLE_CODE = YES; 405 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 407 | COPY_PHASE_STRIP = NO; 408 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 409 | ENABLE_STRICT_OBJC_MSGSEND = YES; 410 | ENABLE_TESTABILITY = YES; 411 | GCC_C_LANGUAGE_STANDARD = gnu99; 412 | GCC_DYNAMIC_NO_PIC = NO; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_OPTIMIZATION_LEVEL = 0; 415 | GCC_PREPROCESSOR_DEFINITIONS = ( 416 | "DEBUG=1", 417 | "$(inherited)", 418 | ); 419 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = YES; 428 | ONLY_ACTIVE_ARCH = YES; 429 | SDKROOT = iphoneos; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 4.0; 432 | TARGETED_DEVICE_FAMILY = "1,2"; 433 | }; 434 | name = Debug; 435 | }; 436 | 0CCA33F51B04FA5A006D9666 /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ALWAYS_SEARCH_USER_PATHS = NO; 440 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 441 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 442 | CLANG_CXX_LIBRARY = "libc++"; 443 | CLANG_ENABLE_MODULES = YES; 444 | CLANG_ENABLE_OBJC_ARC = YES; 445 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 446 | CLANG_WARN_BOOL_CONVERSION = YES; 447 | CLANG_WARN_COMMA = YES; 448 | CLANG_WARN_CONSTANT_CONVERSION = YES; 449 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 450 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 451 | CLANG_WARN_EMPTY_BODY = YES; 452 | CLANG_WARN_ENUM_CONVERSION = YES; 453 | CLANG_WARN_INFINITE_RECURSION = YES; 454 | CLANG_WARN_INT_CONVERSION = YES; 455 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 456 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 457 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 458 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 459 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 460 | CLANG_WARN_STRICT_PROTOTYPES = YES; 461 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 462 | CLANG_WARN_UNREACHABLE_CODE = YES; 463 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 464 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 465 | COPY_PHASE_STRIP = NO; 466 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 467 | ENABLE_NS_ASSERTIONS = NO; 468 | ENABLE_STRICT_OBJC_MSGSEND = YES; 469 | GCC_C_LANGUAGE_STANDARD = gnu99; 470 | GCC_NO_COMMON_BLOCKS = YES; 471 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 472 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 473 | GCC_WARN_UNDECLARED_SELECTOR = YES; 474 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 475 | GCC_WARN_UNUSED_FUNCTION = YES; 476 | GCC_WARN_UNUSED_VARIABLE = YES; 477 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 478 | MTL_ENABLE_DEBUG_INFO = NO; 479 | SDKROOT = iphoneos; 480 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 481 | SWIFT_VERSION = 4.0; 482 | TARGETED_DEVICE_FAMILY = "1,2"; 483 | VALIDATE_PRODUCT = YES; 484 | }; 485 | name = Release; 486 | }; 487 | 0CCA33F71B04FA5A006D9666 /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 491 | INFOPLIST_FILE = SwiftFormsApplication/Info.plist; 492 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 493 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 494 | PRODUCT_BUNDLE_IDENTIFIER = com.ortulabs.SwiftFormsApplication; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | SWIFT_VERSION = 5.0; 497 | }; 498 | name = Debug; 499 | }; 500 | 0CCA33F81B04FA5A006D9666 /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | INFOPLIST_FILE = SwiftFormsApplication/Info.plist; 505 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 507 | PRODUCT_BUNDLE_IDENTIFIER = com.ortulabs.SwiftFormsApplication; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | SWIFT_VERSION = 5.0; 510 | }; 511 | name = Release; 512 | }; 513 | 0CCA34461B04FBE0006D9666 /* Debug */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 517 | CURRENT_PROJECT_VERSION = 1; 518 | DEFINES_MODULE = YES; 519 | DYLIB_COMPATIBILITY_VERSION = 1; 520 | DYLIB_CURRENT_VERSION = 1; 521 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 522 | GCC_PREPROCESSOR_DEFINITIONS = ( 523 | "DEBUG=1", 524 | "$(inherited)", 525 | ); 526 | INFOPLIST_FILE = SwiftForms.xcodeproj/SwiftForms_Info.plist; 527 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 528 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 530 | MARKETING_VERSION = 1.8.3; 531 | PRODUCT_BUNDLE_IDENTIFIER = "com.ortulabs.$(PRODUCT_NAME:rfc1034identifier)"; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | SKIP_INSTALL = YES; 534 | SWIFT_VERSION = 5.0; 535 | VERSIONING_SYSTEM = "apple-generic"; 536 | VERSION_INFO_PREFIX = ""; 537 | }; 538 | name = Debug; 539 | }; 540 | 0CCA34471B04FBE0006D9666 /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 544 | CURRENT_PROJECT_VERSION = 1; 545 | DEFINES_MODULE = YES; 546 | DYLIB_COMPATIBILITY_VERSION = 1; 547 | DYLIB_CURRENT_VERSION = 1; 548 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 549 | INFOPLIST_FILE = SwiftForms.xcodeproj/SwiftForms_Info.plist; 550 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 551 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 552 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 553 | MARKETING_VERSION = 1.8.3; 554 | PRODUCT_BUNDLE_IDENTIFIER = "com.ortulabs.$(PRODUCT_NAME:rfc1034identifier)"; 555 | PRODUCT_NAME = "$(TARGET_NAME)"; 556 | SKIP_INSTALL = YES; 557 | SWIFT_VERSION = 5.0; 558 | VERSIONING_SYSTEM = "apple-generic"; 559 | VERSION_INFO_PREFIX = ""; 560 | }; 561 | name = Release; 562 | }; 563 | /* End XCBuildConfiguration section */ 564 | 565 | /* Begin XCConfigurationList section */ 566 | 0CCA33D21B04FA5A006D9666 /* Build configuration list for PBXProject "SwiftFormsApplication" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 0CCA33F41B04FA5A006D9666 /* Debug */, 570 | 0CCA33F51B04FA5A006D9666 /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 0CCA33F61B04FA5A006D9666 /* Build configuration list for PBXNativeTarget "SwiftFormsApplication" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 0CCA33F71B04FA5A006D9666 /* Debug */, 579 | 0CCA33F81B04FA5A006D9666 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 0CCA34451B04FBE0006D9666 /* Build configuration list for PBXNativeTarget "SwiftForms" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 0CCA34461B04FBE0006D9666 /* Debug */, 588 | 0CCA34471B04FBE0006D9666 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | /* End XCConfigurationList section */ 594 | }; 595 | rootObject = 0CCA33CF1B04FA5A006D9666 /* Project object */; 596 | } 597 | -------------------------------------------------------------------------------- /SwiftFormsApplication/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftForms 4 | // 5 | // Created by Miguel Angel Ortuno on 20/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : Any]?) -> Bool { 17 | return true 18 | } 19 | 20 | func applicationWillResignActive(_ application: UIApplication) { 21 | } 22 | 23 | func applicationDidEnterBackground(_ application: UIApplication) { 24 | } 25 | 26 | func applicationWillEnterForeground(_ application: UIApplication) { 27 | } 28 | 29 | func applicationDidBecomeActive(_ application: UIApplication) { 30 | } 31 | 32 | func applicationWillTerminate(_ application: UIApplication) { 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /SwiftFormsApplication/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SwiftFormsApplication/Example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ortuman/SwiftForms/9723a32dd15b7f341abb99d2a530f756f7098026/SwiftFormsApplication/Example.gif -------------------------------------------------------------------------------- /SwiftFormsApplication/ExampleFormViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleFormViewController.swift 3 | // SwiftForms 4 | //® 5 | // Created by Miguel Angel Ortuno on 20/08/14. 6 | // Copyright (c) 2014 Miguel Angel Ortuño. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftForms 11 | 12 | class ExampleFormViewController: FormViewController { 13 | 14 | let pickerOptions = ["One", "Two", "Three"] as [AnyObject] 15 | 16 | struct Static { 17 | static let nameTag = "name" 18 | static let passwordTag = "password" 19 | static let lastNameTag = "lastName" 20 | static let jobTag = "job" 21 | static let emailTag = "email" 22 | static let URLTag = "url" 23 | static let phoneTag = "phone" 24 | static let enabled = "enabled" 25 | static let check = "check" 26 | static let segmented = "segmented" 27 | static let picker = "picker" 28 | static let birthday = "birthday" 29 | static let categories = "categories" 30 | static let button = "button" 31 | static let stepper = "stepper" 32 | static let slider = "slider" 33 | static let textView = "textview" 34 | } 35 | 36 | required init(coder aDecoder: NSCoder) { 37 | super.init(coder: aDecoder) 38 | self.loadForm() 39 | } 40 | 41 | override func viewDidLoad() { 42 | super.viewDidLoad() 43 | self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Submit", style: .plain, target: self, action: #selector(ExampleFormViewController.submit(_:))) 44 | } 45 | 46 | // MARK: Actions 47 | 48 | @objc func submit(_: UIBarButtonItem!) { 49 | 50 | let message = self.form.formValues().description 51 | 52 | let alertController = UIAlertController(title: "Form output", message: message, preferredStyle: .alert) 53 | 54 | let cancel = UIAlertAction(title: "OK", style: .cancel) { (action) in 55 | } 56 | 57 | alertController.addAction(cancel) 58 | 59 | self.present(alertController, animated: true, completion: nil) 60 | } 61 | 62 | // MARK: Private interface 63 | 64 | fileprivate func loadForm() { 65 | 66 | let form = FormDescriptor(title: "Example Form") 67 | 68 | let section1 = FormSectionDescriptor(headerTitle: nil, footerTitle: nil) 69 | 70 | var row = FormRowDescriptor(tag: Static.emailTag, type: .email, title: "Email") 71 | row.configuration.cell.appearance = ["textField.placeholder" : "john@gmail.com" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject ] 72 | section1.rows.append(row) 73 | 74 | row = FormRowDescriptor(tag: Static.passwordTag, type: .password, title: "Password") 75 | row.configuration.cell.appearance = ["textField.placeholder" : "Enter password" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 76 | section1.rows.append(row) 77 | 78 | let section2 = FormSectionDescriptor(headerTitle: nil, footerTitle: nil) 79 | 80 | row = FormRowDescriptor(tag: Static.nameTag, type: .name, title: "First Name") 81 | row.configuration.cell.appearance = ["textField.placeholder" : "e.g. Miguel Ángel" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 82 | section2.rows.append(row) 83 | 84 | row = FormRowDescriptor(tag: Static.lastNameTag, type: .name, title: "Last Name") 85 | row.configuration.cell.appearance = ["textField.placeholder" : "e.g. Ortuño" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 86 | section2.rows.append(row) 87 | 88 | row = FormRowDescriptor(tag: Static.jobTag, type: .text, title: "Job") 89 | row.configuration.cell.appearance = ["textField.placeholder" : "e.g. Entrepreneur" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 90 | section2.rows.append(row) 91 | 92 | let section3 = FormSectionDescriptor(headerTitle: nil, footerTitle: nil) 93 | 94 | row = FormRowDescriptor(tag: Static.URLTag, type: .url, title: "URL") 95 | row.configuration.cell.appearance = ["textField.placeholder" : "e.g. gethooksapp.com" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 96 | section3.rows.append(row) 97 | 98 | row = FormRowDescriptor(tag: Static.phoneTag, type: .phone, title: "Phone") 99 | row.configuration.cell.appearance = ["textField.placeholder" : "e.g. 0034666777999" as AnyObject, "textField.textAlignment" : NSTextAlignment.right.rawValue as AnyObject] 100 | section3.rows.append(row) 101 | 102 | let section4 = FormSectionDescriptor(headerTitle: "An example header title", footerTitle: "An example footer title") 103 | 104 | row = FormRowDescriptor(tag: Static.enabled, type: .booleanSwitch, title: "Enable") 105 | section4.rows.append(row) 106 | 107 | row = FormRowDescriptor(tag: Static.check, type: .booleanCheck, title: "Doable") 108 | section4.rows.append(row) 109 | 110 | row = FormRowDescriptor(tag: Static.segmented, type: .segmentedControl, title: "Priority") 111 | row.configuration.selection.options = ([0, 1, 2, 3] as [Int]) as [AnyObject] 112 | row.configuration.selection.optionTitleClosure = { value in 113 | guard let option = value as? Int else { return "" } 114 | switch option { 115 | case 0: 116 | return "None" 117 | case 1: 118 | return "!" 119 | case 2: 120 | return "!!" 121 | case 3: 122 | return "!!!" 123 | default: 124 | return "" 125 | } 126 | } 127 | 128 | row.configuration.cell.appearance = ["titleLabel.font" : UIFont.boldSystemFont(ofSize: 30.0), "segmentedControl.tintColor" : UIColor.red] 129 | 130 | section4.rows.append(row) 131 | 132 | let section5 = FormSectionDescriptor(headerTitle: nil, footerTitle: nil) 133 | 134 | row = FormRowDescriptor(tag: Static.picker, type: .picker, title: "Gender") 135 | row.configuration.cell.showsInputToolbar = true 136 | row.configuration.selection.options = (["F", "M", "U"] as [String]) as [AnyObject] 137 | row.configuration.selection.optionTitleClosure = { value in 138 | guard let option = value as? String else { return "" } 139 | switch option { 140 | case "F": 141 | return "Female" 142 | case "M": 143 | return "Male" 144 | case "U": 145 | return "I'd rather not to say" 146 | default: 147 | return "" 148 | } 149 | } 150 | 151 | row.value = "M" as AnyObject 152 | 153 | section5.rows.append(row) 154 | 155 | row = FormRowDescriptor(tag: Static.birthday, type: .date, title: "Birthday") 156 | row.configuration.cell.showsInputToolbar = true 157 | section5.rows.append(row) 158 | 159 | row = FormRowDescriptor(tag: Static.categories, type: .multipleSelector, title: "Categories") 160 | row.configuration.selection.options = ([0, 1, 2, 3, 4] as [Int]) as [AnyObject] 161 | row.configuration.selection.allowsMultipleSelection = true 162 | row.configuration.selection.optionTitleClosure = { value in 163 | guard let option = value as? Int else { return "" } 164 | switch option { 165 | case 0: 166 | return "Restaurant" 167 | case 1: 168 | return "Pub" 169 | case 2: 170 | return "Shop" 171 | case 3: 172 | return "Hotel" 173 | case 4: 174 | return "Camping" 175 | default: 176 | return "" 177 | } 178 | } 179 | 180 | section5.rows.append(row) 181 | 182 | let section6 = FormSectionDescriptor(headerTitle: "Stepper & Slider", footerTitle: nil) 183 | 184 | row = FormRowDescriptor(tag: Static.stepper, type: .stepper, title: "Step count") 185 | row.configuration.stepper.maximumValue = 200.0 186 | row.configuration.stepper.minimumValue = 20.0 187 | row.configuration.stepper.steps = 2.0 188 | section6.rows.append(row) 189 | 190 | row = FormRowDescriptor(tag: Static.slider, type: .slider, title: "Slider") 191 | row.configuration.stepper.maximumValue = 200.0 192 | row.configuration.stepper.minimumValue = 20.0 193 | row.configuration.stepper.steps = 2.0 194 | row.value = 0.5 as AnyObject 195 | row.configuration.cell.appearance = ["titleLabel.textColor": UIColor.black, 196 | "sliderView.tintColor": UIColor.red] 197 | section6.rows.append(row) 198 | 199 | row = FormRowDescriptor(tag: Static.picker, type: .picker, title: "Favorite") 200 | row.configuration.cell.showsInputToolbar = true 201 | row.configuration.selection.options = pickerOptions 202 | row.configuration.selection.optionTitleClosure = { value in 203 | guard let option = value as? String else { return "" } 204 | return option 205 | } 206 | row.value = pickerOptions[0] as AnyObject 207 | row.configuration.cell.appearance = [ 208 | "valueLabel.accessibilityIdentifier": "PickerTextFied" as AnyObject] 209 | section6.rows.append(row) 210 | 211 | let section7 = FormSectionDescriptor(headerTitle: "Multiline TextView", footerTitle: nil) 212 | row = FormRowDescriptor(tag: Static.textView, type: .multilineText, title: "Notes") 213 | row.configuration.cell.appearance = ["textField.textColor": UIColor.blue, 214 | "textField.text": "This is a non-text view" as AnyObject] 215 | section7.rows.append(row) 216 | 217 | let section8 = FormSectionDescriptor(headerTitle: nil, footerTitle: nil) 218 | 219 | row = FormRowDescriptor(tag: Static.button, type: .button, title: "Dismiss") 220 | row.configuration.button.didSelectClosure = { _ in 221 | self.view.endEditing(true) 222 | } 223 | section8.rows.append(row) 224 | 225 | form.sections = [section1, section2, section3, section4, section5, section6, section7, section8] 226 | 227 | self.form = form 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /SwiftFormsApplication/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /SwiftFormsApplication/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "8.0", 8 | "subtype" : "736h", 9 | "scale" : "3x" 10 | }, 11 | { 12 | "orientation" : "landscape", 13 | "idiom" : "iphone", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "8.0", 16 | "subtype" : "736h", 17 | "scale" : "3x" 18 | }, 19 | { 20 | "orientation" : "portrait", 21 | "idiom" : "iphone", 22 | "extent" : "full-screen", 23 | "minimum-system-version" : "8.0", 24 | "subtype" : "667h", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "orientation" : "portrait", 29 | "idiom" : "iphone", 30 | "extent" : "full-screen", 31 | "minimum-system-version" : "7.0", 32 | "scale" : "2x" 33 | }, 34 | { 35 | "extent" : "full-screen", 36 | "idiom" : "iphone", 37 | "subtype" : "retina4", 38 | "filename" : "iphone5_splash.png", 39 | "minimum-system-version" : "7.0", 40 | "orientation" : "portrait", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "orientation" : "portrait", 45 | "idiom" : "ipad", 46 | "extent" : "full-screen", 47 | "minimum-system-version" : "7.0", 48 | "scale" : "1x" 49 | }, 50 | { 51 | "orientation" : "landscape", 52 | "idiom" : "ipad", 53 | "extent" : "full-screen", 54 | "minimum-system-version" : "7.0", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "orientation" : "portrait", 59 | "idiom" : "ipad", 60 | "extent" : "full-screen", 61 | "minimum-system-version" : "7.0", 62 | "scale" : "2x" 63 | }, 64 | { 65 | "orientation" : "landscape", 66 | "idiom" : "ipad", 67 | "extent" : "full-screen", 68 | "minimum-system-version" : "7.0", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "orientation" : "portrait", 73 | "idiom" : "iphone", 74 | "extent" : "full-screen", 75 | "scale" : "1x" 76 | }, 77 | { 78 | "orientation" : "portrait", 79 | "idiom" : "iphone", 80 | "extent" : "full-screen", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "orientation" : "portrait", 85 | "idiom" : "iphone", 86 | "extent" : "full-screen", 87 | "subtype" : "retina4", 88 | "scale" : "2x" 89 | }, 90 | { 91 | "orientation" : "portrait", 92 | "idiom" : "ipad", 93 | "extent" : "to-status-bar", 94 | "scale" : "1x" 95 | }, 96 | { 97 | "orientation" : "portrait", 98 | "idiom" : "ipad", 99 | "extent" : "full-screen", 100 | "scale" : "1x" 101 | }, 102 | { 103 | "orientation" : "landscape", 104 | "idiom" : "ipad", 105 | "extent" : "to-status-bar", 106 | "scale" : "1x" 107 | }, 108 | { 109 | "orientation" : "landscape", 110 | "idiom" : "ipad", 111 | "extent" : "full-screen", 112 | "scale" : "1x" 113 | }, 114 | { 115 | "orientation" : "portrait", 116 | "idiom" : "ipad", 117 | "extent" : "to-status-bar", 118 | "scale" : "2x" 119 | }, 120 | { 121 | "orientation" : "portrait", 122 | "idiom" : "ipad", 123 | "extent" : "full-screen", 124 | "scale" : "2x" 125 | }, 126 | { 127 | "orientation" : "landscape", 128 | "idiom" : "ipad", 129 | "extent" : "to-status-bar", 130 | "scale" : "2x" 131 | }, 132 | { 133 | "orientation" : "landscape", 134 | "idiom" : "ipad", 135 | "extent" : "full-screen", 136 | "scale" : "2x" 137 | } 138 | ], 139 | "info" : { 140 | "version" : 1, 141 | "author" : "xcode" 142 | } 143 | } -------------------------------------------------------------------------------- /SwiftFormsApplication/Images.xcassets/LaunchImage.launchimage/iphone5_splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ortuman/SwiftForms/9723a32dd15b7f341abb99d2a530f756f7098026/SwiftFormsApplication/Images.xcassets/LaunchImage.launchimage/iphone5_splash.png -------------------------------------------------------------------------------- /SwiftFormsApplication/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | Launch 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SwiftFormsApplication/Launch.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /SwiftFormsApplication/Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ortuman/SwiftForms/9723a32dd15b7f341abb99d2a530f756f7098026/SwiftFormsApplication/Screenshot.png -------------------------------------------------------------------------------- /SwiftFormsApplication/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SwiftFormsApplication 4 | // 5 | // Created by Miguel Angel Ortuno Ortuno on 14/5/15. 6 | // Copyright (c) 2015 Miguel Angel Ortuno Ortuno. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | } 17 | 18 | override func didReceiveMemoryWarning() { 19 | super.didReceiveMemoryWarning() 20 | // Dispose of any resources that can be recreated. 21 | } 22 | } 23 | 24 | --------------------------------------------------------------------------------