Skip to content

Instantly share code, notes, and snippets.

@eiri
Forked from iandundas/String+emoji.swift
Created June 29, 2016 15:33
Show Gist options
  • Save eiri/bac6b8cf99f034407ba32c5faab466ba to your computer and use it in GitHub Desktop.
Save eiri/bac6b8cf99f034407ba32c5faab466ba to your computer and use it in GitHub Desktop.
Random Emoji
// Returns a random Emoji 🌿
extension String{
func randomEmoji()->String{
let range = 0x1F601...0x1F64F
let ascii = range.startIndex + Int(arc4random_uniform(UInt32(range.count)))
let emoji = String(UnicodeScalar(ascii))
return emoji
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment