FocusTextField

A TextField with a floating label using the new Focus system on iOS 15.

Screenshot0

Screenshot1

Usage

Usage is as simple as importing FocusTextField, declaring a @State String variable, and initializing FocusTextField with a placeholder.

@import FocusTextField

...

@State var text: String = ""

...

FocusTextField(text: $text) {
	Text("Placeholder")
}

Features

  • Use any view as the placeholder
  • Set the placeholder scale
  • Set the placeholder spacing
  • Set the placeholder animation

To Do

  • Placeholder Active State
  • Match keyboard animation curve (Maybe make animation not customizable?)
  • Make Text Field customizable

Known Bugs

  • Animation looks a bit off when showing/hiding the keyboard

GitHub

https://github.com/EmilioPelaez/FocusTextField