SZMentionsSwift alternatives and similar libraries
Based on the "Text" category.
Alternatively, view SZMentionsSwift alternatives based on common mentions on social networks and blogs.
-
YYText
Powerful text framework for iOS to display and edit rich text. -
Nimbus
The iOS framework that grows only as fast as its documentation -
PhoneNumberKit
A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber. -
ZSSRichTextEditor
A beautiful rich text WYSIWYG editor for iOS with a syntax highlighted source view -
Twitter Text Obj
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform. -
FontAwesomeKit
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. -
SwiftRichString
👩🎨 Elegant Attributed String composition in Swift sauce -
libPhoneNumber-iOS
iOS port from libphonenumber (Google's phone number handling library) -
TwitterTextEditor
A standalone, flexible API that provides a full-featured rich text editor for iOS applications. -
RichEditorView
RichEditorView is a simple, modular, drop-in UIView subclass for Rich Text Editing. -
Down
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark. -
TextAttributes
An easier way to compose attributed strings -
SwiftyMarkdown
Converts Markdown files and strings into NSAttributedStrings with lots of customisation options. -
FontAwesome.swift
Use FontAwesome in your Swift projects -
SwiftString
A comprehensive, lightweight string extension for Swift -
Iconic
:art: Auto-generated icon font library for iOS, watchOS and tvOS -
MMMarkdown
An Objective-C framework for converting Markdown to HTML. -
CocoaMarkdown
Markdown parsing and rendering for iOS and OS X -
Atributika
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement. -
SwiftIconFont
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon) -
FontBlaster
Programmatically load custom fonts into your iOS, macOS and tvOS app. -
Notepad
[iOS] A fully themeable markdown editor with live syntax highlighting. -
Font-Awesome-Swift
Font Awesome swift library for iOS. -
fuse-swift
A lightweight fuzzy-search library, with zero dependencies -
MarkdownKit
A simple and customizable Markdown Parser for Swift -
FormatterKit
stringWithFormat: for the sophisticated hacker set -
NSStringEmojize
A category on NSString to convert Emoji Cheat Sheet codes to their equivalent Unicode characters -
MarkdownTextView
Rich Markdown editing control for iOS -
Guitar
A Cross-Platform String and Regular Expression Library written in Swift. -
Mustard
🌭 Mustard is a Swift library for tokenizing strings when splitting by whitespace doesn't cut it. -
Translucid
Lightweight library to set an Image as text background. Written in swift. -
Heimdall
Heimdall is a wrapper around the Security framework for simple encryption/decryption operations. -
GoogleMaterialDesignIcons
Google Material Design Icons Font for iOS -
AttributedTextView
Easiest way to create an attributed UITextView (with support for multiple links and from html)
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SZMentionsSwift or a related project?
README
SZMentionsSwift is a lightweight mentions library for iOS. This library was built to assist with the adding, removing and editing of a mention within a textview.
What can it do
Add mentions
You can easily add mentions by typing the trigger (default: @) followed by text to filter your list by. Tapping the name will insert the mention into the textView.
[](ReadMeAssets/Add-Mentions.gif)
Insert mentions
Any text, including mentions, that are inserted before other mentions will automatically adjust the ranges for all existing mentions.
[](ReadMeAssets/Insert-Mentions.gif)
Delete mentions
If at any point text is changed within an existing mention that mention will be removed from the mentions array and any remaining text associated with that mention will revert to default styling.
[](ReadMeAssets/Delete-Mentions.gif)
For more technical details on usage you can check here
How To Get Started
- Download SZMentionsSwift and try out the iOS example app.
Communication
- If you need help, feel free to tweet @StevenZweier
- If you found a bug, have a feature request, or have a general question open an issue.
- If you want to contribute, submit a pull request.
Installation with Carthage
Cartfile
To integrate SZMentionsSwift into your Xcode project using CocoaPods, specify it in your Cartfile
:
github "szweier/SZMentionsSwift"
Then, run the following command:
$ carthage update
Installation with CocoaPods
Podfile
To integrate SZMentionsSwift into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'SZMentionsSwift'
Then, run the following command:
$ pod install
Usage
Below is a quick run through of the objects used in this library but as always the best place to get an understanding of the current implementation of the SZMentionsSwift library is in the example code.
MentionsSwiftListener
This class manages the mention interaction.
Setup
Use one of the many initializers to setup your mentions listener. Parameters explained below:
mentionsTextView
: required The text view we are applying the mentions listener to. Note: it's delegate must be the mentions manager.
delegate
: optional If you would like to receive UITextView delegate methods set this and it will be passed through after processing view the mentions listener.
mentionTextAttributes
: Attributes (see: AttributeContainer
) to apply to the textview for all mentions
defaultTextAttributes
: Attributes (see: AttributeContainer
) to apply to the textview for all text that is not a mention.
spaceAfterMention
: optional Whether or not you would like a space to be added to the end of your mentions. Default is NO
trigger
: The string used to start a mention. Default is @
cooldownInterval
: optional The amount of time to wait between calling showMentionsList. Default is 0.5
searchSpaces
: optional Mention searches can / cannot contain spaces
hideMentions
: required Block of code that is run when the mentions view is to be hidden
didHandleMentionOnReturn
: required Block of code that is run when enter is hit while in the midst of editing a mention.
Use this block to either:
- 1. add the mention and return true stating that the mention was handled on your end (this will tell the listener to hide the view)
- 2. return false stating that the mention was NOT handled on your end (this will allow the listener to input a line break).
showMentionsListWithString
: required Block of code that is run when the mentions list is to be shown
Properties
mentions
: readonly Array of all mentions currently applied to the text view.
Methods
public func reset()
: Call this method to reset your textView's text to an empty string and also remove any existing mentions.
@discardableResult public func addMention(_ mention: CreateMention) -> Bool
: Call this method while adding a mention to apply the mention to the current text.
public func insertExistingMentions(_ existingMentions: [CreateMention])
: Insert mentions into an existing textview. This is provided assuming you are given text
along with a list of users mentioned in that text and want to prep the textview in advance.
CreateMention (Protocol)
This protocol contains the required properties for a mention being sent to the mentions listener
AttributeContainer (Protocol)
This protocol contains the required properties for attributes to be applied to attributed text
Mention
This struct is returned via the mentions
method, it includes the range
of the mention as well as object
containing the object sent to the mentions listener via the addMention(_ mention: CreateMention)
method.
Unit Tests
SZMentionsSwift includes unit tests which can be run on the SZMentionsSwift framework.
Credits
SZMentionsSwift was originally created by Steven Zweier