SwiftUI: How to make Floating Text Field?

Xcode 12 — iOS 14

Prafulla Singh
1 min readSep 27, 2020

Steps:

  • Bind Text field and a Text on ZStack.
  • Add Leading alignment to Text, so that Text View fit as Place Holder
  • Add call back for editing enable and disable.
  • On Editing move Textview Up with animation using Padding, add scale effect and animation for smooth transition.
  • Keep Text view place holder empty and use this new Text as Proxy placeholder.

--

--