Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GetStream/Streamoji
:godmode: Custom emoji rendering library for iOS apps with support for GIF & still images - plug-in extension for UITextView - performance, cache ✅ - Made with 💘 by @GetStream
https://github.com/GetStream/Streamoji
emoji gif ios swift
Last synced: about 1 month ago
JSON representation
:godmode: Custom emoji rendering library for iOS apps with support for GIF & still images - plug-in extension for UITextView - performance, cache ✅ - Made with 💘 by @GetStream
- Host: GitHub
- URL: https://github.com/GetStream/Streamoji
- Owner: GetStream
- License: mit
- Archived: true
- Created: 2020-07-14T20:17:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T10:50:58.000Z (about 2 years ago)
- Last Synced: 2024-10-29T11:29:55.157Z (about 1 month ago)
- Topics: emoji, gif, ios, swift
- Language: Swift
- Homepage: https://getstream.io/
- Size: 6.7 MB
- Stars: 253
- Watchers: 9
- Forks: 15
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swift - Streamoji - Custom emoji rendering library for iOS apps with support for GIF & still images - plug-in extension for UITextView - performance, cache - Made with by @GetStream ` 📝 a year ago ` (UI [🔝](#readme))
README
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/getstream/streamoji/Swift)](https://github.com/GetStream/Streamoji/actions?query=workflow%3ASwift)
[![Cocoapods](https://img.shields.io/cocoapods/v/Streamoji)](https://cocoapods.org/pods/Streamoji)
![Cocoapods platforms](https://img.shields.io/cocoapods/p/Streamoji)
![SPM & Carthage compatible](https://img.shields.io/badge/SPM%20%26%20Carthage-compatible-green)
[![License](https://img.shields.io/github/license/getstream/streamoji)](/LICENSE)
[![Twitter](https://img.shields.io/twitter/url?url=https%3A%2F%2Fgithub.com%2FGetStream%2FStreamoji)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2FGetStream%2FStreamoji)
[![Twitter Follow](https://img.shields.io/twitter/follow/getstream_io?style=social)](https://twitter.com/intent/follow?screen_name=getstream_io)### :warning: This project has a new home :house: https://github.com/cardoso/Streamoji
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](https://getstream.io).
## 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).
```swift
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`:
```swift
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](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'Streamoji'
```## Author
[@cardoso](https://github.com/cardoso), [email protected]
## License
Streamoji is available under the MIT license. See the LICENSE file for more info.