DoubleTextField SwiftUI - admiral-team/admiralui-ios GitHub Wiki

Struct

An object that displays two editable text fields


Declaration

public struct DoubleTextField<T1, T2>: View where T1: TextFieldInput, T2: TextFieldInput

Overview

Complex element contains two textfield which inheritance class TextField. Also you can set width relation between textfields.

Live example

Configure a DoubleTextField with 50/50 dimension

@State private var state: TextInputState = .normal
DoubleTextField(
  firstTextField: StandardTextField($firstText, placeholder: "Placeholder", name: "Optional Label", state: $state),
  secondTextField: StandardTextField($secondText, placeholder: "Placeholder", name: "Optional Label", state: $state),
  alignment: .ratio(ration: 0.5),
  info: "Info",
  infoNumberOfLines: 1,
  state: $state
)

Configure a DoubleTextField with 70/30 dimension

@State private var state: TextInputState = .error
DoubleTextField(
     firstTextField: StandardTextField($text, placeholder: "P1", name: "Optional Label", state: .constant(.normal)),
     secondTextField: StandardTextField($textSecond, placeholder: "P2", name: "Optional Label", state: .constant(.normal)),
     alignment: .ratio(ration: 0.7),
     info: "Info",
     infoNumberOfLines: 1,
     state: .constant(.normal)
)

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.
⚠️ **GitHub.com Fallback** ⚠️