Skip to content

Commit f198301

Browse files
refactor: add comments to the new models
1 parent 11d5d64 commit f198301

5 files changed

Lines changed: 26 additions & 5 deletions

File tree

Sources/EmojiPicker/Models/Category.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
/// An object that represents category of emojis.
2223
struct Category: Decodable {
23-
let id: CategoryType
24+
/// Type-safe category type.
25+
let type: CategoryType
26+
/// Identifiers of emojis.
2427
let emojis: [String]
28+
29+
enum CodingKeys: String, CodingKey {
30+
case type = "id"
31+
case emojis
32+
}
2533
}
2634

27-
/// Describes types of emoji categories.
35+
/// Type-safe representation of emoji categories.
2836
enum CategoryType: String, Decodable, CaseIterable {
2937
case people
3038
case nature

Sources/EmojiPicker/Models/Emoji.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
/// An object that represents emoji.
2223
struct Emoji: Decodable {
23-
let id, name: String
24+
/// Emoji identifier.
25+
let id: String
26+
/// Name of an emoji.
27+
let name: String
28+
/// Keywords for an emoji.
2429
let keywords: [String]
30+
/// Skin tones.
2531
let skins: [Skin]
32+
/// Version in which the emoji appeared.
2633
let version: Double
27-
let emoticons: [String]?
2834
}

Sources/EmojiPicker/Models/EmojiSet.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
/// An object that represents set of emojis.
2223
struct EmojiSet: Decodable {
24+
/// Emoji categories.
2325
let categories: [Category]
26+
/// Emojis dictionary. Key is the name (id) of emoji.
2427
let emojis: [String: Emoji]
28+
/// Aliases of keywords for emojis.
2529
let aliases: [String: String]
2630
}

Sources/EmojiPicker/Models/Skin.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
// SOFTWARE.
2121

22+
/// An object that represents skin tones for emojis.
2223
struct Skin: Decodable {
24+
/// Unicode.
2325
let unified: String
26+
/// Emoji as symbol. For example: 😄
2427
let native: String
2528
}

Sources/EmojiPicker/ViewModel/EmojiPickerViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class EmojiPickerViewModel: EmojiPickerViewModelProtocol {
7575

7676
func sectionHeaderViewModel(for section: Int) -> String {
7777
return NSLocalizedString(
78-
emojiSet.categories[section].id.rawValue,
78+
emojiSet.categories[section].type.rawValue,
7979
bundle: .module,
8080
comment: ""
8181
)

0 commit comments

Comments
 (0)