A SwiftUI TextField with a floating label for iOS 15

Share Your Love

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

Share Your Love
Avatar photo
Lingaraj Senapati

Hey There! I am Lingaraj Senapati, the Founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.

Articles: 411

Newsletter Updates

Enter your email address below to subscribe to our newsletter