Skip to content

TwemojiKit is tools for parsing string to Twemoji

License

Notifications You must be signed in to change notification settings

yochidros/TwemojiKit

Repository files navigation

TwemojiKit

license [ TwemojiKit is simple library that provide Twemoji image URL, using twemoji core library.

What is it ?

TwemojiKit is wrapper class for twemoji library. It can parse iOS emoji to twemoji.

Requirements

TwemojiKit requires iOS 11.0 or above, and swift 5.

Installation

  • Add sources files to your project.
  • pod 'TwemojiKit'
  • github "yochidros/TwemojiKit"
    

Usage

Simple Example.

emoji = "✌️"

 let twemoji = Twemoji.shared.parse(emoji)

its return [TwemojiImage]

[
 TwemojiImage(
    - base : "✌️"
    - size : TwemojiKit.TwemojiSize.x72
    - code : "270c"
    - ext : ".png"
 )
]

Normal Text With,

text = "Hello, 🐶"

  let withText = Twemoji.shared.parse(text)

return

[
 TwemojiImage(
  - base : "🐶"
    - size : TwemojiKit.TwemojiSize.x72
    - code : "1f436"
    - ext : ".png"
 )

Mutli Emojis Example,

 let emojis = "🐱 and 🐶"

return

[
  0 : TwemojiImage
    - base : "🐱"
    - size : TwemojiKit.TwemojiSize.x72
    - code : "1f431"
    - ext : ".png"
  1 : TwemojiImage
    - base : "🐶"
    - size : TwemojiKit.TwemojiSize.x72
    - code : "1f436"
    - ext : ".png"
]

Options

  • If want to use as UILabel attributedText.
  let attrStr = Twemoji.shared.parseAttributeString("💪 muscle")
  label.attributedText = attrStr
  • Image Only
guard let firstImage = Twemoji.shared.parse("🐶").first else { return }
imageView.image = Twemoji.shared.convertImage(twemoji: firstImage)

Dependencies

Author

yochidros, [email protected]

License

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