Skip to content

nerdyc/SwiftEmoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Nov 21, 2016
a79bcbb Β· Nov 21, 2016

History

19 Commits
Oct 4, 2016
Nov 21, 2016
Nov 21, 2016
Nov 21, 2016
Apr 25, 2016
Nov 21, 2016
Sep 26, 2016
Apr 26, 2016
Apr 25, 2016
Apr 26, 2016
May 17, 2016
Apr 25, 2016
Nov 21, 2016

Repository files navigation

Swift Emoji

SwiftEmoji provides a set of regular expressions to find emoji in swift strings. All forms of emoji are matched, including:

  • Single-character emoji (πŸ‘)
  • Emoji that are variants of other characters (e.g. ⌚️ instead of ⌚︎)
  • Fitzpatrick Modifiers (e.g. skintones πŸ‘πŸ»πŸ‘πŸΌπŸ‘πŸ½πŸ‘πŸΎπŸ‘πŸΏ)
  • ZWJ Sequences (e.g. πŸ’‘)
  • Combining sequences and Combining Marks (e.g. 0️⃣)
  • Flag sequences (e.g πŸ‡¨πŸ‡¦)

All emoji are derived directly from the standard unicode data files, using an automated script.

Usage

The Emoji class exposes a number of useful regular expressions as static variables. They each come in compiled (NSRegularExpression) and uncompiled (String) forms.

  • SingleEmojiPattern and SingleEmojiRegex match a single emoji character (grapheme cluster).
  • MultiEmojiPattern and MultiEmojiRegex match one or more consecutive emoji characters.

The String values are useful when composing your own expressions. For example, you could

Look at the source code in Emoji.swift for an example.

Installation

SwiftEmoji can be installed via CocoaPods, Carthage, or Swift Package Manager.

License

SwiftEmoji is released under the MIT License. Details are in the LICENSE.txt file in the project.