In this post, today I am going to tell about another GitHub repository SwiftUI TextField with a floating label for iOS 15.
FocusTextField:
A TextField with a floating label using the new Focus system on iOS 15.

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