Personal project
Leu
Read a passage. Find the gap. Return to the exact source.
- Built with
- SwiftUI · PDFKit · Swift · ONNX Runtime · Kokoro-82M
- Context
- Independent product · 2026
Behind the interface
Architecture & tools.
The native reader owns source selection and exact return. A shared learning core owns session state, while a separate voice provider generates neural audio entirely in-process on the device.
- Native interface
SwiftUI · PDFKit · Swift
Keep reading, selection, source return and learning state inside a native iOS experience.
- Learning core
ShelfCore · source anchors · persisted session state
Preserve document identity, exact source ranges, drafts, feedback and Teach It Back transitions.
- Neural voice
Kokoro-82M · ONNX Runtime · AVAudioEngine
Generate narration on-device, time-stretch playback without pitch shift, and map playback state back to the active source.
- Verification
XCTest · XCUITest · iOS Simulator
Exercise cancellation, stale-result suppression, source ownership, selected-passage playback and the learning Listen journey.
- 01
Read
Select an exact passage in the native PDF reader.
- 02
Diagnose
Ask a source-grounded question and capture the learner answer.
- 03
Repair
Give specific feedback, clarification or a harder follow-up.
- 04
Teach back
Return to the source, explain it, and preserve the completed trace.
A stale or cancelled speech result cannot start after a newer request or Stop. Voice preference persists across relaunch, playback itself does not, and narration marks are transient rather than saved as source annotations.
The challenge
Reading a PDF is not the same as understanding it. Generic AI explanations can drift away from the source, while quiz flows often test recall without helping the learner repair the exact gap.
Decisions that shaped the product
Never detach the answer from the source.
Selections preserve document identity and exact text ranges through questioning, feedback and source return. The learner can always get back to the passage that triggered the session.
The tradeoff. The product carries more source-state than a conventional chat or quiz flow, but that state is what makes the learning trace inspectable.
Diagnose, repair, then ask for explanation.
A session can move from a diagnostic answer into specific feedback, clarification, a harder follow-up and Teach It Back instead of ending at correct or incorrect.
The tradeoff. The state machine is more involved than a card carousel, but each transition has a distinct learning job.
Keep neural voice inside the app.
Kokoro-82M runs through native ONNX Runtime and AVAudioEngine. Narration follows the active source, pause softens the mark, Stop clears it, and stale generation cannot begin playing after replacement or cancellation.
The tradeoff. Bundled model assets and runtime memory are meaningful costs, so physical-device performance still needs release validation.
The outcome
A native SwiftUI/PDFKit learning product with source-linked sessions, exact source return, persistent learning state and on-device neural narration. The current Kokoro build completed more than 2.8 minutes of continuous native playback in iOS Simulator, and its generated clips were listening-reviewed before this case study was published.
Physical-iPhone performance, peak memory and energy use, a full VoiceOver/Reduce Motion pass, production-PDF validation on the new Simulator, and TestFlight signing remain release work.
Next case study
VIGIA