Code Monkey home page Code Monkey logo

tagfield's Introduction

TagField

  • A library to represent a list of tags in a left aligned collectionview.
  • Tags get truncated when the textfield gets focused.
  • Tags get expanded when the textfield is not focused.

Xcode Package Dependency:

Use the following link to add TagField as a Package Dependency to an Xcode project:

https://github.com/manisrini/TagField

Configuration :

let tagComponent = TagFieldComponent()
let tags = [Tag(id: 1, text: "Mango"),Tag(id: 2, text: "Apple")]
let tagVM = TagFieldComponentViewModel(tags: tags,disableTextField: false)
tagComponent.config(viewModel: tagVM)
self.view.addSubview(tagComponent)
  • Can give the initial tags if needed by passing it through a param named "tags".
  • Can disable the text field(in case of only displaying the tags) if needed.
  • Get callback for the every character entered.
  • Append a new tag : (Needed only when you are not using special character configuration) *

self._tagComponent.appendNewTag(tag: tag)

Delegates:

func didGetInstance(instance : TagFieldComponent)

• Take an example where you are developing a mail editor. For BCC, CC and To fields, we can use the same tagfield component. For instance, you are mentioning a new user, here we can get the instance from this method and append the tag.

func handleTypedText (text : String)

• Take the same above mentioned example, we can fetch the mentioned users using this text.

func didChangeHeight(size : CGSize)

• When tags exceeds a line, we can get the height using this method so that we can update parent view height.

func didRemoveTag (removedTag : Tag?, tags : [Tag])

• A callback when each tag is removed.

func didGetFrame (origin: (GPoint) • A callback to get the current frame of the textfield.

TODO LIST :

  • Add truncate and expand as a configuration from the user.
  • Introduce theme to customise fonts and background colors.

#SCREENSHOTS:

Truncated state:

Expanded state:

Demo:

TagFieldDemo.mp4

tagfield's People

Contributors

manisrini avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.