Swiftpack.co - divadretlaw/EmojiText as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by divadretlaw.
divadretlaw/EmojiText v2.0.1
😃 Render Custom Emoji in Text
⭐️ 43
🕓 41 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/divadretlaw/EmojiText.git", from: "v2.0.1")

EmojiText

Render Custom Emoji in Text. Supports local and remote emojis. Remote emojis are loaded and cached using Nuke

Usage

Remote emoji

EmojiText(verbatim: "Hello :my_emoji:",
          emojis: [RemoteEmoji(shortcode: "my_emoji", url: /* URL to emoji */)])

Local emoji

EmojiText(verbatim: "Hello :my_emoji:",
          emojis: [LocalEmoji(shortcode: "my_emoji", image: /* some UIImage or NSImage */)])

SF Symbol

EmojiText(verbatim: "Hello Moon & Starts :moon.stars:",
          emojis: [SFSymbolEmoji(shortcode: "moon.stars")])

Markdown

Also supports Markdown

EmojiText(markdown: "**Hello** *World* :my_emoji:",
          emojis: [RemoteEmoji(shortcode: "my_emoji", url: /* URL to emoji */)])

Animated Emoji

[!WARNING] This feature is in beta and therefore is opt-in only. Performance may vary.

Currently only UIKit platforms support animated emoji.

Enable animation by setting adding the .animated() modifier to EmojiText.

EmojiText(verbatim: "GIF :my_gif:",
          emojis: [RemoteEmoji(shortcode: "my_gif", url: /* URL to gif */)])
    .animated()

Supported formats:

  • APNG
  • GIF
  • WebP

[!INFO] The animation will automatically pause when using low-power mode. To always play animations, even in low-power mode set the animation mode to AnimatedEmojiMode.always

EmojiText(verbatim: "GIF :my_gif:",
          emojis: [RemoteEmoji(shortcode: "my_gif", url:  /* URL to gif */)])
  .animated()
  .environment(\.emojiAnimatedMode, .always)

Configuration

Remote emojis are replaced by a placeholder image when loading. Default is the SF Symbol square.dashed but you can overide the placeholder image with

.placeholderEmoji(systemName: /* SF Symbol */)

or

.placeholderEmoji(image: /* some UIImage or NSImage */)

Remote emojis use ImagePipeline.shared from Nuke to load them, but you can provide a custom pipeline with

.environment(\.emojiImagePipeline, ImagePipeline())

License

See LICENSE

GitHub

link
Stars: 43
Last commit: 9 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

3.0.2
9 weeks ago

What's Changed

Full Changelog: https://github.com/divadretlaw/EmojiText/compare/3.0.1...3.0.2

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics