Custom emoji rendering library for iOS apps with support for GIF & still images

Overview


GitHub Workflow Status Cocoapods Cocoapods platforms SPM & Carthage compatible License Twitter Twitter Follow

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 as 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 code lines away from adding them to your own app with this library.

Streamoji is a custom emoji rendering library for iOS. It supports GIF , images , and unicode 🦊 . It loads from URLs or local assets. Caching is taken care of and performance is ⚡️ fast! Made with 💘 by the folks @ Stream.

Usage

1. 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).

let exampleEmojis: [String: EmojiSource] = [
    "baby_yoda": .imageAsset("baby-yoda-soup.gif"),
    "banana_dance": .imageAsset("bananadance.gif"),
    "excuse_me": .imageAsset("excuseme.gif"),
    "party_parrot": .imageAsset("party_parrot.gif"),
    "this_is_fine": .imageAsset("this-is-fine-fire.gif"),
    "what": .imageAsset("what.png"),
    "homer_disappear": .imageAsset("homer-disappear.gif"),
    "let_me_in": .imageUrl("https://github.com/GetStream/Streamoji/blob/main/meta/emojis/let_me_in.gif?raw=true"),
    "smiley": .character("😄"),
    "heart": .character("❤️"),
    "banana": .alias("banana_dance"),
    "parrot": .alias("party_parrot")
]

2. Configure UITextView

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

textView.attributedText = NSAttributedString(string:
    """
    :banana_dance: Streamoji :party_parrot:
    :baby_yoda: This is a UITextView! :excuse_me:

    Supports:
    GIF :this_is_fine:
    Image :what:
    Local file :homer_disappear:
    Remote file :let_me_in:
    Unicode :smiley:
    """
)

textView.configureEmojis(exampleEmojis, rendering: .highestQuality)

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

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

Streamoji is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Streamoji'

Author

@cardoso, [email protected]

License

Streamoji is available under the MIT license. See the LICENSE file for more info.

You might also like...
iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more apps having maps.

MVAutocompletePlaceSearchTextField iOS - Subclass of UITextField to achieve autocompletion for Place Search like Google Places, Uber and Much more app

An auto growing text input bar for messaging apps.
An auto growing text input bar for messaging apps.

ALTextInputBar An auto growing text input bar for messaging apps. Written in Swift. ALTextInputBar is designed to solve a few issues that folks usuall

DTTextField is a custom textfield with floating placeholder and error label
DTTextField is a custom textfield with floating placeholder and error label

DTTextField Introduction DTTextField is a UITextField library with floating placeholder and error label. Floating placeholder inspired from JVFloatLab

A custom TextField with a switchable icon which shows or hides the password and enforce good password policies
A custom TextField with a switchable icon which shows or hides the password and enforce good password policies

PasswordTextField A custom TextField with a switchable icon which shows or hides the password and enforces good password policies, written in Swift. ⭐

Custom UITextFields effects inspired by Codrops, built using Swift
Custom UITextFields effects inspired by Codrops, built using Swift

TextFieldEffects I fell in love with the text inputs effects in this article. As an exercise I decided to recreate as many of them as I can using Swif

AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.
AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

AEOTPTextField - A beautiful iOS OTP Text Field library, written in Swift with full access customization in UI.

VMaskTextField is a library which create an input mask for iOS.
VMaskTextField is a library which create an input mask for iOS.

VMaskTextField An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers etc U

⚡️ A library of widgets and helpers to build instant-search applications on iOS.
⚡️ A library of widgets and helpers to build instant-search applications on iOS.

By Algolia. InstantSearch family: InstantSearch iOS | InstantSearch Android | React InstantSearch | InstantSearch.js | Angular InstantSearch | Vue Ins

Library that allows you binding `enabled` property of button with textable elements (TextView, TextField)
Library that allows you binding `enabled` property of button with textable elements (TextView, TextField)

What is NxEnabled? It's a fairly common case, when the enabled state of button depends on some textable elements such as TextView, TextField. So this

Comments
  • Blank Images problem fix when using Streamoji in TableViewCell

    Blank Images problem fix when using Streamoji in TableViewCell

    Hi there,

    First of all, thanks for the great library as it is one of the life savers for iOS devs, at least for me 👏 👏

    My task was binding some text with custom emoticons to UITextView which is inside UITableViewCell. Thanks to Stremoji, it was showing the emoticons. However when I tested it like scrolling the UITableView, I have noticed that library is a bit buggy as it shows blank images when the invisible cells reappear. I have checked the issues and seen one open issue similar to the my problem (https://github.com/GetStream/Streamoji/issues/4).

    I have decided the fork the library and find a solution on my own. After digging a lot, I find a solution by giving a delay value for the addEmojisIfNeeded function. The operation was already async but with no delay. Giving a delay value fixed the situation for my side. I have duplicated the functions ..WithDelay postfix and new param delay : Double?

    People who face the same problem can use the funcs that I have created. I could have added delay param intto your funcs but didn't want to break your example.

    I posted a demo with two versions. The left one on the video uses configureEmojis, the right one on the video uses configureEmojisWithDelay of 0.5

    I also provided my example repo as shown below: https://github.com/mehmetdelikaya/EmojiExample

    https://user-images.githubusercontent.com/16878744/183697591-cf658fe1-b34d-4028-aa19-76ebf15b534a.mov

    opened by mehmetdelikaya 6
  • Support Carthage

    Support Carthage

    Carthage isn't supported properly. When build there is a problem with Nuke. dyld: Library not loaded: @rpath/Nuke.framework/Nuke Referenced from: <path_to_the_framework>/Frameworks/Streamoji.framework/Streamoji Reason: Incompatible library version: Streamoji requires version 1.0.0 or later, but Nuke provides version 0.0.0

    opened by Polycarbonate1993 0
Releases(0.1.8)
Owner
Stream
Build scalable newsfeeds, activity streams, chat and messaging in a few hours instead of weeks
Stream
iOS 15 0-day exploit (still works in 15.0.2)

nehelper enumerate installed apps 0-day (iOS 15.0) I've updated this code to avoid using Private API directly. Read more in my blog post. However, tha

null 158 Nov 19, 2022
StyledTextKit is a declarative attributed string library for fast rendering and easy string building.

StyledTextKit is a declarative attributed string library for fast rendering and easy string building. It serves as a simple replacement to NSAttribute

GitHawk 1.2k Dec 23, 2022
Provides a SwiftUI multi-line TextView implementation including support for auto-sizing. (iOS)

TextView Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ Provides a SwiftUI multi-line TextView implementation with supp

SwiftUI+ 51 Jan 3, 2023
Declarative text styles and streamlined Dynamic Type support for iOS

StyledText StyledText is a library that simplifies styling dynamic text in iOS applications. Instead of having to use attributed strings every time yo

Blue Apron 233 Oct 18, 2022
TextField with DropDown support using UIPickerView

IQDropDownTextField TextField with DropDown support using UIPickerView Installing Install using cocoapods. Add in your Podfile: pod 'IQDropDownTextFie

Mohd Iftekhar Qurashi 301 Jun 29, 2022
A light-weight UITextView subclass that adds support for placeholder.

RSKPlaceholderTextView A light-weight UITextView subclass that adds support for placeholder. Installation Using Swift Package Manager To add the RSKPl

Ruslan Skorb 220 Dec 17, 2022
UITextField that support currency in the right way.

PLCurrencyTextField Summary PLCurrencyTextField provides simple and user friendly support for the amount in the currency. Usage To start using the com

Łukasz Śliwiński 96 Nov 14, 2022
A UITextView subclass that adds support for multiline placeholder written in Swift.

KMPlaceholderTextView A UITextView subclass that adds support for multiline placeholder written in Swift. Usage You can set the value of the placehold

Zhouqi Mo 795 Nov 18, 2022
An UITextView in Swift. Support auto growing, placeholder and length limit.

GrowingTextView Requirements iOS 8.0 or above Installation CocoaPods GrowingTextView is available through CocoaPods. To install it, simply add the fol

Kenneth Tsang 941 Jan 5, 2023
Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen in Apple's TV & TestFlight iOS apps.

SwiftUI Matched Inline Title Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen i

Seb Jachec 19 Oct 9, 2022