Practice
A lesson exercise in chunky word tiles you press into place, with a talking coach, instant feedback and a confetti finish.
A lesson exercise: the coach holds the sentence in a speech bubble, with a hint under every word and a speaker to hear it, and you build the translation from chunky tiles that press down like keys and hop onto the answer line. Check slides up the verdict, with the right answer and the words that differ in bold when you miss, the coach cheering or wincing and a haptic either way, and a combo counts the answers you get right in a row. After the last exercise the lesson ends in confetti, with stars, XP, accuracy and time. Checking is a pure `SentenceCheck` that forgives case and punctuation, and accents when asked, and accepts alternatives.
$199 once, every piece included. See how installing works · Sign in
What's included
SwiftUI source you own, built on Apple frameworks only.
- Chunky word tiles that press down and hop into the answer line
- A speech-bubble coach with a hint on every word and the sentence read aloud
- Check slides up the verdict, with the differing words in bold when you miss
- A combo for answers in a row, and a confetti finish with stars, XP and accuracy
- A listening kind, and a pure
SentenceCheckyou can test
Language App (template)
Implementation notes
How it behaves, what it handles, and the decisions behind it.
The exercise plays like a game you win one sentence at a time. A close key, a chunky progress bar in the unit's color and, from two right answers in a row, a combo flame run across the top. Pip thinks beside a speech bubble that holds the sentence: every word has a dotted line under it, so tap one for its translation, or tap the speaker to hear the whole sentence. The answer is built from tiles that stand on a lip and press down like keys. Tap one and it hops onto the ruled answer lines, leaving a flat ghost so the bank never moves under your thumb; tap it again to send it back. Check slides up the verdict: green with Continue and Pip cheering when you're right, red with the correct answer, the words that differ in bold and Pip wincing when you're not, with a haptic either way. A miss comes back once at the end, and the last exercise ends in confetti, with up to three stars popping in and the lesson's XP, accuracy and time on tiles of their own.
Notes
SentenceBuilder(exercises:block:xp:onFinish:)runs a lesson over[SentenceExercise]. Each exercise has itspromptandanswerwith their languages,distractorsmixed into the bank, acceptedalternatives,hintsfor the words of the prompt, thewordsit teaches and an optionalcontext. The bank's order comes from the exercise's id, so the same exercise always deals the same way.alternativesare other ways to build the answer from the same tiles, such as another word order.kind: .listenhides the sentence: a big speaker key plays it (and plays once on its own), a slow key replays it slower, and you build what you hear.- Prompts in a language other than
learnerLanguageget a speaker, and so does the correct answer in the verdict. Speech usesAVSpeechSynthesizeratvoiceRate; passonListento play your own audio.speaksPromptsreads those prompts aloud as each exercise appears. SentenceCheckis pure and tested:check(_:answer:alternatives:options:)returns aSentenceResultwith the closest accepted sentence and the words that differ, found by a longest common subsequence. Case, punctuation and spacing never count; accents count unlessoptions.ignoresAccentsis on, and ñ always stays ñ.onFinishgets aSentenceLessonResult: the XP (the lesson'sxp, plus 5 for a perfect run), 1 to 3 stars from accuracy, the time, the best combo, the exercises missed on the first try and every exercise's words without repeats, ready for a review queue.onProgressreports the share solved after each exercise, to keep a lesson's place when it is closed part way, andSentenceBuilderFinish(result:onContinue:)shows the finish on its own.- Keys and tiles are
SPTactileStylefrom the design system, the coach isSPBuddyand the bursts areSPConfettiBurst, so the screen takes the theme's blocks, type and status colors. A combo of 3, 5 and 10 sets off a small burst by the flame. - VoiceOver reads tiles as buttons ("café", "Adds it to your answer"), the answer line as the sentence you've built, and announces the verdict. Tiles grow with Dynamic Type and the page scrolls at the largest sizes.
- Reduce Motion turns the hop into a fade in place and the springs into short eases, and skips the bursts. Closing part way asks before it discards the lesson.
SentenceBuilderExampleat the end ofSentenceBuilder.swiftis the screen in the preview: six exercises at a Spanish café, from ordering to the bill, built both ways and one heard. Copy it as a starting point.
Keep building
Pieces that work well next to this one.