Latest 1.0.5
License MIT
Platforms ios 9.0

CI Status


To run the example project, clone the repo, and run pod install from the Example directory first.


  • iOS 8.0+
  • Xcode 8.3+
  • Swift 3.2+


GBFloatingTextField is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'GBFloatingTextField'

New in GBFloatingTextField

Add same functionality for TextView. Please check Usage of GBFloatingTextView for more info.

Usage Of GBFloatingTextField

To create an instance of the class, use Interface builder, or do it from code. This example will create the following textField with the placeholder, title , Line and error message:

let textField = GBTextField(frame: CGRect(x:10, y: 100, width: UIScreen.main.bounds.width - 20, height: 40))
textField.lineColor = .black
textField.titleLabelColor = .black
textField.lineHeight = 1
textField.showErrorMessage("This is Text Error")

There are list of Properties you can change . Please check those your customization.

Usage Of GBFloatingTextView

To create an instance of the class, use Interface builder, or do it from code. This example will create the following textView with the placeholder and title:

You don’t need to add this view to Superview just pass the superview when create instance of GBFloatingTextView. Like in Example.

let textView = GBFloatingTextView(frame: CGRect(x: 10, y: 200, width: 355, height: 150), superView: self.view)
textView.isFloatingLabel = true
textView.placeholder = "GBFloating TextView"

To change Placeholder Color, Top Placeholder Color or Selected Placeholer Color. Please check these properties

textView.placeholderColor = .gray
textView.topPlaceholderColor = .black
textView.selectedColor = .red

To enable Floating Text in GBFlaotingTextView. Please enable "isFloatingLabel" , expect this will hide the Floating text like placeholder text in UITextField.

isFloatingLabel is false by default. Please make it true for Floating Placeholder.

You can change these all Properties in Interface builder for both GBFloatingTextField and GBFloatingTextView.


We welcome all contributions.


Gurinder Batth, [email protected]


Credits for the Secure Entry bug , and improving it with the help of SkyFloatingLabelTextField.

Special Thanks

Special thanks to [Mixel]( for animate the floating text in UITextView.


GBFloatingTextField is available under the MIT license. See the LICENSE file for more info.

Known Issue

It wil not work if the clipsToBounds or masksToBounds property is true.

About Future Versions

  1. Working on make this Class for UITextView.
  2. Solve known issues
  3. We will try to make custom everything so everyone can use according to there needs.
  4. Will add RTL language support.

Latest podspec

    "name": "GBFloatingTextField",
    "version": "1.0.5",
    "summary": "GBFloatingTextField is a Floting TextField.",
    "description": "GBFloatingTextField is a Floting TextField. Which also contains Left Image and Right Image. You also perform actions on Both Images.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Gurinder Batth": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.5"
    "platforms": {
        "ios": "9.0"
    "source_files": "GBFloatingTextField/Classes/**/*",
    "swift_version": "3.2"

Pin It on Pinterest

Share This