Easy-to-use token field that is used in the Venmo app.

Overview

VENTokenField

Build Status

VENTokenField is the recipients token field that is used in the Venmo compose screen.

alt text

Installation

The easiest way to get started is to use CocoaPods. Just add the following line to your Podfile:

pod 'VENTokenField', '~> 2.0'

Usage

If you've ever used a UITableView, using VENTokenField should be a breeze.

Similar to UITableView, VENTokenField provides two protocols: <VENTokenFieldDelegate> and <VENTokenFieldDataSource>.

VENTokenFieldDelegate

This protocol notifies you when things happen in the token field that you might want to know about.

  • tokenField:didEnterText: is called when a user hits the return key on the input field.
  • tokenField:didDeleteTokenAtIndex: is called when a user deletes a token at a particular index.
  • tokenField:didChangeText: is called when a user changes the text in the input field.
  • tokenFieldDidBeginEditing: is called when the input field becomes first responder.

VENTokenFieldDataSource

This protocol allows you to provide info about what you want to present in the token field.

Implement...

  • tokenField:titleForTokenAtIndex: to specify what the title for the token at a particular index should be.
  • numberOfTokensInTokenField: to specify how many tokens you have.
  • tokenFieldCollapsedText: to specify what you want the token field to say in the collapsed state.

Sample Project

Check out the sample project in this repo for sample usage.

Contributing

We'd love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. We'll do our best to respond to your patch as soon as possible. You can also submit a new GitHub issue if you find bugs or have questions. :octocat:

Please make sure to follow our general coding style and add test coverage for new features!

Comments
  • Clear input when we are adjusting frame

    Clear input when we are adjusting frame

    This resolves issue #76 When we are laying out subviews, we were already passing NO for adjustFrame. When we are reloading data, we were already passing YES for adjustFrame.

    It turns out that when we are not adjustingFrame, we do not want to clear the user-entered text, so reuse this boolean to keep from clearing the user text.

    opened by walsh2000 10
  • Fix collapse bug introduced by the size change fix

    Fix collapse bug introduced by the size change fix

    Adding a test and a minimal solution to the collapse feature that was broken in #26. While this solution solves the issue here, it seems kind of backwards. I think that the token field needs to keep track of the collapsed state so that reloading data while the field is collapsed keeps the field collapsed. However this is a potential API breaker as some users may be depending on the fact that refreshing data uncollapses the field.

    Could we get @ayanonagon to weigh in on what the right solution is here? I'd be happy to make the fix if we determine it's the right choice.

    opened by bmnick 9
  • Add the ability to change to label text

    Add the ability to change to label text

    This allows changing the prompt label, that until now was hardcoded to be only to, to be edited to any value. Changing the label will incur a small performance penalty, as to ensure layout is appropriate, data is completely reloaded at this point.

    opened by bmnick 5
  • Flexibility to choose color for individual texts in VENTokenField

    Flexibility to choose color for individual texts in VENTokenField

    This change allows us to choose different colour for different token title.

    This change is because, I am using VENTokenField to input email-ID's. If the email ID's were invalid, I needed to show it in red.

    opened by MaheshRS 4
  • Content rescaling on layout (orientation) change

    Content rescaling on layout (orientation) change

    Hi, Thanks for the great work! :)

    I just found if I rotate the device then the token field's scroll view content size not follows its frame change, which implies the inputTextField's width also not resized. Do you know a more convenience method to fix this than my layoutSubviews override?

    Cheers

    opened by bithug 4
  • isFirstResponder

    isFirstResponder

    Hello

    VENTokenField responds to become & resign firstResponder, but does not correctly respond to isFirstResponder.

    Would you be open to a PR which exposes isFirstResponder ?

    Something like:

    - (BOOL)isFirstResponder {
        return [self.inputTextField isFirstResponder];
    }
    
    
    opened by walsh2000 3
  • Exposing UITextAutocorrectionType and initializing it to none.

    Exposing UITextAutocorrectionType and initializing it to none.

    Sorry, this is the same pull request from before. I've created a separate branch for this, and my master no longer has this change. Sorry for the confusion.

    opened by ShengJunDong89 3
  • memory leak issue

    memory leak issue

    it seems there is a leak causing by retain cycle issue in the following method:

    - (void)layoutTokensWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *)currentY
    {
        for (NSUInteger i = 0; i < [self numberOfTokens]; i++) {
            // ...
    
            __weak VENToken *weakToken = token;
            token.didTapTokenBlock = ^{
                [self didTapToken:weakToken];   // <===== token retain self
            };
    
            // ...
            [self.tokens addObject:token];   // <===== self retain token
    
            // ...
        }
    }
    

    fix:

    - (void)layoutTokensWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *)currentY
    {
        for (NSUInteger i = 0; i < [self numberOfTokens]; i++) {
            // ...
    
            __weak VENToken *weakToken = token;
            __weak VENTokenField *weakSelf = self;
            token.didTapTokenBlock = ^{
                [weakSelf didTapToken:weakToken];
            };
    
             // ...
            [self.tokens addObject:token]; 
    
            // ...
        }
    }
    
    opened by eyalc 3
  • Question

    Question

    How do I add a text when an Item is tapped, I managed to do a similar app as the GIF shows (autocomplete) but how do I add the token when a cell is tapped?

    opened by Abel7x 2
  • Example code for autocomplete gif  used in read me

    Example code for autocomplete gif used in read me

    Thanks for fixing up that bug, it's working great now. Do you, or do you plan to, have a version with autocomplete functionality like in the preview gif used in the read me?

    opened by jonthomp 2
  • Fix iOS 8 delete token issue, close #13

    Fix iOS 8 delete token issue, close #13

    @Dasmer @marklarr code review please :pray:

    This fixes the issue where you can't delete tokens in iOS 8 because deleteBackward is no longer called when UITextField is empty.

    opened by ayanonagon 2
  • Bump i18n from 0.6.9 to 1.10.0

    Bump i18n from 0.6.9 to 1.10.0

    Bumps i18n from 0.6.9 to 1.10.0.

    Release notes

    Sourced from i18n's releases.

    v1.10.0

    What's Changed

    New Features

    Bug fixes

    Other changes

    New Contributors

    Full Changelog: https://github.com/ruby-i18n/i18n/compare/v1.9.1...v1.10.0

    v1.9.1

    What's Changed

    Full Changelog: https://github.com/ruby-i18n/i18n/compare/v1.9.0...v1.9.1

    v1.9.0

    Minor version bump: The number of changes in this release are more than I would feel comfortable including in a point release. Therefore, I have bumped the minor version number here. -- @​radar

    What's Changed

    ... (truncated)

    Commits
    • b805537 Bump to 1.10.0
    • 789d12e Merge pull request #622 from movermeyer/movermeyer/resolve_defaults_with_curr...
    • 19f190d Allow overriding of entry resolving entry resolving separate from defaults
    • 0a9e47a Merge pull request #621 from mishina2228/add-badge
    • 0820914 Add a version badge
    • fb7095a Merge pull request #612 from Shopify/pm/lazy-loadable-backend
    • 422959a Introduce LazyLoadable backend
    • 00fc810 Merge pull request #616 from codealchemy/normalize-keys/splat
    • f3c1936 Tweak array construction in normalize_keys
    • eb9dbf4 Yield loaded translations to block in #load_translations
    • 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
  • Bump activesupport from 3.2.18 to 6.0.1

    Bump activesupport from 3.2.18 to 6.0.1

    Bumps activesupport from 3.2.18 to 6.0.1.

    Release notes

    Sourced from activesupport's releases.

    6.0.1

    Active Support

    • ActiveSupport::SafeBuffer supports Enumerator methods.

      Shugo Maeda

    • The Redis cache store fails gracefully when the server returns a "max number of clients reached" error.

      Brandon Medenwald

    • Fixed that mutating a value returned by a memory cache store would unexpectedly change the cached value.

      Jonathan Hyman

    • The default inflectors in zeitwerk mode support overrides:

      # config/initializers/zeitwerk.rb
      Rails.autoloaders.each do |autoloader|
        autoloader.inflector.inflect(
          "html_parser" => "HTMLParser",
          "ssl_error"   => "SSLError"
        )
      end
      

      That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to String#camelize, so existing inflection rules are still taken into account for non-overridden basenames.

      Please, check the autoloading guide for zeitwerk mode if you prefer not to depend on String#camelize at all.

      Xavier Noria

    • Improve Range#===, Range#include?, and Range#cover? to work with beginless (startless) and endless range targets.

      Allen Hsu, Andrew Hodgkinson

    • Don't use Process#clock_gettime(CLOCK_PROCESS_CPUTIME_ID) on Solaris

      Iain Beeston

    Active Model

    • No changes.

    Active Record

    ... (truncated)
    Changelog

    Sourced from activesupport's changelog.

    Rails 6.0.1 (November 5, 2019)

    • ActiveSupport::SafeBuffer supports Enumerator methods.

      Shugo Maeda

    • The Redis cache store fails gracefully when the server returns a "max number of clients reached" error.

      Brandon Medenwald

    • Fixed that mutating a value returned by a memory cache store would unexpectedly change the cached value.

      Jonathan Hyman

    • The default inflectors in zeitwerk mode support overrides:

      # config/initializers/zeitwerk.rb
      Rails.autoloaders.each do |autoloader|
        autoloader.inflector.inflect(
          "html_parser" => "HTMLParser",
          "ssl_error"   => "SSLError"
        )
      end
      

      That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to String#camelize, so existing inflection rules are still taken into account for non-overridden basenames.

      Please, check the autoloading guide for zeitwerk mode if you prefer not to depend on String#camelize at all.

      Xavier Noria

    • Improve Range#===, Range#include?, and Range#cover? to work with beginless (startless) and endless range targets.

      Allen Hsu, Andrew Hodgkinson

    • Don't use Process#clock_gettime(CLOCK_PROCESS_CPUTIME_ID) on Solaris

      Iain Beeston

    Rails 6.0.0 (August 16, 2019)

    • Let require_dependency in zeitwerk mode look the autoload paths up for better backwards compatibility.

      Xavier Noria

    ... (truncated)
    Commits
    • 09a2979 v6.0.1
    • 7982363 v6.0.1.rc1
    • 0dd2404 Merge pull request #37494 from shugo/safe_buffer_enumerator_fix
    • 036fe8e Add bug tracker/documentation/mailing list URIs to the gemspecs
    • 7b6e25c documents support for zeitwerk mode inflectors overrides in CHANGELOG [skip ci]
    • 035ea91 support for overrides in :zeitwerk mode inflectors
    • 8f6915a bump Zeitwerk to 2.2
    • 4132666 update https urls [ci skip]
    • a9dd6e5 Redis cache store: fail gracefully when max clients reached
    • 458013d Remove any precision problem by comparing the float values
    • 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 ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major 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
  • Add an image along with token text on iOS

    Add an image along with token text on iOS

    Hi Team,

    I would like to add an icon along with the token field on the iOS platform. Is there any way I can add an image before each token field element?

    opened by ankitrahejaquo 0
Releases(v2.5.2)
Owner
Venmo
Venmo
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
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
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
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
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
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
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
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
A TextView that provides easy to use tagging feature for Mention or Hashtag

Tagging A TextView that provides easy to use tagging feature for Mention or Hashtag. Introduction Tagging is a UIView that encloses a TextView that co

DongHee Kang 109 Dec 5, 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
StyledTextKit is a declarative attributed string library for fast rendering and easy string building.

StyledTextKit is a declarative attributed string library for fast rendering and easy string building. It serves as a simple replacement to NSAttribute

GitHawk 1.2k Dec 23, 2022
Aplicación SwiftUI para visualizar datos de Github dados un usuario y un token (Github token), implementa autenticación biométrica mediante FaceID.

ios-app-swift-gitapp Aplicación SwiftUI para visualizar datos de Github dados un usuario y un token (Github token), implementa autenticación biométric

null 3 Aug 25, 2022
A token field implementation for iOS

ResizingTokenField A token field implementation written in Swift 5. Features Can be used in Interface Builder or created programmatically Uses a UICol

Tadej Razboršek 100 Sep 19, 2022
Highly customizable iOS tags view [input, edit, dynamic, tag, token, field, NSTokenField]

RKTagsView Highly customizable iOS tags view (like NSTokenField). Supports horizontal and vertical direction, editing, multiple selection, Auto Layout

Roman Kulesha 450 Oct 2, 2022
Make and accept payments in your iOS app via Venmo

Venmo iOS SDK The Venmo iOS SDK lets you make and accept payments in your app using Venmo. Installation If you're using CocoaPods: If you don't have a

Venmo 170 Dec 26, 2022
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
LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.

LinkedInSignIn Example To run the example project, clone the repo, and run pod install from the Example directory first. Also you need to setup app on

Serhii Londar 34 Sep 1, 2022
OIDCLite implements the basics of getting a token using Apple's ASWebAuthenticationSession

OIDCLite While there are a few good Swift packages for Open ID Connect out there, most are /very/ heavyweight and can get quite complex. For projects

Joel Rennich 7 Apr 20, 2022
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey ?? to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Sagaya Abdulhafeez 150 Dec 23, 2021
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey ?? to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Sagaya Abdulhafeez 150 Dec 23, 2021