A Simple SwiftUI Custom TextField component
SwiftUI Custom TextField
This repository developed for SwiftUI textfield component.
Examples
Default
@State var text = "Esat Gozcu"
CustomTextField(text: $text)
Title
@State var text = "Esat Gozcu"
CustomTextField(text: $text)
.setTitleText("Name")
.setTitleColor(.blue)
.setTitleFont(.body)
PlaceHolder
@State var text = ""
CustomTextField(text: $text)
.setPlaceHolderText("Enter a name")
Disable
@State var text = "Esat Gozcu"
@State var disable = true
CustomTextField(text: $text)
.setDisable($disable)
.setDisableColor(Color.gray.opacity(0.2))
Bottom Error
@State var text = "Esat Gozcu"
@State var error = true
@State var errorText = "Your name did not matched"
CustomTextField(text: $text)
.setError(errorText: $errorText, error: $error)
Trailing Image
@State var text = "Esat Gozcu"
CustomTextField(text: $text)
.setTrailingImage(Image(systemName: "qrcode"), click: {
print("qr image tapped")
})