String
extension converting to and from emoji character and Emoji Cheat Sheet string.
import Emoji
":heart_eyes: :heart: :beer:".emojiUnescapedString
"🐶🐱🐷".emojiEscapedString
extension String {
var emojiEscapedString: String
var emojiUnescapedString: String
}
pod 'Emoji-swift'
Create a Package.swift file:
import PackageDescription
let package = Package(
name: "Emoji",
dependencies: [
.Package(url: "https://github.com/safx/Emoji-Swift.git", majorVersion: 0)
]
)
And then, type swift build
.
Just copy Emoji.swift
and String+Emoji.swift
into your project.