From 42ebdbf74a94768462459ddb09b9b309d3627176 Mon Sep 17 00:00:00 2001 From: Avery Pace Date: Thu, 11 Nov 2021 10:04:48 -0500 Subject: [PATCH] Cards shuffle correctly, remove statistics tabview --- Toki Trainer.xcodeproj/project.pbxproj | 8 +- Toki Trainer/JSON Data/toki-lessons.json | 1714 +++++++++++++++++ Toki Trainer/Views/ContentView.swift | 12 +- Toki Trainer/Views/FlashCardLessonsView.swift | 2 +- Toki Trainer/Views/FlashCardView.swift | 16 +- 5 files changed, 1737 insertions(+), 15 deletions(-) create mode 100644 Toki Trainer/JSON Data/toki-lessons.json diff --git a/Toki Trainer.xcodeproj/project.pbxproj b/Toki Trainer.xcodeproj/project.pbxproj index 508d38f..7bfa175 100644 --- a/Toki Trainer.xcodeproj/project.pbxproj +++ b/Toki Trainer.xcodeproj/project.pbxproj @@ -16,7 +16,6 @@ 7E28111D273302860063DC78 /* toki-dictionary.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111B273302860063DC78 /* toki-dictionary.json */; }; 7E28112227330DD30063DC78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E28112127330DD20063DC78 /* Constants.swift */; }; 7E716B3E273986E5009E2CF6 /* TokiLesson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E716B3D273986E5009E2CF6 /* TokiLesson.swift */; }; - 7E716B4027398ABD009E2CF6 /* toki-lessons.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E716B3F27398ABD009E2CF6 /* toki-lessons.json */; }; 7E716B4227398CDF009E2CF6 /* FlashCardLessonsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E716B4127398CDF009E2CF6 /* FlashCardLessonsView.swift */; }; 7E716B4427398D3D009E2CF6 /* FlashCardLessonsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E716B4327398D3D009E2CF6 /* FlashCardLessonsViewModel.swift */; }; 7E716B462739B968009E2CF6 /* FlashCardLessonResultsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E716B452739B968009E2CF6 /* FlashCardLessonResultsView.swift */; }; @@ -28,6 +27,7 @@ 7E943A28273211C300E7DDF4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7E943A27273211C300E7DDF4 /* Preview Assets.xcassets */; }; 7E943A2A273211C300E7DDF4 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A29273211C300E7DDF4 /* Persistence.swift */; }; 7E943A2D273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A2B273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld */; }; + 7EBAE6AA273D65FD00BCFA09 /* toki-lessons.json in Resources */ = {isa = PBXBuildFile; fileRef = 7EBAE6A9273D65FD00BCFA09 /* toki-lessons.json */; }; 7EF546162737B8FB00537AE6 /* FlashCardResultsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EF546152737B8FA00537AE6 /* FlashCardResultsView.swift */; }; /* End PBXBuildFile section */ @@ -41,7 +41,6 @@ 7E28111B273302860063DC78 /* toki-dictionary.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-dictionary.json"; sourceTree = ""; }; 7E28112127330DD20063DC78 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 7E716B3D273986E5009E2CF6 /* TokiLesson.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokiLesson.swift; sourceTree = ""; }; - 7E716B3F27398ABD009E2CF6 /* toki-lessons.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "toki-lessons.json"; path = "../../../../../Desktop/toki-pona-dict-json/output/toki-lessons.json"; sourceTree = ""; }; 7E716B4127398CDF009E2CF6 /* FlashCardLessonsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlashCardLessonsView.swift; sourceTree = ""; }; 7E716B4327398D3D009E2CF6 /* FlashCardLessonsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlashCardLessonsViewModel.swift; sourceTree = ""; }; 7E716B452739B968009E2CF6 /* FlashCardLessonResultsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlashCardLessonResultsView.swift; sourceTree = ""; }; @@ -54,6 +53,7 @@ 7E943A27273211C300E7DDF4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 7E943A29273211C300E7DDF4 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = ""; }; 7E943A2C273211C300E7DDF4 /* Toki_Trainer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Toki_Trainer.xcdatamodel; sourceTree = ""; }; + 7EBAE6A9273D65FD00BCFA09 /* toki-lessons.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-lessons.json"; sourceTree = ""; }; 7EF546152737B8FA00537AE6 /* FlashCardResultsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlashCardResultsView.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -107,7 +107,7 @@ isa = PBXGroup; children = ( 7E28111B273302860063DC78 /* toki-dictionary.json */, - 7E716B3F27398ABD009E2CF6 /* toki-lessons.json */, + 7EBAE6A9273D65FD00BCFA09 /* toki-lessons.json */, 7E28111A273302860063DC78 /* toki-partsofspeech.json */, ); path = "JSON Data"; @@ -211,8 +211,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7EBAE6AA273D65FD00BCFA09 /* toki-lessons.json in Resources */, 7E943A28273211C300E7DDF4 /* Preview Assets.xcassets in Resources */, - 7E716B4027398ABD009E2CF6 /* toki-lessons.json in Resources */, 7E943A25273211C300E7DDF4 /* Assets.xcassets in Resources */, 7E28111D273302860063DC78 /* toki-dictionary.json in Resources */, 7E28111C273302860063DC78 /* toki-partsofspeech.json in Resources */, diff --git a/Toki Trainer/JSON Data/toki-lessons.json b/Toki Trainer/JSON Data/toki-lessons.json new file mode 100644 index 0000000..da82d03 --- /dev/null +++ b/Toki Trainer/JSON Data/toki-lessons.json @@ -0,0 +1,1714 @@ +[ + { + "lesson": "Nouns", + "words": [ + { + "word": "ijo", + "definitions": [ + { + "pos": "n", + "definition": "thing, something, stuff, anything, object" + }, + { + "pos": "mod", + "definition": "of something" + }, + { + "pos": "vt", + "definition": "objectify" + } + ] + }, + { + "word": "jan", + "definitions": [ + { + "pos": "n", + "definition": "person, people, human, being, somebody, anybody" + }, + { + "pos": "mod", + "definition": "human, somebody's, personal, of people" + }, + { + "pos": "vt", + "definition": "personify, humanize, personalize" + } + ] + }, + { + "word": "kili", + "definitions": [ + { + "pos": "n", + "definition": "fruit, pulpy vegetable, mushroom" + } + ] + }, + { + "word": "lipu", + "definitions": [ + { + "pos": "n", + "definition": "flat and bendable thing, e.g. paper, card, ticket" + } + ] + }, + { + "word": "meli", + "definitions": [ + { + "pos": "n", + "definition": "woman, female, girl, wife, girlfriend" + }, + { + "pos": "mod", + "definition": "female, feminine, womanly" + }, + { + "pos": "extra", + "definition": "[Mary]" + } + ] + }, + { + "word": "ni", + "definitions": [ + { + "pos": "mod", + "definition": "this, that" + } + ] + }, + { + "word": "soweli", + "definitions": [ + { + "pos": "n", + "definition": "animal, especially land mammal, lovable animal" + } + ] + }, + { + "word": "li", + "definitions": [ + { + "pos": "sep", + "definition": "\\\"(between any subject except mi and sina and its verb\": null, \" also used to introduce a new verb for the same subject)\\\"" + } + ] + } + ] + }, + { + "lesson": "Nouns and Adjectives", + "words": [ + { + "word": "telo", + "definitions": [ + { + "pos": "n", + "definition": "water, liquid, juice, sauce" + }, + { + "pos": "vt", + "definition": "water, wash with water" + } + ] + }, + { + "word": "tomo", + "definitions": [ + { + "pos": "n", + "definition": "indoor constructed space, e.g. house, home, room, building" + }, + { + "pos": "mod", + "definition": "urban, domestic, household" + } + ] + }, + { + "word": "lili", + "definitions": [ + { + "pos": "mod", + "definition": "small, little, young, a bit, short, few, less" + }, + { + "pos": "vt", + "definition": "reduce, shorten, shrink, lessen" + } + ] + }, + { + "word": "pona", + "definitions": [ + { + "pos": "n", + "definition": "good, simplicity, positivity" + }, + { + "pos": "mod", + "definition": "good, simple, positive, nice, correct, right" + }, + { + "pos": "interj", + "definition": "great! good! thanks! OK! cool! yay!" + }, + { + "pos": "vt", + "definition": "improve, fix, repair, make good" + }, + { + "pos": "extra", + "definition": "[bonam]" + } + ] + }, + { + "word": "suli", + "definitions": [ + { + "pos": "mod", + "definition": "big, tall, long, adult, important" + }, + { + "pos": "vt", + "definition": "enlarge, lengthen" + }, + { + "pos": "n", + "definition": "size" + } + ] + } + ] + }, + { + "lesson": "You and I", + "words": [ + { + "word": "mi", + "definitions": [ + { + "pos": "n", + "definition": "I, we" + }, + { + "pos": "mod", + "definition": "my, our" + }, + { + "pos": "extra", + "definition": "[me]" + } + ] + }, + { + "word": "mije", + "definitions": [ + { + "pos": "n", + "definition": "man, male, boy, husband, boyfriend" + }, + { + "pos": "mod", + "definition": "male, masculine, manly" + } + ] + }, + { + "word": "sina", + "definitions": [ + { + "pos": "n", + "definition": "you" + }, + { + "pos": "mod", + "definition": "your" + } + ] + }, + { + "word": "kulupu", + "definitions": [ + { + "pos": "n", + "definition": "group, community, society, company, people" + }, + { + "pos": "mod", + "definition": "communal, shared, public, of the society" + } + ] + }, + { + "word": "sin", + "definitions": [ + { + "pos": "mod", + "definition": "new, fresh, another, more" + }, + { + "pos": "vt", + "definition": "renew, renovate, freshen" + } + ] + }, + { + "word": "wawa", + "definitions": [ + { + "pos": "n", + "definition": "energy, strength, power" + }, + { + "pos": "mod", + "definition": "energetic, strong, fierce, intense, sure, confident" + }, + { + "pos": "vt", + "definition": "strengthen, energize, empower" + } + ] + } + ] + }, + { + "lesson": "Verbs", + "words": [ + { + "word": "jo", + "definitions": [ + { + "pos": "vt", + "definition": "have, contain" + }, + { + "pos": "n", + "definition": "having" + }, + { + "pos": "kama", + "definition": "receive, get, take, obtain" + } + ] + }, + { + "word": "kute", + "definitions": [ + { + "pos": "vt", + "definition": "listen, hear" + }, + { + "pos": "mod", + "definition": "auditory, hearing" + } + ] + }, + { + "word": "moku", + "definitions": [ + { + "pos": "n", + "definition": "food, meal" + }, + { + "pos": "vt", + "definition": "eat, drink, swallow, ingest, consume" + } + ] + }, + { + "word": "pali", + "definitions": [ + { + "pos": "n", + "definition": "activity, work, deed, project" + }, + { + "pos": "mod", + "definition": "active, work-related, operating, working" + }, + { + "pos": "vt", + "definition": "do, make, build, create" + }, + { + "pos": "vi", + "definition": "act, work, function" + } + ] + }, + { + "word": "sona", + "definitions": [ + { + "pos": "n", + "definition": "knowledge, wisdom, intelligence, understanding" + }, + { + "pos": "vt", + "definition": "know, understand, know how to" + }, + { + "pos": "vi", + "definition": "know, understand" + }, + { + "pos": "kama", + "definition": "learn, study" + } + ] + }, + { + "word": "toki", + "definitions": [ + { + "pos": "n", + "definition": "language, talking, speech, communication" + }, + { + "pos": "mod", + "definition": "talking, verbal" + }, + { + "pos": "vt", + "definition": "say" + }, + { + "pos": "vi", + "definition": "talk, chat, communicate" + }, + { + "pos": "interj", + "definition": "hello! hi!" + } + ] + }, + { + "word": "e", + "definitions": [ + { + "pos": "sep", + "definition": "(introduces a direct object)" + } + ] + } + ] + }, + { + "lesson": "More Adjectives", + "words": [ + { + "word": "ala", + "definitions": [ + { + "pos": "mod", + "definition": "no, not, none, un-" + }, + { + "pos": "n", + "definition": "nothing, negation, zero" + }, + { + "pos": "interj", + "definition": "no!" + } + ] + }, + { + "word": "ike", + "definitions": [ + { + "pos": "mod", + "definition": "bad, negative, wrong, evil, overly complex, (figuratively) unhealthy" + }, + { + "pos": "interj", + "definition": "oh dear! woe! alas!" + }, + { + "pos": "n", + "definition": "negativity, badness, evil" + }, + { + "pos": "vt", + "definition": "to make bad, to worsen, to have a negative effect upon" + }, + { + "pos": "vi", + "definition": "to be bad, to suck" + }, + { + "pos": "extra", + "definition": "[sounds like icky]" + } + ] + }, + { + "word": "mute", + "definitions": [ + { + "pos": "mod", + "definition": "many, very, much, several, a lot, abundant, numerous, more" + }, + { + "pos": "n", + "definition": "amount, quantity" + }, + { + "pos": "vt", + "definition": "make many or much" + }, + { + "pos": "extra", + "definition": "[multi]" + } + ] + }, + { + "word": "pu", + "definitions": [ + { + "pos": "extra", + "definition": "(yet undefined entry in the official word list)" + } + ] + }, + { + "word": "sewi", + "definitions": [ + { + "pos": "n", + "definition": "high, up, above, top, over, on" + }, + { + "pos": "mod", + "definition": "superior, elevated, religious, formal" + } + ] + }, + { + "word": "wan", + "definitions": [ + { + "pos": "mod", + "definition": "one, a" + }, + { + "pos": "n", + "definition": "unit, element, particle, part, piece" + }, + { + "pos": "vt", + "definition": "unite, make one" + }, + { + "pos": "extra", + "definition": "[one]" + } + ] + }, + { + "word": "mama", + "definitions": [ + { + "pos": "n", + "definition": "parent, mother, father" + }, + { + "pos": "mod", + "definition": "of the parent, parental, maternal, fatherly" + }, + { + "pos": "extra", + "definition": "[sounds like momma]" + } + ] + } + ] + }, + { + "lesson": "Questions and Answers", + "words": [ + { + "word": "ilo", + "definitions": [ + { + "pos": "n", + "definition": "tool, device, machine, thing used for a specific purpose" + } + ] + }, + { + "word": "kala", + "definitions": [ + { + "pos": "n", + "definition": "fish, sea creature" + } + ] + }, + { + "word": "ona", + "definitions": [ + { + "pos": "n", + "definition": "she, he, it, they" + }, + { + "pos": "mod", + "definition": "her, his, its, their" + } + ] + }, + { + "word": "anu", + "definitions": [ + { + "pos": "conj", + "definition": "or" + } + ] + }, + { + "word": "seme", + "definitions": [ + { + "pos": "oth", + "definition": "what, which, wh- (question word)" + } + ] + } + ] + }, + { + "lesson": "Prepositions", + "words": [ + { + "word": "pana", + "definitions": [ + { + "pos": "vt", + "definition": "give, put, send, place, release, emit, cause" + }, + { + "pos": "n", + "definition": "giving, transfer, exchange" + } + ] + }, + { + "word": "tawa", + "definitions": [ + { + "pos": "prep", + "definition": "to, in order to, towards, for, until" + }, + { + "pos": "vi", + "definition": "go to, walk, travel, move, leave" + }, + { + "pos": "n", + "definition": "movement, transportation" + }, + { + "pos": "mod", + "definition": "moving, mobile" + }, + { + "pos": "vt", + "definition": "move, displace" + }, + { + "pos": "extra", + "definition": "[towards]" + } + ] + }, + { + "word": "lon", + "definitions": [ + { + "pos": "prep", + "definition": "be (located) in/at/on" + }, + { + "pos": "vi", + "definition": "be there, be present, be real/true, exist, be awake" + } + ] + }, + { + "word": "kepeken", + "definitions": [ + { + "pos": "vt", + "definition": "use" + }, + { + "pos": "prep", + "definition": "with" + } + ] + }, + { + "word": "tan", + "definitions": [ + { + "pos": "prep", + "definition": "from, by, because of, since" + }, + { + "pos": "n", + "definition": "origin, cause" + } + ] + } + ] + }, + { + "lesson": "Proper Names", + "words": [ + { + "word": "ma", + "definitions": [ + { + "pos": "n", + "definition": "land, earth, country, (outdoor) area" + } + ] + }, + { + "word": "nasin", + "definitions": [ + { + "pos": "n", + "definition": "way, manner, custom, road, path, doctrine, system, method" + } + ] + }, + { + "word": "nena", + "definitions": [ + { + "pos": "n", + "definition": "bump, nose, hill, mountain, button" + } + ] + }, + { + "word": "nimi", + "definitions": [ + { + "pos": "n", + "definition": "word, name" + } + ] + }, + { + "word": "utala", + "definitions": [ + { + "pos": "n", + "definition": "conflict, disharmony, competition, fight, war, battle, attack, blow, argument, physical or verbal violence" + }, + { + "pos": "vt", + "definition": "hit, strike, attack, compete against" + } + ] + } + ] + }, + { + "lesson": "Greetings and Feelings", + "words": [ + { + "word": "a", + "definitions": [ + { + "pos": "interj", + "definition": "ah, ha, uh, oh, ooh, aw, well (emotion word)" + } + ] + }, + { + "word": "mu", + "definitions": [ + { + "pos": "interj", + "definition": "woof! meow! moo! etc. (cute animal noise)" + }, + { + "pos": "extra", + "definition": "[moo]" + } + ] + }, + { + "word": "o", + "definitions": [ + { + "pos": "sep", + "definition": "O (vocative or imperative)" + }, + { + "pos": "interj", + "definition": "hey! (calling somebody's attention)" + } + ] + }, + { + "word": "pilin", + "definitions": [ + { + "pos": "n", + "definition": "feelings, emotion, heart" + }, + { + "pos": "vi", + "definition": "feel" + }, + { + "pos": "vt", + "definition": "feel, think, sense, touch" + }, + { + "pos": "extra", + "definition": "[feeling]" + } + ] + } + ] + }, + { + "lesson": "pi", + "words": [ + { + "word": "kasi", + "definitions": [ + { + "pos": "n", + "definition": "plant, leaf, herb, tree, wood" + } + ] + }, + { + "word": "sijelo", + "definitions": [ + { + "pos": "n", + "definition": "body, physical state" + } + ] + }, + { + "word": "suno", + "definitions": [ + { + "pos": "n", + "definition": "sun, light" + } + ] + }, + { + "word": "tenpo", + "definitions": [ + { + "pos": "n", + "definition": "time, period of time, moment, duration, situation" + } + ] + }, + { + "word": "awen", + "definitions": [ + { + "pos": "vi", + "definition": "stay, wait, remain" + }, + { + "pos": "vt", + "definition": "keep" + }, + { + "pos": "mod", + "definition": "remaining, stationary, permanent, sedentary" + } + ] + }, + { + "word": "tawa", + "definitions": [ + { + "pos": "prep", + "definition": "to, in order to, towards, for, until" + }, + { + "pos": "vi", + "definition": "go to, walk, travel, move, leave" + }, + { + "pos": "n", + "definition": "movement, transportation" + }, + { + "pos": "mod", + "definition": "moving, mobile" + }, + { + "pos": "vt", + "definition": "move, displace" + }, + { + "pos": "extra", + "definition": "[towards]" + } + ] + }, + { + "word": "pi", + "definitions": [ + { + "pos": "sep", + "definition": "of, belonging to" + } + ] + } + ] + }, + { + "lesson": "Numbers", + "words": [ + { + "word": "ala", + "definitions": [ + { + "pos": "mod", + "definition": "no, not, none, un-" + }, + { + "pos": "n", + "definition": "nothing, negation, zero" + }, + { + "pos": "interj", + "definition": "no!" + } + ] + }, + { + "word": "wan", + "definitions": [ + { + "pos": "mod", + "definition": "one, a" + }, + { + "pos": "n", + "definition": "unit, element, particle, part, piece" + }, + { + "pos": "vt", + "definition": "unite, make one" + }, + { + "pos": "extra", + "definition": "[one]" + } + ] + }, + { + "word": "tu", + "definitions": [ + { + "pos": "mod", + "definition": "two" + }, + { + "pos": "n", + "definition": "duo, pair" + }, + { + "pos": "vt", + "definition": "double, separate/cut/divide in two" + }, + { + "pos": "extra", + "definition": "[two]" + } + ] + }, + { + "word": "mute", + "definitions": [ + { + "pos": "mod", + "definition": "many, very, much, several, a lot, abundant, numerous, more" + }, + { + "pos": "n", + "definition": "amount, quantity" + }, + { + "pos": "vt", + "definition": "make many or much" + }, + { + "pos": "extra", + "definition": "[multi]" + } + ] + }, + { + "word": "ale", + "definitions": [ + { + "pos": "n", + "definition": "everything, anything, life, the universe" + }, + { + "pos": "mod", + "definition": "all, every, complete, whole" + } + ] + } + ] + }, + { + "lesson": "Pre-Verbs", + "words": [ + { + "word": "kama", + "definitions": [ + { + "pos": "vi", + "definition": "come, become, arrive, happen, pursue actions to arrive to (a certain state), manage to, start to" + }, + { + "pos": "n", + "definition": "event, happening, chance, arrival, beginning" + }, + { + "pos": "mod", + "definition": "coming, future" + }, + { + "pos": "vt", + "definition": "bring about, summon" + }, + { + "pos": "extra", + "definition": "[come up]" + } + ] + }, + { + "word": "ken", + "definitions": [ + { + "pos": "vi", + "definition": "can, is able to, is allowed to, may, is possible" + }, + { + "pos": "n", + "definition": "possibility, ability, power to do things, permission" + }, + { + "pos": "vt", + "definition": "make possible, enable, allow, permit" + }, + { + "pos": "cont", + "definition": "it is possible that" + } + ] + }, + { + "word": "wile", + "definitions": [ + { + "pos": "vt", + "definition": "to want, need, wish, have to, must, will, should" + }, + { + "pos": "n", + "definition": "desire, need, will" + }, + { + "pos": "mod", + "definition": "necessary" + } + ] + }, + { + "word": "lukin", + "definitions": [ + { + "pos": "vt", + "definition": "see, look at, watch, read" + }, + { + "pos": "vi", + "definition": "look, watch out, pay attention" + }, + { + "pos": "mod", + "definition": "visual(ly)" + }, + { + "pos": "extra", + "definition": "[looking]" + } + ] + }, + { + "word": "sona", + "definitions": [ + { + "pos": "n", + "definition": "knowledge, wisdom, intelligence, understanding" + }, + { + "pos": "vt", + "definition": "know, understand, know how to" + }, + { + "pos": "vi", + "definition": "know, understand" + }, + { + "pos": "kama", + "definition": "learn, study" + } + ] + }, + { + "word": "kama", + "definitions": [ + { + "pos": "vi", + "definition": "come, become, arrive, happen, pursue actions to arrive to (a certain state), manage to, start to" + }, + { + "pos": "n", + "definition": "event, happening, chance, arrival, beginning" + }, + { + "pos": "mod", + "definition": "coming, future" + }, + { + "pos": "vt", + "definition": "bring about, summon" + }, + { + "pos": "extra", + "definition": "[come up]" + } + ] + }, + { + "word": "lukin", + "definitions": [ + { + "pos": "vt", + "definition": "see, look at, watch, read" + }, + { + "pos": "vi", + "definition": "look, watch out, pay attention" + }, + { + "pos": "mod", + "definition": "visual(ly)" + }, + { + "pos": "extra", + "definition": "[looking]" + } + ] + } + ] + }, + { + "lesson": "Colors and la", + "words": [ + { + "word": "jelo", + "definitions": [ + { + "pos": "mod", + "definition": "yellow, light green" + }, + { + "pos": "extra", + "definition": "[yellow]" + } + ] + }, + { + "word": "laso", + "definitions": [ + { + "pos": "mod", + "definition": "blue, blue-green" + } + ] + }, + { + "word": "loje", + "definitions": [ + { + "pos": "mod", + "definition": "red" + } + ] + }, + { + "word": "pimeja", + "definitions": [ + { + "pos": "mod", + "definition": "black, dark" + }, + { + "pos": "n", + "definition": "darkness, shadows" + }, + { + "pos": "vt", + "definition": "darken" + } + ] + }, + { + "word": "walo", + "definitions": [ + { + "pos": "mod", + "definition": "white, light (colour)" + }, + { + "pos": "n", + "definition": "white thing or part, whiteness, lightness" + }, + { + "pos": "extra", + "definition": "[sounds like wall, which is often white]" + } + ] + }, + { + "word": "la", + "definitions": [ + { + "pos": "sep", + "definition": "(between adverb or phrase of context and sentence)" + } + ] + } + ] + }, + { + "lesson": "Spatial Nouns", + "words": [ + { + "word": "insa", + "definitions": [ + { + "pos": "n", + "definition": "inside, inner world, centre, stomach" + }, + { + "pos": "mod", + "definition": "inner, internal" + }, + { + "pos": "extra", + "definition": "[inside]" + } + ] + }, + { + "word": "monsi", + "definitions": [ + { + "pos": "n", + "definition": "back, rear end, butt, behind" + }, + { + "pos": "mod", + "definition": "back, rear" + } + ] + }, + { + "word": "noka", + "definitions": [ + { + "pos": "n", + "definition": "leg, foot" + } + ] + }, + { + "word": "poka", + "definitions": [ + { + "pos": "n", + "definition": "side, hip, next to" + }, + { + "pos": "prep", + "definition": "in the accompaniment of, with" + }, + { + "pos": "mod", + "definition": "neighbouring" + } + ] + }, + { + "word": "sewi", + "definitions": [ + { + "pos": "n", + "definition": "high, up, above, top, over, on" + }, + { + "pos": "mod", + "definition": "superior, elevated, religious, formal" + } + ] + }, + { + "word": "sinpin", + "definitions": [ + { + "pos": "n", + "definition": "front, chest, torso, face, wall" + } + ] + } + ] + }, + { + "lesson": "Particles and Perspective", + "words": [ + { + "word": "anpa", + "definitions": [ + { + "pos": "n", + "definition": "bottom, lower part, under, below, floor, beneath" + }, + { + "pos": "mod", + "definition": "low, lower, bottom, down" + } + ] + }, + { + "word": "ante", + "definitions": [ + { + "pos": "n", + "definition": "difference" + }, + { + "pos": "mod", + "definition": "different" + }, + { + "pos": "conj", + "definition": "otherwise, or else" + }, + { + "pos": "vt", + "definition": "change, alter, modify" + } + ] + }, + { + "word": "en", + "definitions": [ + { + "pos": "conj", + "definition": "and (used to coordinate head nouns)" + } + ] + }, + { + "word": "lete", + "definitions": [ + { + "pos": "n", + "definition": "cold" + }, + { + "pos": "mod", + "definition": "cold, uncooked" + }, + { + "pos": "vt", + "definition": "cool down, chill" + } + ] + }, + { + "word": "lupa", + "definitions": [ + { + "pos": "n", + "definition": "hole, orifice, window, door" + }, + { + "pos": "extra", + "definition": "[sounds like loop]" + } + ] + }, + { + "word": "open", + "definitions": [ + { + "pos": "vt", + "definition": "open, turn on" + } + ] + }, + { + "word": "sama", + "definitions": [ + { + "pos": "mod", + "definition": "same, similar, equal, of equal status or position" + }, + { + "pos": "prep", + "definition": "preplike, as, seem" + } + ] + }, + { + "word": "suwi", + "definitions": [ + { + "pos": "n", + "definition": "candy, sweet food" + }, + { + "pos": "mod", + "definition": "sweet, cute" + }, + { + "pos": "vt", + "definition": "sweeten" + }, + { + "pos": "extra", + "definition": "[sweet]" + } + ] + }, + { + "word": "taso", + "definitions": [ + { + "pos": "mod", + "definition": "only, sole" + }, + { + "pos": "conj", + "definition": "but" + }, + { + "pos": "extra", + "definition": "[that's all]" + } + ] + }, + { + "word": "tawa", + "definitions": [ + { + "pos": "prep", + "definition": "to, in order to, towards, for, until" + }, + { + "pos": "vi", + "definition": "go to, walk, travel, move, leave" + }, + { + "pos": "n", + "definition": "movement, transportation" + }, + { + "pos": "mod", + "definition": "moving, mobile" + }, + { + "pos": "vt", + "definition": "move, displace" + }, + { + "pos": "extra", + "definition": "[towards]" + } + ] + } + ] + }, + { + "lesson": "Hunting Adventure", + "words": [ + { + "word": "alasa", + "definitions": [ + { + "pos": "vt", + "definition": "gather, hunt" + } + ] + }, + { + "word": "lawa", + "definitions": [ + { + "pos": "n", + "definition": "head, mind" + }, + { + "pos": "mod", + "definition": "main, leading, in charge" + }, + { + "pos": "vt", + "definition": "lead, control, rule, steer" + } + ] + }, + { + "word": "len", + "definitions": [ + { + "pos": "n", + "definition": "clothing, cloth, fabric" + } + ] + }, + { + "word": "linja", + "definitions": [ + { + "pos": "n", + "definition": "long, very thin, floppy thing, e.g. string, rope, hair, thread, cord, chain" + } + ] + }, + { + "word": "pakala", + "definitions": [ + { + "pos": "n", + "definition": "blunder, accident, mistake, destruction, damage, breaking" + }, + { + "pos": "vt", + "definition": "screw up, fuck up, botch, ruin, break, hurt, injure, damage, spoil, ruin" + }, + { + "pos": "vi", + "definition": "screw up, fall apart, break" + }, + { + "pos": "interj", + "definition": "damn! fuck!" + } + ] + }, + { + "word": "palisa", + "definitions": [ + { + "pos": "n", + "definition": "long, mostly hard object, e.g. rod, stick, branch" + } + ] + }, + { + "word": "pipi", + "definitions": [ + { + "pos": "n", + "definition": "bug, insect, spider" + } + ] + }, + { + "word": "waso", + "definitions": [ + { + "pos": "n", + "definition": "bird, winged animal" + } + ] + }, + { + "word": "weka", + "definitions": [ + { + "pos": "mod", + "definition": "away, absent, missing" + }, + { + "pos": "n", + "definition": "absence" + }, + { + "pos": "vt", + "definition": "throw away, remove, get rid of" + } + ] + } + ] + }, + { + "lesson": "Cooking Adventure", + "words": [ + { + "word": "lape", + "definitions": [ + { + "pos": "n", + "definition": "n, vi sleep, rest" + }, + { + "pos": "mod", + "definition": "sleeping, of sleep" + } + ] + }, + { + "word": "olin", + "definitions": [ + { + "pos": "n", + "definition": "love" + }, + { + "pos": "mod", + "definition": "love" + }, + { + "pos": "vt", + "definition": "to love (a person)" + } + ] + }, + { + "word": "pan", + "definitions": [ + { + "pos": "n", + "definition": "grain, cereal" + } + ] + }, + { + "word": "pini", + "definitions": [ + { + "pos": "n", + "definition": "end, tip" + }, + { + "pos": "mod", + "definition": "completed, finished, past, done, ago" + }, + { + "pos": "vt", + "definition": "finish, close, end, turn off" + } + ] + }, + { + "word": "seli", + "definitions": [ + { + "pos": "n", + "definition": "fire, warmth, heat" + }, + { + "pos": "mod", + "definition": "hot, warm, cooked" + }, + { + "pos": "vt", + "definition": "heat, warm up, cook" + } + ] + }, + { + "word": "supa", + "definitions": [ + { + "pos": "n", + "definition": "horizontal surface, e.g furniture, table, chair, pillow, floor" + } + ] + }, + { + "word": "uta", + "definitions": [ + { + "pos": "n", + "definition": "mouth" + }, + { + "pos": "mod", + "definition": "oral" + } + ] + }, + { + "word": "telo", + "definitions": [ + { + "pos": "n", + "definition": "water, liquid, juice, sauce" + }, + { + "pos": "vt", + "definition": "water, wash with water" + } + ] + }, + { + "word": "seli", + "definitions": [ + { + "pos": "n", + "definition": "fire, warmth, heat" + }, + { + "pos": "mod", + "definition": "hot, warm, cooked" + }, + { + "pos": "vt", + "definition": "heat, warm up, cook" + } + ] + } + ] + } +] \ No newline at end of file diff --git a/Toki Trainer/Views/ContentView.swift b/Toki Trainer/Views/ContentView.swift index 252889e..35107fb 100644 --- a/Toki Trainer/Views/ContentView.swift +++ b/Toki Trainer/Views/ContentView.swift @@ -21,7 +21,7 @@ struct ContentView: View { TabView { TranslatorView() .tabItem { - Image(systemName: "pencil") + Image(systemName: "message") Text("Phrase Lookup") } FlashCardLessonsView() @@ -29,11 +29,11 @@ struct ContentView: View { Image(systemName: "character.textbox") Text("Flash Cards") } - FlashCardResultsView() - .tabItem { - Image(systemName: "number.circle") - Text("Flash Card Results") - } +// FlashCardResultsView() +// .tabItem { +// Image(systemName: "number.circle") +// Text("Flash Card Results") +// } } } diff --git a/Toki Trainer/Views/FlashCardLessonsView.swift b/Toki Trainer/Views/FlashCardLessonsView.swift index e0c4874..41ed323 100644 --- a/Toki Trainer/Views/FlashCardLessonsView.swift +++ b/Toki Trainer/Views/FlashCardLessonsView.swift @@ -67,7 +67,7 @@ struct FlashCardLessonsView: View { var body: some View { NavigationView { List(flashCardLessonsVM.lessons, id: \.lesson) { lesson in - NavigationLink(destination: FlashCardView(lesson: lesson.lesson, passedDictionary: lesson.words)) { + NavigationLink(destination: FlashCardView(lesson: lesson.lesson, passedDictionary: lesson.words.shuffled())) { Text(lesson.lesson) .bold() .onAppear { diff --git a/Toki Trainer/Views/FlashCardView.swift b/Toki Trainer/Views/FlashCardView.swift index e6ea3f0..25184de 100644 --- a/Toki Trainer/Views/FlashCardView.swift +++ b/Toki Trainer/Views/FlashCardView.swift @@ -61,6 +61,7 @@ struct FlashCardStack: View { var currentLesson: String var dictionary: [TokiDictEntry] + @State private var shuffledDictionary: [TokiDictEntry] = [] @State private var flashCards: [FlashCard] = [] @State private var topFlashCard: FlashCard? = nil @State private var flashCardsAreInteractive: [Bool] = [] @@ -71,6 +72,11 @@ struct FlashCardStack: View { @State private var currentFlashCard = 0 + init(currentLesson: String, dictionary: [TokiDictEntry]) { + self.currentLesson = currentLesson + self.dictionary = dictionary + } + var body: some View { VStack { ZStack { @@ -99,10 +105,12 @@ struct FlashCardStack: View { func initFlashCards() { flashCards = [] - for index in dictionary.indices { + shuffledDictionary = dictionary + shuffledDictionary.shuffle() + for index in shuffledDictionary.indices { flashCardsAreInteractive.append(false) flashCardsResults.append(FlashCardResult.Unanswered) - flashCards.append(FlashCard(isInteractive: $flashCardsAreInteractive[index], result: $flashCardsResults[index].onChange(cardAnswerReceived), dictionaryEntry: dictionary[index])) + flashCards.append(FlashCard(isInteractive: $flashCardsAreInteractive[index], result: $flashCardsResults[index].onChange(cardAnswerReceived), dictionaryEntry: shuffledDictionary[index])) flashCardsVertOffset.append(370) } if flashCards.count - currentFlashCard >= 3 { @@ -134,7 +142,7 @@ struct FlashCardStack: View { func setFlashCardAnswersCoreData(_ correct: Bool) { var cardInDatabase = false for answer in flashCardAnswers { - if answer.word == dictionary[currentFlashCard].word { + if answer.word == shuffledDictionary[currentFlashCard].word { print("word in database: \(answer.word)") print("tries: \(answer.triesCount)") print("correct`: \(answer.correctCount)") @@ -171,7 +179,7 @@ struct FlashCardStack: View { if cardInDatabase == false { let answer = FlashCardAnswer(context: viewContext) - answer.word = dictionary[currentFlashCard].word + answer.word = shuffledDictionary[currentFlashCard].word answer.triesCount = 1 if correct { answer.correctCount = 1