Custom emojis are a fun way to bring more life and customizability to your apps.

Related tags

UI emoji swift ios gif
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...
Progress and Activity Indicators for iOS apps
Progress and Activity Indicators for iOS apps

Progress Indicators and Activity Views for iOS Apps Features Storyboard compatible, configure apprearance with the property inspector. fully animated,

Oovium's AetherView and other basic UI elements necessary for embedding Oovium in other apps

Oovium's AetherView and other basic UI elements necessary for embedding Oovium in other apps

Custom segue for OSX Storyboards with slide and cross fade effects (NSViewControllerTransitionOptions)
Custom segue for OSX Storyboards with slide and cross fade effects (NSViewControllerTransitionOptions)

CustomSegue Custom segue for OSX Storyboards. Slide and cross fade effects, new customized window. class MyViewController: NSViewController { overr

A simple, customizable view for efficiently collecting country information in iOS apps.
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Work in progress gallery of controls available to Catalyst apps using Optimized for Mac
Work in progress gallery of controls available to Catalyst apps using Optimized for Mac

Catalyst Controls Gallery Very simple work-in-progress demonstration of many common controls available to Mac Catalyst as of macOS 11. Provided moreso

Create macOS apps with Swift packages instead of Xcode projects

Swift Bundler A Swift Package Manager wrapper that allows the creation of MacOS apps with Swift packages instead of Xcode projects. My motivation is t

It provides UI components such as popover, popup, dialog supporting iOS apps
It provides UI components such as popover, popup, dialog supporting iOS apps

Overview LCUIComponents is an on-going project, which supports creating transient views appearing above other content onscreen when a control is selec

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

Features β€’ Guides β€’ Installation β€’ Usage β€’ Miscellaneous β€’ Contributing 🌎 README is available in other languages: πŸ‡ͺπŸ‡Έ . πŸ‡¨πŸ‡³ . πŸ‡§πŸ‡· . πŸ‡°πŸ‡· . πŸ‡«πŸ‡· To

List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model and doesn't depend on UI framework
List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model and doesn't depend on UI framework

SwiftListTreeDataSource List tree data souce to display hierachical data structures in lists-like way. It's UI agnostic, just like view-model, so can

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
High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton, Promise and more.

SwiftyUI High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton and more. Features SwiftyView GPU rendering Image and Color

Haoking 336 Nov 26, 2022
Convenient domain specific language for writing programmatic UI built over UIKit and more.

XYKit Swifty and convenient domain specific language for creating programmatic UI in a more declarative way and more than that. Built on top of UIKit

Denis Goloborodko 1 Nov 5, 2021
🎸🎸🎸 Common categories for daily development. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV and more.

?????? Common categories for daily development. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV and more.

77。 423 Jan 4, 2023
Fashion is your helper to share and reuse UI styles in a Swifty way.

Fashion is your helper to share and reuse UI styles in a Swifty way. The main goal is not to style your native apps in CSS, but use a set

Vadym Markov 124 Nov 20, 2022
Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle.

Twinkle ✨ Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle. This library creates several CAEmitterLayers and animate

patrick piemonte 600 Nov 24, 2022
DGFadingLabel - A custom UILabel that fades away the end of your text when text is too large to fit within the label's frame

A custom UILabel that fades away the end of your text when text is too large to fit within the label's frame.

donggyu 4 Jun 10, 2022
React.js like Mixin. More powerful Protocol-Oriented Programming.

Mixin ?? Why? Swift is Protocol-Oriented Programming, and it's more powerful by default implementations of extensions of protocols. You can mixin meth

Wan-Huang Yang 45 Dec 28, 2021
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView and iPhone X safe area support for content reloading. Built for iOS 10 and later.

Arale A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built f

Putra Z. 43 Feb 4, 2022
Beautiful flag icons for usage in apps and on the web.

FlagKit Beautiful flag icons for usage in apps and on the web. All flags are provided as stand-alone PNG and SVG files. FlagKit also provides an Asset

Bowtie 2.9k Dec 29, 2022