A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

Overview

SkyFloatingLabelTextField

Build Status Coverage Status Pod Platform Pod License

Pod Version Carthage compatible Documentation Readme Score

SkyFloatingLabelTextField is a beautiful, flexible and customizable implementation of the space saving "Float Label Pattern". This design enables adding context to input fields that are visible at the time of typing, while minimizing the additional space used to display this additional context. This component is used in the Skyscanner TravelPro iOS application in several places, like when searching for flights.

On top of implementing the space-saving floating title, the component also supports using iconography, RTL text support (e.g. Arabic & Hebrew), various states (error, selected, highlighted states), and is very much customizable and extensible.

Versioning

Up until version 1.2 Swift 2.2 and 2.3 compatible (and there is a Swift 2.3 branch in case you need it). From version 2.0 onwards only compatible with Swift 3. Please be mindful of the version you're using.

Usage

To start using the component add it to your project using CocoaPods, Carthage or manually as per the Installation section.

The UI component can be used via the SkyFloatingLabelTextField class. To use icons on the right hand side, use the SkyFloatingLabelTextFieldWithIcon class. This control can be used very similar to UITextField - both from Interface Builder, or from code.

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

let textField = SkyFloatingLabelTextField(frame: CGRect(x: 10, y: 10, width: 200, height: 45))
textField.placeholder = "Name"
textField.title = "Your full name"
self.view.addSubview(textField)

Colors

To customize the colors of the textfield, set a few properties - either from code, or from Interface builder. To use a textfield with an icon, utilize the SkyFloatingLabelTextFieldWithIcon class (and bundle the font class with your app). This example will change colors for the textfield on the right:

let lightGreyColor = UIColor(red: 197/255, green: 205/255, blue: 205/255, alpha: 1.0)
let darkGreyColor = UIColor(red: 52/255, green: 42/255, blue: 61/255, alpha: 1.0)
let overcastBlueColor = UIColor(red: 0, green: 187/255, blue: 204/255, alpha: 1.0)

let textField1 = SkyFloatingLabelTextField(frame: CGRect(x: 10, y: 10, width: 120, height: 45))
textField1.placeholder = "First name"
textField1.title = "Given name"
self.view.addSubview(textField1)

let textField2 = SkyFloatingLabelTextField(frame: CGRect(x: 150, y: 10, width: 120, height: 45))
textField2.placeholder = "Last name"
textField2.title = "Family name"

textField2.tintColor = overcastBlueColor // the color of the blinking cursor
textField2.textColor = darkGreyColor
textField2.lineColor = lightGreyColor
textField2.selectedTitleColor = overcastBlueColor
textField2.selectedLineColor = overcastBlueColor

textField2.lineHeight = 1.0 // bottom line height in points
textField2.selectedLineHeight = 2.0
self.view.addSubview(textField2)

Icons and fonts

Use the SkyFloatingLabelTextFieldWithIcon field to display icons next to the textfields. You have the option of using a font or an image as the icon by setting the iconType property (Default = IconType.font). If using an image as icon, you will have to set the iconImage property. If using a font as icon, you will have to set the iconFont property and bundle your icon with your app (if it's not a built in one). Icons can be rotated and more precise positioning is also supported:

Using a font

let overcastBlueColor = UIColor(red: 0, green: 187/255, blue: 204/255, alpha: 1.0)
let textFieldFrame = CGRect(x: 150, y: 10, width: 120, height: 45)

let textField1 = SkyFloatingLabelTextFieldWithIcon(frame: textFieldFrame, iconType: .font)
textField1.placeholder = "Departure"
textField1.title = "Flying from"
textField1.iconFont = UIFont(name: "FontAwesome", size: 15)
textField1.iconText = "\u{f072}" // plane icon as per https://fortawesome.github.io/Font-Awesome/cheatsheet/
self.view.addSubview(textField1)

let textField2 = SkyFloatingLabelTextFieldWithIcon(frame: textFieldFrame)
textField2.placeholder = "Arrival"
textField2.title = "Flying to"
textField2.tintColor = overcastBlueColor
textField2.selectedTitleColor = overcastBlueColor
textField2.selectedLineColor = overcastBlueColor

// Set icon properties
textField2.iconType = .font
textField2.iconColor = UIColor.lightGrayColor()
textField2.selectedIconColor = overcastBlueColor
textField2.iconFont = UIFont(name: "FontAwesome", size: 15)
textField2.iconText = "\u{f072}" // plane icon as per https://fortawesome.github.io/Font-Awesome/cheatsheet/
textField2.iconMarginBottom = 4.0 // more precise icon positioning. Usually needed to tweak on a per font basis.
textField2.iconRotationDegrees = 90 // rotate it 90 degrees
textField2.iconMarginLeft = 2.0
self.view.addSubview(textField2)

Using an image

let textFieldframe = CGRect(x: 150, y: 10, width: 120, height: 45)

let textField1 = SkyFloatingLabelTextFieldWithIcon(frame: textFieldframe, iconType: .image)
textField1.placeholder = "Departure"
textField1.title = "Flying from"
textField1.iconImage = UIImage(imageLiteralResourceName: "PlaneIcon")
self.view.addSubview(textField1)

Error state and delegates

The textfield supports displaying an error state - this can be useful for example when validating fields on the fly. When the errorMessage property is set on the control, then the control is highlighted with the color set in the errorColor property.

To get notified of different events happening on the textfield - such as the text changing, editing starting or ending - just set the func addTarget(_ target: Any?, action: Selector, for controlEvents: UIControl.Event) with the .editingChanged. also can set the delegate property to a class implementing the standard UITextFieldDelegate protocol:

class MyViewController: UIViewController, UITextFieldDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()
        let textField1 = SkyFloatingLabelTextField(frame: CGRect(x: 10, y: 10, width: 120, height: 45))
        textField1.placeholder = "Email"
        textField1.title = "Email address"
        textField1.errorColor = UIColor.redColor()
        textField1.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
        self.view.addSubview(textField1)
    }
    
    // This will notify us when something has changed on the textfield
    @objc func textFieldDidChange(_ textfield: UITextField) {
        if let text = textfield.text {
            if let floatingLabelTextField = textField as? SkyFloatingLabelTextField {
                if(text.characters.count < 3 || !text.containsString("@")) {
                    floatingLabelTextField.errorMessage = "Invalid email"
                }
                else {
                    // The error message will only disappear when we reset it to nil or empty string
                    floatingLabelTextField.errorMessage = ""
                }
            }
        }
    }
}

Disabled state

The textfield also supports displaying a disabled state. When the isEnabled property is set on the control, then the control is highlighted with the color set in the disabledColor property.

    textField.disabledColor = disabledColor
    textField.isEnabled = false

RTL language support

The component automatically detects the language writing direction. When the phone has a RTL language set (e.g. Arabic or Hebrew), then it automatically adjusts to support this style.

Alternatively, set the isLTRLanguage property to manually change the writing direction.

Further customizing the control by subclassing

The control was designed to allow further customization in subclasses. The control itself inherits from UITextField, so the standard overrides from there can all be used. A few other notable customization hooks via overriding are:

  • updateColors: override this method to customize colors whenever the state of the control changes
  • Layout overrides:
    • titleLabelRectForBounds(bounds:CGRect, editing:Bool): override to change the bounds of the top title placeholder view
    • textRectForBounds(bounds: CGRect): override to change the bounds of the control (inherited from UITextField)
    • editingRectForBounds(bounds: CGRect): override to change the bounds of the control when editing / selected (inherited from UITextField)
    • placeholderRectForBounds(bounds: CGRect): override to change the bounds of the placeholder view
    • lineViewRectForBounds(bounds:CGRect, editing:Bool): override to change the bounds of the bottom line view

Documentation

See the SkyFloatingLabelTextField documentation on CocoaDocs.org for the full documentation.

Installation

CocoaPods

The control is available through CocoaPods. CocoaPods can be installed using Ruby gems:

$ gem install cocoapods

Then simply add SkyFloatingLabelTextField to your Podfile:

pod 'SkyFloatingLabelTextField', '~> 3.0'

Lastly, let CocoaPods fetch the latest version of the component by running:

$ pod update
Integrating into Objective C projects

When integrating the component into an Objective C project, in the Podfile add use_frameworks!. For example as shown in SkyFloatingLabelTextFieldObjectiveCExample:

use_frameworks!

target 'SkyFloatingLabelTextFieldObjectiveCExample' do
  pod 'SkyFloatingLabelTextField', '~> 3.0'
end

Then to use the component in your code, add the following line to your .h or .m files:

@import SkyFloatingLabelTextField;

Carthage

The component supports Carthage. Start by making sure you have the latest version of Carthage installed. Using Homebrew run this:

$ brew update
$ brew install carthage

Then add SkyFloatingLabelTextField to your Cartfile:

github "Skyscanner/SkyFloatingLabelTextField"

Finally, add the framework to the Xcode project of your App. Link the framework to your App and copy it to the App’s Frameworks directory via the “Build Phases” section.

Manual

You can download the latest files from our Releases page. After doing so, copy the files in the Sources folder to your project.

Contributing

We welcome all contributions. Please read this guide before opening issues or submitting pull requests, as well as how and who to contact with questions.

Credits

The original component was built by Daniel Langh, Gergely Orosz and Raimon Laupente. Notable contributions by Shai Shamir (RTL language support).

Credits for the original design, and improving it with iconography to Matt D. Smith (@mds).

FAQ

  • Can I use it in Objective C projects?

    Of course! Please see the Integrating-into-Objective-C-projects section on how to integrate the component via CocoaPods.

  • Does the control work well with auto layout? What about using it programmatically?

    The control was built to support both use cases. It plays nicely with autolayout. As the control is a subclass of UITextField, overriding textRectForBounds(bounds:) or editingRectForBounds(bounds:) is always an option. Alternatively, overriding intrinsiccontentsize is also another possibility.

  • How can I remove the line from the bottom of the textfield?

    Set lineHeight and selectedLineHeight to 0, and the line won't be displayed.

  • I'd like to validate the textfield using the errorMessage. How can I re-validate text is typed in the textfield?

    Using a delegate implement the textField(textField:,range:string:) method. This method fires whenever the text is changed - do the validation here. Alternatively, using subclassing you can also override the becomeFirstResponder method to e.g. clear the text or error message when the textfield is selected.

Comments
  • Migrate to Swift 3

    Migrate to Swift 3

    Hey!

    Since we need this framework working for our app, we wanted to help with migration to Swift 3.

    What's in this PR?

    • [x] Migrated SkyFloatingLabelTextField framework and unit test target to Swift 3 syntax
    • [x] Migrated example target to Swift 3
    • [x] Verified that all unit tests pass
    • [x] Verified that example app functions properly
    • [x] Switched to Xcode 8 for running tests on Travis CI
    • [x] Added .swift-version file to allow properly linting podspec when you are ready to release

    I did not do any Swift API design guidelines-related changes, i thought that as library authors, you would probably want to make those choices yourselves. I would be happy to help with other issues of Swift 3 transition, if they arise.

    Thanks for awesome library, and hope this PR will be helpful.

    opened by DenTelezhkin 28
  • fix: set the text alignment to .Natural so it will be presented according to the language alignment rules (RTL support)

    fix: set the text alignment to .Natural so it will be presented according to the language alignment rules (RTL support)

    Since iOS 9 the default value for text alignment is .Natural In iOS 8 you must set the value ignorer to get the correct alignment when changing languages. Originally Labels in iOS 8 didn't have the .Natural alignment value.

    opened by pichirichi 25
  •  Type 'NSAttributedStringKey' (aka 'NSString') has no member 'foregroundColor'

    Type 'NSAttributedStringKey' (aka 'NSString') has no member 'foregroundColor'

    Just updated my Xcode and using swift 4. Xcode = Version 9.0 (9A235) iOS version 10.0 pod --version 1.3.1

    When I try to change target swift version to 3.2 I get this error screen shot 2017-10-02 at 1 42 47 pm screen shot 2017-10-02 at 1 43 07 pm

    Then changing it to swift 4 I get 6 errors mentioned in See #158

    screen shot 2017-10-02 at 1 46 33 pm
    opened by AbdulazizAlmohsen 15
  • @discardableResult for becomeFirstResponder() and resignFirstResponder()

    @discardableResult for becomeFirstResponder() and resignFirstResponder()

    When calling textField.becomeFirstResponder() or textField.resignFirstResponder() Xcode warns:

    Result of call to 'becomeFirstResponder()' is unused Result of call to 'resignFirstResponder()' is unused

    In the example code this is avoided by prefixing all instances with _ = ..., but i like to keep my code clean, so the better solution is to add @discardableResult to those functions in source. This way the result can be used just like before, if needed, but it doesn't have to be used.

    opened by bennokress 14
  • Text is not set to right while select arabic language from app

    Text is not set to right while select arabic language from app

    I have implemented localization Internally(To change language inside app) in app by using this github repo : ios_language_manager

    While changing language from app (Not iPhone language) from English to Arabic it is not changing UITextFiled's placeholder text and value to RTL. But if I change the iPhone language to Arabic then it works perfectly.

    Both of the below textfield's text alignment is natural from storyboard. Without text input only placeholder text (Placeholder should come from right side) screen shot 2017-02-21 at 12 36 22 pm

    With text input and floating placeholder (Text should come from right side) screen shot 2017-02-21 at 12 36 49 pm

    If I change language from iPhone settings then it works perfectly.

    Without text input only placeholder text (Perfect) screen shot 2017-02-21 at 12 46 53 pm

    With text input and floating placeholder (Perfect) screen shot 2017-02-21 at 12 47 11 pm

    question 
    opened by ibhavin 13
  • Icon showing up as question mark

    Icon showing up as question mark

    I added the fontawesome pod but its still not showing when i use foodTextField.iconFont = UIFont(name: "FontAwesome", size: 15) foodTextField.iconText = "\u{f072}"

    I'm using swift3

    question 
    opened by Hsanka6 13
  • Making uppercase optional

    Making uppercase optional

    I think placeholders and error messages shouldn't be uppercase by default.

        open var titleFormatter:((String) -> String) = { (text:String) -> String in
            return text.uppercased()
        }
    

    this should be removed or must be optional

    opened by ugenlik 11
  • Xcode 12 SPM `IPHONEOS_DEPLOYMENT_TARGET` warning

    Xcode 12 SPM `IPHONEOS_DEPLOYMENT_TARGET` warning

    Report

    What did you do?

    Using SkyFloatingLabelTextField in SPM on Xcode 12 GM.

    What did you expect to happen?

    Don't show any build warning.

    What happened instead?

    Produces this warning:

    The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.

    Environment

    Xcode Version: 12 GM SkyFloatingLabelTextField Version: 3.8.0 Deployment Target: iOS 12 Base SDK: iOS 14 Method of Integration: SPM

    According to this thread the problem is that this line is overriding Xcode settings forcing IPHONEOS_DEPLOYMENT_TARGET to an unsupported SDK version by Xcode 12.

    The solution on the thread was remove the platforms section, because they support all platforms/versions so this might not work in this case.

    opened by diogot 10
  • Unknown class SkyFloatingLabelTextField in Interface Builder file

    Unknown class SkyFloatingLabelTextField in Interface Builder file

    Hi, i've got problem using carthage in objective c project.

    I can't change UITextField custom class to SkyFloatingLabelTextField using Interface builder. Somehow IB cannot detect SkyFloatingLabelTextField.

    If i run the project, the UITextField stays the same, and console will say Unknown class SkyFloatingLabelTextField in Interface Builder file

    There is no problem creating using code though.

    Thanks

    question 
    opened by dexcell 10
  • Linker Problem

    Linker Problem

    I've added manually this label text field in my objective-c project and added also the framework. when run the project on physical device o simulator all work perfectly but when I built the project to archive and send the package to Apple, the Xcode's Linker say me that:bitcode bundle could not be generated because '.../SkyFloatingLabelTextField.framework/SkyFloatingLabelTextField' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture arm64'

    How can I fix it?

    P.s. In the SkyFloatingLabelTextField project the folder ObjectiveCExample is Empty and the project SkyFloatingLabelTextFieldObjectiveCExample use cocoapod to insert the framework.

    question 
    opened by Rufy86 10
  • Crash in SkyFloatingLabelTextField textHeight

    Crash in SkyFloatingLabelTextField textHeight

    Report

    What did you do?

    used SkyFloatingLabelTextField in an iOS project using Carthage

    What did you expect to happen?

    App launch without problem, this mostly happens

    What happened instead?

    We have one crash reporting using Crashlytics. Crash report attached.

    SkyFloatingLabelTextField textHeight crashed when force unwrapping self.font

    We were using SkyFloatingLabelText 2.0.1 have upgraded to 3.4.0

    Environment

    Xcode Version: 8.3.3 SkyFloatingLabelTextField Version: 3.4.0 Deployment Target: 10.0, with crash on 10.3.2 (14F89) Base SDK: iOS 10.3 Method of Integration: Carthage

    Project that demonstrates the issue

    We have only one report of this crash. SkyFloatingLabelTextField crash during autolayout.txt

    opened by drjasonharrison 8
  • so silky

    so silky

    ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. Please remove this line and all above before submitting.

    Before you start, are you using the latest SkyFloatingLabelTextField release?

    Issues are for feature requests, and bugs; questions should go to Stack Overflow with the tag skyfloatinglabeltextfield.

    Report

    What did you do?

    ℹ Please replace this with what you did.

    What did you expect to happen?

    ℹ Please replace this with what you expected to happen.

    What happened instead?

    ℹ Please replace this with of what happened instead.

    Environment

    ℹ Please fill in this section with information about your environment

    Xcode Version: SkyFloatingLabelTextField Version: Deployment Target: Base SDK: Method of Integration: CocoaPods | Carthage | Manual

    Project that demonstrates the issue

    ℹ Please link to a project we can download that reproduces the issue if applicable.

    opened by phonefixnicole 0
  • How to have placeholder with mandatory symbol *

    How to have placeholder with mandatory symbol *

    How to have SkyFloatingLabelTextField with mandatory symbols * with red colour. Placeholder text is "Enter your password *", The * should be in different colour?

    opened by arishanapalli 0
  • not working autofill on textfields

    not working autofill on textfields

    when i write code that,

    override func viewDidLoad() {
        super.viewDidLoad()
    
        
        self.skyFloatingLabelTextField.textContentType = .oneTimeCode
        self.skyFloatingLabelTextField.textAlignment = .left
        self.skyFloatingLabelTextField.becomeFirstResponder()
    

    }

    That'i not problem on textContentType but, when i click autoFill on keyboard, text not correctly writing on textfiled

    SkyFloatingLabelTextField library, unsupport autofill ?

    opened by erdicem 0
  • Bump tzinfo from 1.2.5 to 1.2.10

    Bump tzinfo from 1.2.5 to 1.2.10

    Bumps tzinfo from 1.2.5 to 1.2.10.

    Release notes

    Sourced from tzinfo's releases.

    v1.2.10

    TZInfo v1.2.10 on RubyGems.org

    v1.2.9

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    TZInfo v1.2.9 on RubyGems.org

    v1.2.8

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.

    TZInfo v1.2.8 on RubyGems.org

    v1.2.7

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #112.

    TZInfo v1.2.7 on RubyGems.org

    v1.2.6

    • Timezone#strftime('%s', time) will now return the correct number of seconds since the epoch. #91.
    • Removed the unused TZInfo::RubyDataSource::REQUIRE_PATH constant.
    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode.
    • Fixed warnings when running on Ruby 2.7. #106 and #111.

    TZInfo v1.2.6 on RubyGems.org

    Changelog

    Sourced from tzinfo's changelog.

    Version 1.2.10 - 19-Jul-2022

    Version 1.2.9 - 16-Dec-2020

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    Version 1.2.8 - 8-Nov-2020

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
    • Rubinius is no longer supported.

    Version 1.2.7 - 2-Apr-2020

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #112.

    Version 1.2.6 - 24-Dec-2019

    • Timezone#strftime('%s', time) will now return the correct number of seconds since the epoch. #91.
    • Removed the unused TZInfo::RubyDataSource::REQUIRE_PATH constant.
    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode.
    • Fixed warnings when running on Ruby 2.7. #106 and #111.
    Commits
    • 0814dcd Fix the release date.
    • fd05e2a Preparing v1.2.10.
    • b98c32e Merge branch 'fix-directory-traversal-1.2' into 1.2
    • ac3ee68 Remove unnecessary escaping of + within regex character classes.
    • 9d49bf9 Fix relative path loading tests.
    • 394c381 Remove private_constant for consistency and compatibility.
    • 5e9f990 Exclude Arch Linux's SECURITY file from the time zone index.
    • 17fc9e1 Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
    • 6bd7a51 Update copyright years.
    • 9905ca9 Fix directory traversal in Timezone.get when using Ruby data source
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Update Error Label Font

    Update Error Label Font

    I am trying to set the font for error label, but it is always taking the title font. SkyFloatingLabelTextField creates error label with titleFont. Settingtextfield.errorLabel.font = UIFont.systemFont(ofSize: 12.0) is not working. It updates only when i update titleFont but I want to have different font size for title and error label.

    // SkyFloatingLabelTextField.swift
    
    fileprivate func createErrorLabel() {
            let errorLabel = UILabel()
            errorLabel.autoresizingMask = [.flexibleWidth, .flexibleHeight]
            errorLabel.font = titleFont
            errorLabel.alpha = 0.0
            errorLabel.textColor = errorColor
            addSubview(errorLabel)
            self.errorLabel = errorLabel
    }
    

    Xcode Version: 13.3.1 SkyFloatingLabelTextField Version: 4.0

    opened by anish190 0
Releases(3.8.0)
  • 3.8.0(Dec 5, 2019)

    • A new tag format for release has been introduced to be compatible with Swift Package Manager(SPM). The new format does not include the v prefix in tag names. This will be the case for all tags going forward, previous v prefix tags remain in place and new tags without the v prefix has been pushed for these commits too.
    • Added support for Swift Package Manager #296. Thanks to acecilia.
    • Added support for Swift 5 #290. Thanks to jessemx109.
    Source code(tar.gz)
    Source code(zip)
  • v3.6.0(Sep 20, 2018)

  • v3.5.2(Aug 27, 2018)

  • v3.5.1(May 29, 2018)

  • v3.5.0(May 28, 2018)

  • v3.4.1(Mar 27, 2018)

  • v3.3.0(Nov 1, 2017)

  • v3.2.0(Jul 4, 2017)

  • v3.1.0(Apr 19, 2017)

  • v3.0.0(Mar 7, 2017)

    Breaking

    Change implementation of amimation callbacks to include boolean completed flag.

    Before

    textfield.setTitleVisible(false, animated: true) {
    	// Perform callback actions
    }
    

    Now

    textfield.setTitleVisible(false, animated: true) { completed in
    	// Perform callback actions using completed flag
    }
    

    See (#112)[https://github.com/Skyscanner/SkyFloatingLabelTextField/pull/112]

    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Jan 16, 2017)

    • Added @discardableResult to becomeFirstResponder and resignFirstResponder. This silences Xcode warnings about unused results of those functions and brings the implementation closer to the iOS API #98. Thanks to bennokress
    • Disable GCC_GENERATE_TEST_COVERAGE_FILES and GCC_INSTRUMENT_PROGRAM_FLOW_ARCS in release configs. This was causing rejections when submitting to Apple when the library is integrated manually or with Carthage #97. Thanks to vytautasgimbutas
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Dec 7, 2016)

  • v1.3.1(Nov 30, 2016)

    The tag pointed to in .podspec was not updated in the 1.3 release causing it to still point to 1.2.1 instead of 1.3. This release fixes that and correctly points the podspec to the right git tag.

    Source code(tar.gz)
    Source code(zip)
  • v1.3(Nov 30, 2016)

  • v1.2.1(May 19, 2016)

  • v1.2.0(Apr 21, 2016)

    • Added RTL language support
    • Changed the behaviour of errorMessage, removing unnecessary business logic.
      • Before this change there was some "hidden" business logic around the resetting of errorMessage, namely:
        • Whenever the control was selected by a user, it got cleared (becomeFirstResponder invoked)
        • Whenever the text changed, it also got reset (when textField(textField:,range:string:) was invoked)
      • After this change what's different:
        • The errorMessage is no longer reset by any text or focus changes. If a developer sets this message, the error will be displayed, until this property is cleared. To implement the previous functionality, just subscribe to the textField(textField:,range:string:) event on the delegate
        • As a side effect of this, the workaround of double-invoking textField(textField:,range:string:) has been removed, fixing the bug raised by this Issue
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Apr 6, 2016)

    • Bugfix: setting the error message via the textField?(shouldChangeCharactersInRange:replacementString:) method is now possible
    • Added example on how to use the control from Objective C
    Source code(tar.gz)
    Source code(zip)
  • v1.1(Apr 4, 2016)

    • Changed the control to inherit from the UITextField class (previously the control inherited from UIControl)
    • The delegate to use with the textfield is now the UITextFieldDelegate (removed the delegate:SkyFloatingLabelTextFieldDelegate class)
    • Removed placeHolderLabel, textField and hasText properties from SkyFloatingLabelTextField class
    • Removed textRectForBounds(bounds: CGRect) and placeholderLabelRectForBounds(bounds:CGRect) methods from SkyFloatingLabelTextField
    • The above methods have been replaced with the UITextfield methods editingRectForBounds(bounds: CGRect) and placeholderRectForBounds(bounds: CGRect) on SkyFloatingLabelTextField
    • Added placeholderFont, editingOrSelected properties to SkyFloatingLabelTextField class
    Source code(tar.gz)
    Source code(zip)
  • v1.0.6(Mar 11, 2016)

    Removed the hideKeyboardWhenSelected property. This property seemed too specific. To hide the keyboard when selecting a field, an alternative workaround is to set the textField.inputView property to an empty view.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.5(Mar 10, 2016)

    • Added the hideKeyboardWhenSelected property
    • Bugfix: When invoking becomeFirstResponder on a textField that was not yet visible, the keyboard did not show up.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Mar 1, 2016)

Owner
Skyscanner
Skyscanner
A passcode entry field for macOS similar to Apple's two-factor authentication field.

DSFPasscodeView A passcode entry field for macOS similar to Apple's two-factor authentication field. About The control is made up of multiple groups o

Darren Ford 10 Nov 12, 2022
Focus text field in SwiftUI dynamically and progress through form using iOS keyboard.

Focuser Focuser allows to focus SwiftUI text fields dynamically and implements ability move go through the form using Keyboard for iOS 13 and iOS 14.

Art Technologies 118 Dec 25, 2022
Currency text field formatter available for UIKit and SwiftUI 💶✏️

CurrencyText provides lightweight libraries for formating text field text as currency, available for both UIKit and SwiftUI. Its main core, the Curren

Felipe Lefèvre Marino 183 Dec 15, 2022
A SwiftUI TextField with a prompt (or placeholder) that floats above the text field when active or not empty. Requires iOS 15.

FloatingPromptTextField A prompt is the label in a text field that informs the user about the kind of content the text field expects. In a default Tex

Emilio Peláez 43 Nov 3, 2022
Autocomplete for a text field in SwiftUI using async/await

Autocomplete for a text field in SwiftUI using async/await

Dmytro Anokhin 13 Oct 21, 2022
Text entry controls which contain a built-in title/label so that you don't have to add a separate title for each field.

FloatLabelFields Overview Installation Via Interface Builder Via Code Credits Additional References Questions Overview FloatLabelFields is the Swift i

Fahim Farook 1.2k Jan 4, 2023
Easy-to-use token field that is used in the Venmo app.

VENTokenField VENTokenField is the recipients token field that is used in the Venmo compose screen. Installation The easiest way to get started is to

Venmo 797 Dec 6, 2022
Floating-textfield-swiftui - Floating textfield swiftui: Floating field with multiple icons

floating_textfield-swiftui Hey, Guys welcome to this tutorial. In this complete

Patrick 0 Jan 2, 2022
RichTextKit is a Swift-based library for working with rich text in UIKit, AppKit and SwiftUI.

About RichTextKit RichTextKit is a Swift-based library that lets you work with rich text in UIKit, AppKit and SwiftUI. RichTextKit is under developmen

Daniel Saidi 282 Dec 28, 2022
UITextField-based control for (NS)Measurement values input.

MeasurementTextField UITextField-based control for (NS)Measurement values input. Provides type-safe keyboard and picker based input of different measu

Siarhei Fiedartsou 16 Jul 22, 2021
Changes the color of the label text when the button is pressed and also prints hello to the console

MY FIRST APP App Description This app changes the color of the label text when the button is pressed and also prints "hello" to the console. App Walk-

null 0 Nov 29, 2021
UITextField and UITextView subclasses with placeholders that change into floating labels when the fields are populated with text.

Deprecated Please use JVFloatLabeledTextField instead or feel free to chime in on an issue if you'd like to take over the repo. RPFloatingPlaceholders

rob phillips 1.1k Jan 5, 2023
A text view that supports selection and expansion

The Problem UILabel and UITextView offer unsatisfying support for text selection. Existing solutions like TTTAttributedLabel are great but offer a som

Jeff Hurray 636 Dec 20, 2022
Declarative text styles and streamlined Dynamic Type support for iOS

StyledText StyledText is a library that simplifies styling dynamic text in iOS applications. Instead of having to use attributed strings every time yo

Blue Apron 233 Oct 18, 2022
Lightweight set of text fields with nice animation and functionality

TweeTextField This is lightweight library that provides different types of Text Fields based on your needs. I was inspired by Jan Henneberg. Features

Oleg 471 Nov 10, 2022
SwiftUI TextEdit View - A proof-of-concept text edit component in SwiftUI & CoreText.

A proof-of-concept text edit component in SwiftUI & CoreText. No UIKit, No AppKit, no UITextView/NSTextView/UITextField involved.

Marcin Krzyzanowski 80 Dec 1, 2022
Render Markdown text in SwiftUI

MarkdownUI MarkdownUI is a library for rendering Markdown in SwiftUI, fully compliant with the CommonMark Spec. Supported Platforms You can use the Ma

Guille Gonzalez 916 Jan 8, 2023
ExpandableText 😎 (SwiftUI) Expand the text with the "more" button

ExpandableText ?? (SwiftUI) Expand the text with the "more" button Get Started import SwiftUI import ExpandableText struct ExpandableText_Test: View

null 35 Dec 26, 2022
Handles some of the base configuration to make creating a UIAlertController with text entry even easier. Plus validation!

?? FancyTextEntryController A simpler/easier API for adding text fields to UIAlertControllers. Not a custom view, just uses good ol' UIAlertController

Christian Selig 22 Jul 18, 2022