Part of speech highlighting when tapped from dictionary list
This commit is contained in:
25
Toki Trainer/ViewModels/TokiDictionaryViewModel.swift
Normal file
25
Toki Trainer/ViewModels/TokiDictionaryViewModel.swift
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user