Tagging
  • October 26, 2023

A TextView that provides easy to use tagging feature for Mention or Hashtag.

Introduction


Tagging is a UIView that encloses a TextView that contains an algorithm for tagging. If you’re worried about implementing Mention or Hashtag in your app, you can easily implement them using the library.

Getting Started


  1. Add Tagging to the view as a subview.

  2. Set the list that you want to tag and tag symbol to Tagging.

tagging.symbol = “#”
tagging.tagableList = [“DOOMFIST”, “GENJI”, “MCCREE”, “PHARAH”, “REAPER”, “SOLDIER:76”, “SOMBRA”, “TRACER”, “BASTION”, “HANZO”, “JUNKRAT”, “MEI”, “TORBJORN”, “WIDOWMAKER”, “D.VA”, “ORISA”, “REINHARDT”, “ROADHOG”, “WINSTON”, “ZARYA”, “ANA”, “BRIGITTE”, “LUCIO”, “MERCY”, “MOIRA”, “SYMMETRA”, “ZENYATTA”]

  1. Implement TaggingDataSource on the class that added the Tagging.

tagging.dataSource = self

  1. Get tagable list and tagged list through TaggingDataSource.

func tagging(_ tagging: Tagging, didChangedTagableList tagableList: [String]) {
matchedList = tagableList
}

func tagging(_ tagging: Tagging, didChangedTaggedList taggedList: [TaggingModel]) {
self.taggedList = taggedList
}

Usage


Tagging Property
Property Type Description
cornerRadius CGFloat Corner radius
borderWidth CGFloat Border width
borderColor CGColor Border color
textInset UIEdgeInsets Text inset
backgroundColor UIColor Background color
symbol String Tagging symbol
tagableList [String] Tagable list
defaultAttributes [NSAttributedStringKey: Any] Default attributes for all range attributedText of Textview
symbolAttributes [NSAttributedStringKey: Any] Aattributes for symbol text
taggedAttributes [NSAttributedStringKey: Any] Attributes for tagged text

Installation


CocoaPods (ios 8+)

platform :ios, ‘8.0’
use_frameworks!

target ‘<Your Target Name>’ do
pod ‘Tagging’
end

Carthage (ios 8+)

github “k-lpmg/Tagging”

GitHub


View Github

#hashtag #ios #mention #swift #textview
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS