SwiftUI Custom TextField

This repository developed for SwiftUI textfield component.

Examples

Default

@State var text = "Esat Gozcu"

CustomTextField(text: $text)

Default

Title

@State var text = "Esat Gozcu"

CustomTextField(text: $text)
                .setTitleText("Name")
                .setTitleColor(.blue)
                .setTitleFont(.body)

Title

PlaceHolder

@State var text = ""

CustomTextField(text: $text)
                .setPlaceHolderText("Enter a name")

PlaceHolder

Disable

@State var text = "Esat Gozcu"
@State var disable = true

CustomTextField(text: $text)
                .setDisable($disable)
                .setDisableColor(Color.gray.opacity(0.2))

Disable

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)

Bottom Error

Trailing Image

@State var text = "Esat Gozcu"

CustomTextField(text: $text)
                .setTrailingImage(Image(systemName: "qrcode"), click: {
                    print("qr image tapped")
                })

Trailing Image

GitHub

View Github