Lightweight set of text fields with nice animation and functionality

Overview

TweeTextField

Swift Version Build Platform Documentation Pod Carthage License

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

Preview

Features

  • Customizable placeholder
  • Customizable label under text field
  • Customizable via Attributes Inspector
  • Nice animation for placeholder
  • Nice animation for bottom line
  • No override of UITextField' behaviors
  • Clean code with divided functionalities
  • Easy to use and extend
  • Right-to-Left support
  • Complete documentation and support

Requirements

  • iOS 10.0+
  • Xcode 11.0+
  • Swift 5.0+

Installation

CocoaPods

To integrate TweeTextField into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'TweeTextField'

Then run pod install to integrate the library in your project.

Swift Package Manager

Adding TweeTextField to the dependencies value of your Package.swift file.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "YOUR_PROJECT_NAME",
    dependencies: [
        .package(url: "https://github.com/oleghnidets/TweeTextField.git", from: "1.6.1"),
    ]
)

Or you may use Xcode. File->Swift Packages->Add Package Dependency. Then put link to the repository.

Carthage

To integrate TweeTextField into your Xcode project using Carthage, specify it in your Cartfile:

github "oleghnidets/TweeTextField"

Run carthage update to build the framework and drag the built TweeTextField.framework into your Xcode project. More info you can find on official page.

Manually

  1. Download the code.
  2. Drag and drop sources in your project.
  3. Import the library in code by import TweeTextField.

Usage

Check out the documentation for more details. Select one of the text fields provided based on your requirements. In general, you can use TweeAttributedTextField. It is a main class with aggregated functionalities of other text fields.

Look at class diagram:

Class-diagram

  • TweePlaceholderTextField has a customized placeholder label which has animations on the beginning and ending editing.
  • TweeBorderedTextField shows a bottom line permanently.
  • TweeActiveTextField shows animated bottom line when a user begins editing.
  • TweeAttributedTextField shows the custom info label under text field.

You can set up text field based on your preferences via Attributes Inspector. Also the library has some properties accessible for you. Check out sample project for more information.

Attributes Inspector

emailTextField.infoAnimationDuration = 0.7
emailTextField.infoTextColor = .systemRed
emailTextField.infoFontSize = 13
        
emailTextField.activeLineColor = .systemBlue
emailTextField.activeLineWidth = 1
emailTextField.animationDuration = 0.3
        
emailTextField.lineColor = .lightGray
emailTextField.lineWidth = 1
        
emailTextField.minimumPlaceholderFontSize = 10
emailTextField.originalPlaceholderFontSize = 13
emailTextField.placeholderDuration = 0.3
emailTextField.placeholderColor = .systemGray2
emailTextField.tweePlaceholder = "Email address"
emailTextField.placeholderLabel.font = UIFont.preferredFont(forTextStyle: .largeTitle)

Communication

License

Distributed under the MIT license. See LICENSE for more information.

Comments
  • Problems when changing orientations

    Problems when changing orientations

    What did you do?

    Changed the device orientation to landscape and back to portrait when the TweeAttributedTextField was in focus (when the keyboard is showing-up).

    What happened instead?

    The TweeAttributedTextField height is increased by x2 and the placeholder became to the middle of the TweeAttributedTextField.

    What did you expect?

    The TweeAttributedTextField should stay the same and the placeholder should re-calculate it's position and be above the TweeAttributedTextField.

    Environment

    • Library version: 1.2.2
    • Xcode version: 9.4.1
    • Swift version: 4.1.2
    • Platform running (iOS version): 11.4
    bug 
    opened by Idomo 13
  • Set `text` programmatically in text field does not move placeholder upward.

    Set `text` programmatically in text field does not move placeholder upward.

    I have a scenario in which I don't have to activate the text field. I have set text in it programatically based on some conditions but now the issue is, this library does not support this thing. When I set text programatically in the text field then placeholder label does not move up. Both text & placeholder text show in the field. It would be a great improvement if you can add this feature in your library.

    help wanted 
    opened by m-junaid-butt 12
  • AutoLayout crashes in the recent commits

    AutoLayout crashes in the recent commits

    What did you do?

    Updated to Xcode 10 beta 5

    What happened instead?

    The layout manager crashed on runtime with message 'Unable to activate constraint with anchors' either on viewDidLoad or when the field become editing

    What did you expect?

    work without crashing

    Environment

    • Library version: branch: master (should be commit b49c32bc7270167417f32820e7353e9f1fdf65fa )
    • Xcode version: 10.0 beta 5
    • Swift version: (if applicable, if not remove) 4.0
    • Platform running (iOS version): iOS 12 beta 6

    Demo Project

    ℹ (Optional) Please link to or upload a project I can download that reproduces the issue.

    Note: I specify the build to commit 01c233ede811a7bb7e8ba7e3d0b5d83b44e1300d and the crash disappears

    bug needs investigation 
    opened by johnny77221 8
  • Change font of the placeholder label

    Change font of the placeholder label

    What did you do?

    I tried to change the font of the placeholder directly but it didn't worked usernameTextField.placeholderLabel.font = UIFont(name: "Avenir-Heavy", size: 12.0) So i decided to create a subclass and override the font variable

    class CRWTextField: TweeAttributedTextField {
      open override var font: UIFont? {
        get { return UIFont(name: "Avenir-Heavy", size: 12.0) }
        set { super.font =  UIFont(name: "Avenir-Heavy", size: 12.0) }
      }
    }
    

    What happened instead?

    The font of the label was changed but now the text is very near the bottom line; as seen in the image: IMG_0095

    What did you expect?

    ℹ Expected results. Please replace this with what you expected.

    Environment

    • **Library version:Lastest
    • **Xcode version:10.1
    • **Swift version: 4.2
    • **Platform running (iOS version): iOS 12
    bug needs investigation 
    opened by dfmarulanda 7
  • Placeholder  font size bug

    Placeholder font size bug

    Hello. I have a problem with the display of the empty field's placeholder. In two different situations, the size of the text of the placeholder is different.

    Example: There are two fields of type TweeAttributedTextField.

    1. If I have the field # 1 selected and I manually tap on the field # 2 - the Placeholder font # 1 has the correct dimensions
    2. If I have the field # 1 selected and I go to the next field using the becomeFirstResponder method, the # 1 Placeholder font is larger than the specified

    The difference is not significant, but noticeable

    In the above examples, the fields are always empty

    TweeTextField version (1.0.4) Xcode Version 9.2 Swift 4 iOS 11.2.1

    bug 
    opened by VinnichenkoD 7
  • Framework via Carthage ins't working

    Framework via Carthage ins't working

    What did you do?

    ℹ When I use Carthage to install the framework, everything is empty. If I do the same thing with CocoaPods, everything is working as expected.

    What happened instead?

    ℹ Framework is empty or have nothing open / public to access in.

    What did you expect?

    ℹ Access to TweeTextField classes as it is with a CocoaPods install.

    Environment

    • Library version: 1.2.0
    • Xcode version: 9.4.1
    • Swift version: 4.1
    • Platform running (iOS version): Simulator (iOS 11.4)
    bug waiting for response 
    opened by damien-nd 6
  • Add SPM support

    Add SPM support

    Hi, thanks for sharing this project. Maybe you could integrate SwiftPackageManager Support in the future? Since Xcode 11 supports it natively in the UI it will may be used more often in the future.

    enhancement 
    opened by rpolenthon 5
  • Add support to manage gap between placeholder label and entered text.

    Add support to manage gap between placeholder label and entered text.

    What did you do?

    ℹ Please replace this with what you did.

    What happened instead?

    ℹ Actual results. Please replace this with of what happened instead.

    What did you expect?

    ℹ Expected results. Please replace this with what you expected.

    Environment

    • Library version:
    • Xcode version:
    • Swift version: (if applicable, if not remove)
    • Platform running (iOS version):

    Demo Project

    ℹ (Optional) Please link to or upload a project I can download that reproduces the issue.

    enhancement waiting for response 
    opened by abdurrehmanio 4
  • Unable to display the placeholder above the text field

    Unable to display the placeholder above the text field

    What did you do?

    usernameTextField.placeholder = "Username"
    usernameTextField.placeholderColor = .systemBlue
    usernameTextField.infoTextColor = .systemGray2
    usernameTextField.showInfo("Hello World!", animated: true)
    usernameTextField.lineWidth = 1.0
    usernameTextField.lineColor = .systemGray2
    

    What happened instead?

    I cannot find a way to place the placeholder above the text field (like the gif shown on the README file).

    What did you expect?

    To find an easier way to add the placeholder above the text field ;-)

    Environment

    • Library version: master
    • Xcode version: 11.4
    • Swift version: (if applicable, if not remove) Apple Swift version 5.2
    • Platform running (iOS version): iOS

    Demo Project

    See snippet above.

    needs investigation 
    opened by tciuro 3
  • Fix placeholder animation glitch

    Fix placeholder animation glitch

    Implementation Details :construction:

    When using embedded view, setText will happen on viewWillAppear on parent view controller. Having a placeholder animation will have placeholder animation not being completed once view appeared on screen and will make the overall appearance like having glitch.

    I propose to lock placeholder animation only in case textfield is editing otherwise no animation is used to move the placeholder.

    opened by loicgriffie 3
  • Placeholder overlay with set text when the text is set in Interface builder

    Placeholder overlay with set text when the text is set in Interface builder

    This bug is kind of like #8 mentioned, but now it's in case when I set text in interface builder it's fine when I set the text programmically, but it would be good if you can fix this.

    What did you do?

    set both text and placeholder in interface builder

    What happened instead?

    Text and placeholder displayed, placeholder didn't move up

    What did you expect?

    expected placeholder moved up since text is set

    Environment

    • Library version: 1.2.2
    • Xcode version: 10 beta 2
    • Swift version: 4.0 (main project is using 4.2 with specified swift_version=4.0 in Podfile post_install area)
    • Platform running (iOS version): 12.0 on iPhone 8 simulator

    Demo Project

    ℹ (Optional) Please link to or upload a project I can download that reproduces the issue.

    bug 
    opened by johnny77221 3
  • really good

    really good

    What did you do?

    ℹ Please replace this with what you did.

    What happened instead?

    ℹ Actual results. Please replace this with of what happened instead.

    What did you expect?

    ℹ Expected results. Please replace this with what you expected.

    Environment

    • Library version:
    • Xcode version:
    • Swift version: (if applicable, if not remove)
    • Platform running (iOS version):

    Demo Project

    ℹ (Optional) Please link to or upload a project I can download that reproduces the issue.

    opened by phonefixnicole 0
  • For iOS 16 textfield Long press

    For iOS 16 textfield Long press

    For iOS 16 textfield crashing.

    ℹ Long press in the textfield

    What happened instead?

    ℹ Actual results. If any textfield text selected or long pressed textfield giving crash

    What did you expect?

    ℹ Expected results. If any textfield text selected or long pressed it should't give crash.

    Environment

    • Library version:
    • Xcode version: 14
    • Swift version: 5+
    • Platform running (iOS 16):

    Demo Project

    ℹ (Optional) Please link to or upload a project I can download that reproduces the issue.

    opened by malisanjay5433 1
Releases(1.6.4)
Owner
Oleg
Passionate  developer
Oleg
Awesome TextField is a nice and simple libriary for iOS and Mac OSX

Awesome TextField is a nice and simple libriary for iOS and Mac OSX. It's highly customisable and easy-to-use tool. Works perfectly for any registration or login forms in your app.

Alexander Shoshiashvili 225 Nov 21, 2022
CHIOTPField is a set of textfields that can be used for One-time passwords, SMS codes, PIN codes, etc. Mady by @ChiliLabs - https://chililabs.io

CHIOTPField CHIOTPField is a set of textfields that can be used for One-time passwords, SMS codes, PIN codes, etc. All fields support insertion of one

Chili Labs 241 Dec 13, 2022
A Float Input View with smooth animation and supporting icon and seperator written with Swift

RSFloatInputView Features Smooth animation using CoreText Support optional left icon Support optional seperator Configurable padding, size, fonts and

null 103 Nov 13, 2022
A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

SkyFloatingLabelTextField SkyFloatingLabelTextField is a beautiful, flexible and customizable implementation of the space saving "Float Label Pattern"

Skyscanner 4k Jan 1, 2023
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
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
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
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
AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

Abdelrhman Kamal 79 Jan 3, 2023
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
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
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
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
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
Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen in Apple's TV & TestFlight iOS apps.

SwiftUI Matched Inline Title Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen i

Seb Jachec 19 Oct 9, 2022
ARAutocompleteTextView is a subclass of UITextView that automatically displays text suggestions in real-time

ARAutocompleteTextView is a subclass of UITextView that automatically displays text suggestions in real-time. This is perfect for automatically suggesting the domain as a user types an email address, #hashtag or @alexruperez.

Alex Rupérez 261 Jun 29, 2022