mirror of
https://github.com/metabolist/metatext.git
synced 2024-09-29 06:41:55 +00:00
39 lines
900 B
Swift
39 lines
900 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import Foundation
|
|
import Mastodon
|
|
|
|
public enum PickerEmoji: Hashable {
|
|
case custom(Emoji)
|
|
case system(SystemEmoji)
|
|
}
|
|
|
|
public extension PickerEmoji {
|
|
enum Category: Hashable {
|
|
case frequentlyUsed
|
|
case custom
|
|
case customNamed(String)
|
|
case systemGroup(SystemEmoji.Group)
|
|
}
|
|
}
|
|
|
|
extension PickerEmoji.Category: Comparable {
|
|
public static func < (lhs: PickerEmoji.Category, rhs: PickerEmoji.Category) -> Bool {
|
|
lhs.order < rhs.order
|
|
}
|
|
}
|
|
|
|
private extension PickerEmoji.Category {
|
|
var order: String {
|
|
switch self {
|
|
case .frequentlyUsed:
|
|
return "0"
|
|
case .custom:
|
|
return "1"
|
|
case let .customNamed(name):
|
|
return "2.\(name)"
|
|
case let .systemGroup(group):
|
|
return "3.\(group.rawValue)"
|
|
}
|
|
}
|
|
}
|