Skip to content
/ Form Public

The combination of UIStackView(Vertical Axis) and UIScrollView, and more.

License

Notifications You must be signed in to change notification settings

xueqooy/Form

Repository files navigation

form_view_screenshot

The combination of UIStackView(Vertical Axis) and UIScrollView, and more.

Key Features

  1. Row Alignment: Easily configure row alignments.
  2. Multiple Views in one Row: Add multiple views to a single row.
  3. Section: Organizing items into distinct sections.
  4. Keyboard Handling: Automatically adjusts its contentInset based on keyboard visibility and end editing gesture.
  5. Customizable Background: Supports applying custom background to both the entire FormView and individual sections.
  6. Flexible Item Spacing: Customize the spacing between items using three different approaches.
  7. DSL Syntax:Supports a DSL syntax for a SwiftUI-like experience.

Requirements

  • iOS 13.0+
  • tvOS 13.0+

Usage Example

formView.populate {
    FormRow(imageView, heightMode: .fixed(80))
        .settingCustomSpacingAfter(20)
    
    FormRow(titleLabel, alignment: .center)
        .settingCustomSpacingAfter(20)
    
    FormRow(detailLabel)
        .settingCustomSpacingAfter(40)
    
    FormSection(backgroundView: FieldBackgroundView(), contentInset: .init(top: 20, left: 20, bottom: 20, right: 20), itemSpacing: 15) {
        FormRow(idTextField)
        
        FormSeparator()
        
        FormRow(pswTextField)
    }
    .settingCustomSpacingAfter(10)
    
    FormRow {
        signUpButton

        UIView()

        forgotPswButton
    }

    FormSpacer(50)
    
    FormRow(loginButton, insets: .init(top: 0, left: 20, bottom: 0, right: 20))
}

Snapshot

iOS tvOS
simulator_screenshot_60B125DB-0A0B-4B6E-9DBF-307E7A7360D simulator_screenshot_60B125DB-0A0B-4B6E-9DBF-307E7A7360D

Installation

Using Swift Package Manager:

import PackageDescription

let package = Package(
  name: "MyAwesomeApp",
  dependencies: [
    .Package(url: "https://github.com/xueqooy/Form", majorVersion: 2),
  ]
)

License

Form is licensed under the MIT License. See LICENSE for more information.

Contact

About

The combination of UIStackView(Vertical Axis) and UIScrollView, and more.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages