{"id":22117723,"url":"https://github.com/kineticcafe/kcsform-ios","last_synced_at":"2025-10-23T08:48:16.235Z","repository":{"id":56917106,"uuid":"173655611","full_name":"KineticCafe/KCSForm-iOS","owner":"KineticCafe","description":"KCS Form is a library to help you build iOS UI forms using pre-built input types.","archived":false,"fork":false,"pushed_at":"2020-09-10T00:16:14.000Z","size":670,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T02:47:30.150Z","etag":null,"topics":["forms","ios","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KineticCafe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-04T01:55:05.000Z","updated_at":"2021-02-25T07:26:55.000Z","dependencies_parsed_at":"2022-08-20T21:20:30.848Z","dependency_job_id":null,"html_url":"https://github.com/KineticCafe/KCSForm-iOS","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2FKCSForm-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2FKCSForm-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2FKCSForm-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KineticCafe%2FKCSForm-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KineticCafe","download_url":"https://codeload.github.com/KineticCafe/KCSForm-iOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227570072,"owners_count":17787844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forms","ios","swift"],"created_at":"2024-12-01T13:38:55.029Z","updated_at":"2025-10-23T08:48:15.823Z","avatar_url":"https://github.com/KineticCafe.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KCSForm-iOS\n\nKCS Form is a library to help you build iOS UI forms using pre-built input types. The SDK is easy to use and easy to style to make form creation effortless.\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/kcs-forms-preview.png \"FormViewController\")\n\n## Requirements\n\n- iOS 11.0+\n- Xcode 10.1+\n- Swift 4.2+\n\n## Author\n\nMatthew Patience\n- [Github](https://github.com/MatthewPatience)\n- [LinkedIn](https://www.linkedin.com/in/matthewpatience/)\n- [Kinetic Commerce](https://kineticcommerce.com/)\n\n## Dependencies\n\nThese are already imported as pod dependancies, but thanks to the following libraries:\n\n- [Dropdown](https://github.com/AssistoLab/DropDown)\n- [IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager)\n\n## Installation\n\n[CocoaPods](https://cocoapods.org)\n\n```ruby\npod 'KCSForm-iOS'\n```\n\n## Usage\n\nCreate an instance of FormViewController and implement it's delegate:\n\n```swift\nlet formController = FormViewController()\nformController.delegate = self\n```\n\nStylise your form, by default the form has no margins, color, or fonts. Below are some of the available style options (See FormStyle class for all options), feel free to submit PRs to add more if required.\n\n```swift\nlet style = FormStyle()\n\nstyle.fieldTitleColor = .black\nstyle.fieldEntryColor = .black\nstyle.fieldPlaceholderColor = .gray\nstyle.fieldBorderColor = .black\nstyle.fieldErrorColor = .red\nstyle.fieldDisabledColor = .gray\nstyle.buttonLabelColor = .black\nstyle.sectionTitleColor = .black\nstyle.titleColor = .black\nstyle.subTitleColor = .gray\n\nstyle.setFormMargins(leading: 20, trailing: 20, top: 20, bottom: 20)\nstyle.interItemFieldSpacing = 20\nstyle.lineSpacing = 20\nstyle.fieldTitleBottomMargin = 10\nstyle.sectionTitleTopMargin = 20\nstyle.sectionTitleBottomMargin = 0\nstyle.fieldCornerRadius = 2\nstyle.fieldBorderWidth = 1\nstyle.checkboxItemSpacing = 8\nstyle.titleSubTitleTopMargin = 20\nstyle.titleSubTitleBottomMargin = 10\nstyle.titleSubTitleVerticalSpacing = 10\nstyle.errorTopMargin = 5\n\nstyle.fieldTitleFont = UIFont.systemFont(ofSize: 14, weight: .medium)\nstyle.sectionTitleFont = UIFont.systemFont(ofSize: 24, weight: .bold)\nstyle.fieldButtonFont = UIFont.systemFont(ofSize: 18, weight: .bold)\nstyle.titleFont = UIFont.systemFont(ofSize: 18, weight: .medium)\nstyle.subTitleFont = UIFont.systemFont(ofSize: 14, weight: .regular)\nstyle.fieldErrorFont = UIFont.systemFont(ofSize: 14, weight: .regular)\n\nstyle.textFieldStyle = .box\nstyle.bounce = false\n\nformViewController.setStyle(style)\n```\n\nLastly, create the cells that will be in your form. Each cell will require a unique identifier, it is recommended that you use an enum to identify each cell.\n\n```swift\nenum CellId: Int {\n    case firstName\n    case lastName\n    case email\n    case phone\n}\n```\n\nEach cell will require a specific data object that will define it's content and appearance. Width is measured in percentage of the overall width of each form row since the form uses a flow layout.\n\n```swift\nvar cells = [FormViewController.Cell]()\nlet firstNameData = FormTextFieldCell.Data(title: \"First Name\", text: \"\", placeholder: \"John\", keyboardType: .default, returnKeyType: .next, formattingPattern: nil, capitalizationType: .words, isEditable: true, errorText: \"Error!!!\"))\ncells.append(FormViewController.Cell(id: CellId.firstName.rawValue, type: .text, widthPercentage: 0.5, data: firstNameData)\nformController.setCells(cells)\nformController.reloadCollectionView()\n```\n\nWhenever the input content of a cell is changed, a FormViewControllerDelegate callback will be triggered depending on the cell type. For example, the updatedText callback would be triggered in the case of a FormTextFieldCell or FormPasswordCell text change.\n\n```swift\nfunc formViewController(_ controller: FormViewController, updatedText: String?, forCellId id: Int) {\n    switch (id) {\n    case CellId.firstName.rawValue:\n        print(updatedText)\n        break\n    default:\n        break\n    }\n}\n```\n\n## Available Form Components\n\n### Section Title\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/section-title.png \"Section Title\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.section1.rawValue, type: .title, widthPercentage: 1.0,\n    data: FormSectionTitleCell.Data(title: \"Section One\")))\n```\n\n### Text Field\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/text-field.png \"Text Field\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.email.rawValue, type: .text, widthPercentage: 1.0,\n    data: FormTextFieldCell.Data(title: \"Email\", text: \"\", placeholder: \"john@email.com\", keyboardType: .emailAddress, returnKeyType: .next, formattingPattern: nil, capitalizationType: .none, isEditable: true, errorText: nil)))\n```\n\n### Password\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/password.png \"Password\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.password.rawValue, type: .password, widthPercentage: 1.0,\n    data: FormPasswordCell.Data(title: \"Password\", password: \"\", placeholder: \"********\")))\n```\n\n### Button Options\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/button-options.png \"Button Options\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.gender.rawValue, type: .buttonOptions, widthPercentage: 1.0,\n    data: FormButtonOptionsCell.Data(title: \"Gender\", multiSelect: false, options: [\"Male\", \"Female\", \"Other\"])))\n```\n\n### Tags\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/tags.png \"Tags\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.gender.rawValue, type: .buttonOptions, widthPercentage: 1.0,\n    data: FormButtonOptionsCell.Data(title: \"Gender\", multiSelect: false, options: [\"Male\", \"Female\", \"Other\"])))\n```\n\n### Checkbox Options\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/checkbox-options.png \"Checkbox Options\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.contactOptions.rawValue, type: .checkboxOptions, widthPercentage: 1.0,\n    data: FormCheckboxOptionsCell.Data(title: \"Contact Methods\", options: [\"Phone\", \"Email\", \"Snail Mail\", \"Carrier Pidgeon\"], optionStates: [\"Phone\": false, \"Email\": false])))\n```\n\n### Dropdown\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/dropdown.png \"Dropdown\")\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/dropdown-colors.png \"Dropdown Colors\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.country.rawValue, type: .dropdown, widthPercentage: 1.0,\n    data: FormDropdownCell.Data(title: \"Country\", selection: nil, placeholder: \"Select a country\", isEditable: true, options: [\"Canada\", \"USA\", \"Mexico\", \"Westeros\"])))\ncells.append(FormViewController.Cell(id: CellId.eyeColor.rawValue, type: .dropdown, widthPercentage: 1.0,\n    data: FormDropdownCell.Data(title: \"Eye Color:\", selection: nil, placeholder: \"Select a color\", isEditable: true, options: [FormColor(.blue, \"Blue\"), FormColor(.black, \"Black\"), FormColor(.brown, \"Brown\"), FormColor(.cyan, \"Cyan\"), FormColor(.gray, \"Gray\"), FormColor(.green, \"Green\", available: false), FormColor(.magenta, \"Magenta\"), FormColor(.orange, \"Orange\"), FormColor(.purple, \"Purple\")])))\n```\n\n### Label\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/label.png \"Label\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.someLabel.rawValue, type: .label, widthPercentage: 1.0,\n    data: FormLabelCell.Data(text: NSAttributedString(string: \"I am a label!\"))))\n```\n\n### Title Subtitle\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/title-subtitle.png \"Title Subtitle\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.loremIpsum.rawValue, type: .titleSubtitle, widthPercentage: 1.0,\n    data: FormTitleSubtitleCell.Data(title: \"Lorem Ipsum\", subTitle: \"Lorem ipsum dolor sit amet\")))\n```\n\n### Button\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/button.png \"Button\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.save.rawValue, type: .button, widthPercentage: 1.0,\n    data: FormButtonCell.Data(title: \"Save\")))\n```\n\n### Color Options\n\n![alt text](https://github.com/KineticCafe/KCSForm-iOS/raw/master/Component-Images/color-options.png \"Color Options\")\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.favoriteColor.rawValue, type: .colorOptions, widthPercentage: 1.0,\n    data: FormColorOptionsCell.Data(title: \"Favorite Color:\", multiSelect: false, selectedOptionIndex: nil, options: [FormColor(.blue, \"Blue\"), FormColor(.black, \"Black\"), FormColor(.brown, \"Brown\"), FormColor(.cyan, \"Cyan\"), FormColor(.gray, \"Gray\"), FormColor(.green, \"Green\", available: false), FormColor(.magenta, \"Magenta\"), FormColor(.orange, \"Orange\"), FormColor(.purple, \"Purple\")])))\n```\n\n### Spacer\n\n```swift\ncells.append(FormViewController.Cell(id: CellId.spacer.rawValue, type: .spacer, widthPercentage: 1.0, data: FormSpacerCell.Data(height: 20)))\n```\n\n### NEED SOMETHING CUSTOM?\n\nNo problem, just create your own collection view cell, set the cell type to \"custom\", and then tell it what class to use. (Note: Must be an XIB)\n\n```swift\ncells.append(FormViewController.Cell(id: \u003cEXAMPLE_ID\u003e, type: .custom, widthPercentage: 1.0, data: nil, customCell: ExampleCustomCell.self))\n```\n\nYou will also need to implement the FormViewControllerDelegate updateCustomCell callback to update the cell's content when it is about to be displayed:\n\n```swift\nfunc formViewController(_ controller: FormViewController, updateCustomCell cell: UICollectionViewCell, forCellId id: Int) -\u003e UICollectionViewCell {\n    if id == CellId.optIn.rawValue {\n        if let cell = cell as? ExampleCustomCell {\n            cell.update(title: \"Lorem ipsum\")\n        }\n    }\n    return cell\n}\n```\n\n## License\n\nThis repository is licensed under the MIT License\n\nhttps://opensource.org/licenses/MIT\n\n\n## Community and Contributing\n\nWe welcome your contributions. Like all Kinetic Cafe open source projects, is under the Kinetic Cafe Open Source [Code of Conduct][kccoc].\n\n\n[kccoc]: https://github.com/KineticCafe/code-of-conduct\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkineticcafe%2Fkcsform-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkineticcafe%2Fkcsform-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkineticcafe%2Fkcsform-ios/lists"}