A SwiftUI TextField with a floating label for iOS 15

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.

Screenshot0

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

Default image
Lingaraj Senapati
Hey There! I am Lingaraj Senapati, the Co-founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.
Articles: 228

Newsletter Updates

Enter your email address below to subscribe to our newsletter