ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - tadejr/ResizingTokenField: A token field implementation for iOS
A token field implementation for iOS. Contribute to tadejr/ResizingTokenField development by creating an account on GitHub.
Visit Site

GitHub - tadejr/ResizingTokenField: A token field implementation for iOS

GitHub - tadejr/ResizingTokenField: A token field implementation for iOS

ResizingTokenField

Build Status Version License Platform

A token field implementation written in Swift 5.

Example GIF

Features

  • Can be used in Interface Builder or created programmatically
  • Uses a UICollectionView to display tokens, allowing token changes to be animated
  • Automatically updates intrinsic height as content is added and removed
  • Supports collapsing tokens into a text description
  • Allows providing a custom UICollectionViewCell for tokens

Installation

Cocoapods

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

pod 'ResizingTokenField', '~> 0.1.1'

Carthage

To install via Carthage, add the following to your Cartfile:

github "tadejr/ResizingTokenField" "0.1.1"

Usage

The token field can be used via Interface Builder - add an empty UIView to your layout and set its class to ResizingTokenField. It can also be initialized programmatically by using init(frame:).

Meant to be used with auto layout; it provides intrinsic content height, meaning you only need to pin its position and width, height will change automatically as content is added and removed from the field. In Interface Builder, the Placeholder Intrinsic Size setting can be used for height.

Configuration

Customization is possible by setting appropriate properties on a ResizingTokenField instance. Additionally, three different delegates can be set to handle specific behaviour. Check the example project for more info.

Rotation support

The token field does not automatically invalidate layout when its bounds change. To handle device rotation you should manually invalidate layout.

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    tokenField.invalidateLayout()   
}

Height change animation

To animate changes to the token field's height you should call layoutIfNeeded() on an appropriate superview when token field intrinsic height changes.

func resizingTokenField(_ tokenField: ResizingTokenField, willChangeIntrinsicHeight newHeight: CGFloat) {
    view.layoutIfNeeded()
}

func resizingTokenField(_ tokenField: ResizingTokenField, didChangeIntrinsicHeight newHeight: CGFloat) {
    UIView.animate(withDuration: tokenField.animationDuration) {
        self.view.layoutIfNeeded()
    }
}

Author

Tadej Razborsek, [email protected]

License

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

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory