Tools for detecting emoji in strings and using emoji shortcut codes.
- supports all emojis including new ones released in iOS 9
- detect that a string contains emoji
- detect that a string contains emoji only, optionally allowing for whitespace (defaults to true)
- convert emoji shortcut codes in strings into their emoji equivalents
- get suggested emoji shortcut codes from a search string
##Requirements Since EmojiTools is a dynamic framework, iOS 8 or above is required
##CocoaPods
platform :ios, '8.0'
use_frameworks!
target 'SingleViewApp' do
pod 'EmojiTools'
end
##Manual Installation To install EmojiTools manually:
- Download, clone, or submodule EmojiTools.
- Drag the EmojiTools.xcodeproj file into your project under the Products folder
- In your target's Build Phases settings, add EmojiTools to the Target Dependencies build phase.
- Add the EmojiTools.framework product to the Link Binary With Libraries build phase.
- If there is no Copy Files build phase, add one.
- Add EmojiTools.framework to the Copy Files build phase and set the destination to Frameworks
##Usage Emoji Detection:
import EmojiTools
func someFunction() {
let emojiContainingString = "This 😀😎👩👩👧👧 string 🌲🐯🌛 has 🍉☕️🍻 a 🎆🏀🎼 lot 🚌🗽✈️ of 📞🔦✉️ emoji. 8️⃣🔡🕒"
let containsEmoji = emojiContainingString.containsEmoji() // true
let emojiOnlyWhitespaceString = "😀😎👩👩👧👧 🌲🐯🌛 🍉☕️🍻 🎆🏀🎼 🚌🗽✈️ 📞🔦✉️ 8️⃣🔡🕒"
let containsEmojiOnly = emojiOnlyWhitespaceString.containsEmojiOnly() // true
let containsEmojiOnlyAndNoWhitespace = emojiOnlyWhitespaceString.containsEmojiOnly(false) // false
}
Emoji Shortcut Codes
import EmojiTools
func someFunction() {
let emojiShortcutCodeString = "The :monkey: is trying to buy a :banana: with some :moneybag: at the :convenience_store:."
let processedEmojiString = emojiShortcutCodeString.emojiString() // "The 🐒 is trying to buy a 🍌 with some 💰 at the 🏪."
}
EmojiTools is available under the MIT license. See the full license here.