Part of speech highlighting when tapped from dictionary list

This commit is contained in:
Avery Pace
2021-11-04 14:10:22 -04:00
parent c7f50a4d3a
commit d5e3d29225
6 changed files with 108 additions and 31 deletions

View File

@@ -0,0 +1,25 @@
//
// TokiDictionaryViewModel.swift
// Toki Trainer
//
// Created by Avery Ada Pace on 11/4/21.
//
import Foundation
class TokiDictionaryViewModel: ObservableObject
{
let jsonLoader: TokiJSONLoader = TokiJSONLoader()
@Published var dictionary: [TokiDictEntry] = []
@Published var partsOfSpeech: [TokiPartOfSpeech] = []
init() {
if let safeDictionary = jsonLoader.loadDictionary() {
dictionary = safeDictionary
}
if let safePartsOfSpeech = jsonLoader.loadPOS() {
partsOfSpeech = safePartsOfSpeech
}
}
}