All Projects → szweier → Szmentionsswift

szweier / Szmentionsswift

Licence: mit
Library to help handle mentions

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Szmentionsswift

Pincodeinputview
A input text view for entering pin code.
Stars: ✭ 108 (-0.92%)
Mutual labels:  cocoapods, carthage, textview
Nextgrowingtextview
📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.
Stars: ✭ 1,540 (+1312.84%)
Mutual labels:  cocoapods, carthage, textview
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (+44.95%)
Mutual labels:  cocoapods, carthage, textview
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+9722.02%)
Mutual labels:  cocoapods, carthage
Ccnpreferenceswindowcontroller
CCNPreferencesWindowController is an Objective-C subclass of NSWindowController that automatically manages your custom view controllers for handling app preferences.
Stars: ✭ 105 (-3.67%)
Mutual labels:  cocoapods, carthage
Colormatchtabs
This is a Review posting app that let user find interesting places near them
Stars: ✭ 1,341 (+1130.28%)
Mutual labels:  cocoapods, carthage
Cardsstack
An awesome set of cards at your disposal ✌️ ⚡️
Stars: ✭ 97 (-11.01%)
Mutual labels:  cocoapods, carthage
Fscalendar
A fully customizable iOS calendar library, compatible with Objective-C and Swift
Stars: ✭ 9,829 (+8917.43%)
Mutual labels:  cocoapods, carthage
Tkdotsegment
TKDotSegment is a segment with dot animation
Stars: ✭ 103 (-5.5%)
Mutual labels:  cocoapods, carthage
Sdwebimagewebpcoder
A WebP coder plugin for SDWebImage, use libwebp
Stars: ✭ 101 (-7.34%)
Mutual labels:  cocoapods, carthage
Rdgliderviewcontroller Swift
Control for a floating view gliding over a ViewController Edit
Stars: ✭ 102 (-6.42%)
Mutual labels:  cocoapods, carthage
Nvactivityindicatorview
A collection of awesome loading animations
Stars: ✭ 10,031 (+9102.75%)
Mutual labels:  cocoapods, carthage
Tkrubberindicator
A rubber animation pagecontrol
Stars: ✭ 1,337 (+1126.61%)
Mutual labels:  cocoapods, carthage
Swiftcsvexport
Swift CSV Export is rich features framework and it helpful to read and write CSV in simple way.
Stars: ✭ 96 (-11.93%)
Mutual labels:  cocoapods, carthage
Pluggableappdelegate
!! No longer supported !! A lightweight service-oriented AppDelegate for iOS, made in Swift.
Stars: ✭ 96 (-11.93%)
Mutual labels:  cocoapods, carthage
Swiftforms
A small and lightweight library written in Swift that allows you to easily create forms.
Stars: ✭ 1,329 (+1119.27%)
Mutual labels:  cocoapods, carthage
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+33749.54%)
Mutual labels:  cocoapods, carthage
Quick
The Swift (and Objective-C) testing framework.
Stars: ✭ 9,303 (+8434.86%)
Mutual labels:  cocoapods, carthage
Cocoapods Playgrounds
🃏 Generate Swift Playgrounds for any library.
Stars: ✭ 1,307 (+1099.08%)
Mutual labels:  cocoapods, carthage
Puzzlemaker
Swift framework responsible for generating puzzles from the image
Stars: ✭ 99 (-9.17%)
Mutual labels:  cocoapods, carthage

Carthage compatible codecov Donate Build Status CocoaPods Compatible Platform Twitter

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.

Insert mentions

Any text, including mentions, that are inserted before other mentions will automatically adjust the ranges for all existing mentions.

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.

For more technical details on usage you can check here

How To Get Started

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

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

More Info Here

Installation with CocoaPods

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].