My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Streamoji - Custom Emoji Library for iOS UITextView

Streamoji - Custom Emoji Library for iOS UITextView

Matheus Cardoso's photo
Matheus Cardoso
·Jul 22, 2020·

3 min read

Custom emojis are a fun way to bring more life and customizability to your apps. They're available in some of the most popular apps, such Slack, Discord, and Twitch. However, iOS SDK doesn't provide straight forward support for custom emojis out of the box. Now, you're a couple lines of code away from adding them to your own app with a new free and open source library for iOS, Streamoji. GitHub stars

Image is an animated Streamoji banner showing various custom mojis gifs with the words Streamoji and this is a UITextView

Streamoji is a custom emoji rendering library for iOS. It supports GIF, images (png, jpg, etc...), and unicode. It loads from URLs or local assets. Caching is taken care of and performance is lightning fast! In this initial version, you can configure a UITextView to render the emojis. You can control the display quality as well as the scale compared to the surrounding text.

Using Streamoji

To get started using Streamoji, create a new iOS project, or navigate to your existing one. You can install Streamoji with CocoaPods, Swift Package Manager, or Carthage. If you just want to see it working, you can clone the Streamoji repository and run the example included.

Image shows an iOS example app using Streamoji with custom emojis animated in GIF in a UITextView

Where to find custom emojis

Custom emojis can be found on a number of different sites. I recommend looking through Slackmojis and selecting your favorites. You can also create your own.

Define emojis

First step is to define your custom emojis in a dictionary with the key being the :shortcode: for the emoji and the EmojiSource being the, uhmmm, source of the emoji! It can be from GIF or image in a local asset, remote URL, or even a unicode character. You can also define aliases (alternate codes).

Configure UITextView

After defining your emojis, you should call UITextView.configureEmojis:

You can also tweak a couple (for now) rendering options: quality and scale in relation to the surrounding text.

Contributing

If you have a feature suggestion or bug report, please file an issue in the Streamoji repository. If you want to take a stab at contributing code, don't hesitate in submitting a PR. Don't forget to leave a star :)

Product Hunt

Streamoji is also on Product Hunt. Follow it there to get notified of updates! You are currently using the basic markdown editor that uses Jekyll front matter. You can also use the rich+markdown editor you can find in UX settings. Editor Basics Use Markdown to write and format posts. Commonly used syntax You can use Liquid tags to add rich content such as Tweets, YouTube videos, etc. Save changes