Created
July 12, 2020 15:14
-
-
Save apatronl/86363f7c581f441fcc958373086f3df2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public struct EmojiProvider { | |
/// Creates a list of emoji details that includes an emoji along with its name and description. | |
/// - Returns: The list of `EmojiDetail`s | |
/// - Note: Emoji descriptions obtained from [Empojipedia](https://emojipedia.org/). | |
static func all() -> [EmojiDetails] { | |
// ... | |
} | |
/// Chooses a random `EmojiDetails` item from the list of all emoji and returns it. | |
/// - Returns: A random `EmojiDetails` item. | |
static func random() -> EmojiDetails { | |
let allEmoji = EmojiProvider.all() | |
let randomIndex = Int.random(in: 0..<allEmoji.count) | |
return allEmoji[randomIndex] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment