Response text field

RespondableTextField is a simple text field library for SwiftUI. The reason I wanted to make this library was that I was too lazy to do UIViewRepresentableview every time. On the other hand, I know you’ve had a lot of problems or are tired of dealing with UITextFieldDelegate methods like becomeFirstResponder, resignFirstResponder. I really hope this helps.

Requirements

  • iOS 13.0+ (thanks to SwiftUI)

Setting

  • In Xcode, add the URL of this repository to SwiftPM :

https://github.com/aaronLab/RespondableTextField.git

Use

  • Import RespondableTextField
  • Add a RespondableTextField to your body as shown below.
  • ⚠️ To check that everything is working properly: The labels of each RespondableTextField in each body must be incremented SEQUENTLY in order. ⚠️

RespondableTextField(
text : Bind, tag
: Int,
isFirstResponder: Bool = false,
location : String ? = null, width
: CGFloat ? = null, height
: CGFloat ? = null,
onEditing : ((String) -> Void) ? = null,
didBeginEditing : (() -> Void) ? = null,
didEndEditing : (() -> Void) ? = null,
shouldReturn : ((String?) -> Void) ? = null,
)

  • You also don’t have to fill in all the extra parameters or isFirstResponder.
  • You can make the textField the first responder with isFirstResponder = true.

Extensions

  • reactive protection type()
  • responsive-keyboard-type(_type : UIKeyboardType)
  • respondent-content-type(_type : ITUextContentType)
  • Respondable-Capitalization(_type : ITUextAutocapitalizationType)
  • respondableFont(_font : UIFont)
  • respondable line style()
  • respondable border style()
  • textFieldStyle(_ style : S) -> a view where S : TextFieldStyle
    • Delimitation style: .roundedRect, .none.

Example

You can use or configure RespondableTextField as shown below or see an example file.

//
// ContentView.fast
// Example
//
// Created by Aaron Lee in 2020-12-17
//

SwiftUI
Import RespondableTextField

Structure of the ContentView : View {
// MARK : – DEFICIENCY

@State private var text1 : String =
@ State private text var2 : String =
@ State private text var3 : String =
@ State Private Text var4 : String =

// MARC : – BODY

var body : some view {

ScrollView(showsIndicators : false) {

VStack(alignment: .master, spacing: 30) {

// DefaultGroup {Text(Default).font(.system(size: 14, weight: .bold, design: .default))RespondableTextField(text: $text1,tag: 0,isFirstResponder: true,placeholder: 1) { value onEditing: (value))} didBeginEditing: {print(didBeginEditing)} didEndEditing: (value): {print(didEndEditing)} shouldReturn: { value inrint(shouldReturn: (value ?? ? N/A))}

Text(text1)
}

// SecureType + RectangleLine Border
Group {
Text(SecureType + RectangleLine Border)
.font(.system(size : 14, weight : .bold, design : .default))
RespondableTextField(text : $text2, tag
: 1, filler
: 2, width
: 200, height
: 50) { value in
print(onEditing) : (value)
} didBeginEditing: {
print(didBeginEditing)
} didEndEditing: { (value)) {
print(didEndEditing)
} shouldReturn: { value in
print(shouldReturn: (value ? ? N/A))
}
.respondableSecureType()
.respondableLineStyle()

Text(text2)
}

// NumberPad + OneTimeCode + rounded borderGroup {Text(NumberPad + OneTimeCode + rounded border).font(.system(size: 14, weight: .bold, design: .default))RespondableTextField(text: $text3,tag: 2,placeholder: 3) { value onEditing:(value)} didBeginEditing: {print(didBeginEditing)} didEndEditing: (value) {print(didEndEditing)} shouldReturn: { value inReturn: (value ? ??? N/A))}.respondableKeyboardType(.numberPad).respondableContentType(.oneTimeCode).textFieldStyle(roundedBorderTextFieldStyle())

Text(text3)
}

// didEndEditing + Basel Border + FontGroup {Text(didBeginEditing + didEndEditing + Basel Border).font(.system(size: 14, weight: .bold, design: .default))RespondableTextField(text: $text4,tag: 3,placeholder: 4) { value onEditing:(value)} didBeginEditing: {print(didBeginEditing)} didEndEditing: (value): {print(didEndEditing)} shouldReturn: { value inReturn: (value ? ??? N/A))}.respondableStyle().respondableFont(.systemFont(ofSize : 20, weight : .bold))

Text(text4)
}

} // : V
.padding()
} // : S.preferredColorScheme(.light)}

GitHub

https://github.com/aaronLab/RespondableTextField

textfield swiftui,swiftui textfield style,swiftui textfield oncommit example,swiftui multiline text field,swiftui textfield placeholder,swiftui textfield label,Privacy settings,How Search works,custom textfield swiftui,swift get input from text field

You May Also Like

How to Fix “https aka ms remoteconnect” Error

If you want to play Minecraft, https://aka.ms/remoteconnect is one of the biggest…

How to Install Arch Linux [Step by Step Procedure]

Linux is the best operating system, and it has widely used affiliates…

🥇 Prevent Discord From Starting in Windows 10  Step by Step Guide ▷ 2021

To get the most out of this instant messaging service, it’s important…

Fix: Netflix has no sound on Android

The fact that Netflix has a special plan for certain regions of…