项目作者: onmyway133

项目描述 :
:smile: Emoji in Swift
高级语言: Swift
项目地址: git://github.com/onmyway133/Smile.git
创建时间: 2016-06-05T22:07:33Z
项目社区:https://github.com/onmyway133/Smile

开源协议:Other

下载


Smile

❤️ Support my apps ❤️

❤️❤️😇😍🤘❤️❤️

Emoji in Swift. For reference, go to https://github.com/onmyway133/emoji

CI Status
Version
Carthage Compatible
License
Platform
Swift

Features

  • Support emoji sequences
  • Handle skin tones, marks, genders, variation selectors
  • Support new iOS emojis

List

List all emojis

  1. Smile.list()
  2. emojiList
  3. emojiCategories

Emoji

Check if a character is emoji

  1. Smile.isEmoji(character: "🎉") // true

Check if a string contains any emoji

  1. Smile.containsEmoji(string: "🎈 and 🎁") // true

Count number of emoji characters in a string

  1. Smile.countEmoji("🎈 and 🎁") // 2

Count number of non-emoji characters in a string

  1. Smile.countNonEmoji("🎈 and 🎁") // 5

Check if a string contains only a single emoji

  1. Smile.isSingleEmoji("🎈 and 🎁") // false
  2. Smile.isSingleEmoji("👨‍") // true
  3. Smile.isSingleEmoji("👩🏽‍🧑‍") // false
  4. Smile.isSingleEmoji("just plain text") // false

Check if a string contains only emojis

  1. Smile.isEmojiOnly("🎈 and 🎁") // false
  2. Smile.isEmojiOnly("👨‍") // true
  3. Smile.isEmojiOnly("👩🏽‍🧑‍") // true
  4. Smile.isEmojiOnly("just plain text") // false

Get emoji from unicode values

  1. XCTAssertEqual(Smile.emoji(unicodeValues: [0x1F47B]), "👻")
  2. XCTAssertEqual(Smile.emoji(unicodeValues: [0x0001F468, 0x200D, 0x2708]), "👨‍✈")

Unmodify an emoji

  1. Smile.unmodify(emoji: "👨🏿") // 👨

Name

Show standard name of an emoji

  1. Smile.name(emoji: "🇳🇴") // ["REGIONAL INDICATOR SYMBOL LETTER N", "REGIONAL INDICATOR SYMBOL LETTER O"])

Search emoji by keywords

  1. Smile.emojis(keywords: ["GRINNING"]) // 😁, 😸

Flag

Search emoji flag by country code

  1. Smile.emoji(countryCode: "no") // 🇳🇴

Alias

Search emoji by alias

Emoji data is from https://github.com/github/gemoji/blob/master/db/emoji.json

  1. Smile.emoji(alias: "japanese_castle") // 🏯

Find alias by emoji

  1. Smile.alias(emoji: "🏯") // japanese_castle

Replace alias within a string

  1. Smile.replaceAlias(string: ":santa: is coming to :european_castle:") // 🎅 is coming to 🏰

Category

Find category of emoji

Emoji data is from https://github.com/github/gemoji/blob/master/db/Category-Emoji.json

  1. Smile.category(emoji: "😁") // people

Manipulation

Extract all emojis within a string

  1. Smile.extractEmojis(string: "Find 🔑and🔎") // 🔑🔎

Remove all emojis within a string

  1. Smile.removeEmojis(string: "Find 🔑and🔎") // Find and

Assemble

  1. Smile.assemble(emojis: ["👨", "🏫") // 👨‍🏫
  2. Smile.assemble(emojis: ["👨", "👩", "👧", "👦"] // 👨‍👩‍👧‍👦

Disassemble

  1. Smile.disassemble(emoji: "👨‍🏫") // [👨, 🏫]

Script

Update emoji list by running

  1. node parser.js

Installation

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

  1. pod 'Smile'

Smile is also available through Carthage.
To install just write into your Cartfile:

  1. github "onmyway133/Smile"

Author

Khoa Pham, onmyway133@gmail.com

Contributing

We would love you to contribute to Smile, check the CONTRIBUTING file for more info.

License

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