Tap to swap out words with emojis. Works with any
UITextView. Heavily inspired by Messages.app on iOS 10.
Add a property of
EmojiController type to a class that holds your
UITextView instance, e.g. a view controller:
var emojiController: EmojiController?
EmojiController by passing it your text view (e.g. in
emojiController = EmojiController(textView: textView)
That's it! 🎉
EmojiController provides three points of customization through properties:
mapping– contains a mapping from words to an array of emojis
textHighlightingFactory– creates a new instance of an object conforming to
TextHighlightingprotocol; each instance of that object is responsible for highlighting a single word
defaultAttributes- attributes (as in
NSAttributedString) of a text that's not replaceable with emoji
EmojiTextView is available through CocoaPods. To install it simply add the following line to your Podfile:
pod "EmojiTextView", "0.0.1"
Then you can import it with:
iOS 9 and above.
UITextInputModedoesn't help here.