Streamoji - Custom Emoji Library for iOS UITextView
Tags: ios, beginners, opensource, swift
Published: 2020-07-21 16:26:00

---
title: Streamoji - Custom Emoji Library for iOS UITextView
published: true
description: 
tags: ios, beginner, opensource, swift
cover_image: https://i.imgur.com/k6rzjgd.png
canonical_url: https://getstream.io/blog/custom-emoji-library-ios/
---

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](https://github.com/GetStream/Streamoji). [![GitHub stars](https://img.shields.io/github/stars/getstream/streamoji?style=social)](https://github.com/GetStream/Streamoji)

![Image is an animated Streamoji banner showing various custom mojis gifs with the words Streamoji and this is a UITextView](https://github.com/GetStream/Streamoji/raw/main/meta/images/banner.gif)

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](https://cocoapods.org/pods/Streamoji), 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](https://i.imgur.com/B4R4hLB.gif)

### Where to find custom emojis

Custom emojis can be found on a number of different sites. I recommend looking through [Slackmojis](https://slackmojis.com/) 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).

{% gist https://gist.github.com/cardoso/0bdb6739d2bc1648bde9e2de2817fe5c %}

### Configure UITextView

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

{% gist https://gist.github.com/cardoso/3b1b61de4fc4351597f6d7fef7199f63 %}

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](https://github.com/GetStream/Streamoji/issues/new). 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](https://www.producthunt.com/posts/streamoji/). Follow it there to get notified of updates!