From bbafb06a950e535f729e5167c22f4c2aa44fe0b9 Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 20 Jul 2026 22:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=89=A9=E5=88=86=E7=B1=BB=E6=8B=86?= =?UTF-8?q?=E5=88=86=E4=B8=BA=E9=99=86=E5=9C=B0/=E9=A3=9E=E7=BF=94/?= =?UTF-8?q?=E4=B8=A4=E6=A0=96/=E6=B7=A1=E6=B0=B4/=E6=B5=B7=E6=B4=8B?= =?UTF-8?q?=E4=BA=94=E4=B8=AA=E5=AD=90=E5=88=86=E7=B1=BB=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B7=A1=E6=B0=B4=E5=8A=A8=E7=89=A9=E8=AF=8D=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- CLAUDE.md | 16 ----- .../LearnEnglish/Resources/words.json | 63 +++++++++++++++---- 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5ab5568..03405a8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,19 +21,3 @@ xcodebuild -project LearnEnglish/LearnEnglish.xcodeproj -scheme LearnEnglish \ - 部署目标为 iOS 26,模拟器必须是 iOS 26.x 运行时,否则安装时报系统版本过低。 - 无测试 target、无 lint 配置,验证方式 = 编译。 - Xcode 工程使用同步文件夹(objectVersion 77),在 `LearnEnglish/LearnEnglish/` 下新建 .swift 文件会自动加入 target,无需改 pbxproj。 - -## 架构 - -**数据流**:`Resources/words.json` → `WordStore.load()`(SceneDelegate 启动时加载一次)→ 通过初始化器逐层注入(`CategoryListViewController(store:)` → `WordListViewController(category:)` → 详情/测验)。词库模型 `WordBank`/`WordCategory`/`Word` 均为 Codable,见 `Models/Word.swift`。 - -**words.json 格式**:每个单词单行 JSON 对象,字段为 `word`/`phonetic`/`meaning`/`example`/`exampleMeaning`,追加新词时保持该格式。编辑时注意同名单词可能出现在多个分类(如 orange 既是颜色也是水果),替换要限定在目标分类区块内。 - -**页面流**:分类列表 → 单词列表(`WordCardCell`)→ 单词详情;单词列表底部"开始测验" → `QuizSetupViewController`(选模式、题量)→ `QuizViewController` → `QuizResultView`。 - -**测验**:四种模式(英选汉/汉选英/拼写/默写,`QuizMode`)由同一个 `QuizViewController` 承载;题目由 `QuizGenerator.makeQuestions` 生成(选择题自动取 3 个干扰项,拼写题按 40% 比例挖空)。拼写/默写分别用 `SpellingInputView`/`DictationInputView` 自定义输入组件。新增测验相关结构放 `Models/Quiz.swift`。 - -**发音**:`SpeechService.shared` 单例封装 `AVSpeechSynthesizer`(en-US),播放状态通过 `speakingDidChangeNotification` 广播,各页面监听后刷新喇叭按钮图标与可用状态。 - -**设计系统**:`Utilities/Theme.swift` 集中管理色板(`Theme.Color`,含分类调色板 `category(at:)`)、圆角(`Theme.Metrics`)、字体(`Theme.Font`);`UIView.setPressed`/`animateEntry` 为通用按压/入场动画。新 UI 元素应复用这些 token 而不是硬编码数值。`HairlineView` 是适配屏幕缩放的分隔线组件。 - -**导航**:`SceneDelegate` 直接构建 `UINavigationController` 根控制器并设置 `window.tintColor`;各页面用 `navigationItem.largeTitleDisplayMode = .never` 关闭大标题。 diff --git a/LearnEnglish/LearnEnglish/Resources/words.json b/LearnEnglish/LearnEnglish/Resources/words.json index 15ffd67..22dcb51 100644 --- a/LearnEnglish/LearnEnglish/Resources/words.json +++ b/LearnEnglish/LearnEnglish/Resources/words.json @@ -49,14 +49,12 @@ ] }, { - "id": "animals", - "name": "动物", + "id": "land_animals", + "name": "陆地动物", "icon": "pawprint.fill", "words": [ { "word": "cat", "phonetic": "/kæt/", "meaning": "猫", "example": "The cat is cute.", "exampleMeaning": "这只猫很可爱。" }, { "word": "dog", "phonetic": "/dɔːɡ/", "meaning": "狗", "example": "The dog is running.", "exampleMeaning": "狗在跑。" }, - { "word": "bird", "phonetic": "/bɜːrd/", "meaning": "鸟", "example": "The bird can fly.", "exampleMeaning": "鸟会飞。" }, - { "word": "fish", "phonetic": "/fɪʃ/", "meaning": "鱼", "example": "The fish swims fast.", "exampleMeaning": "鱼游得很快。" }, { "word": "rabbit", "phonetic": "/ˈræbɪt/", "meaning": "兔子", "example": "The rabbit likes carrots.", "exampleMeaning": "兔子喜欢胡萝卜。" }, { "word": "tiger", "phonetic": "/ˈtaɪɡər/", "meaning": "老虎", "example": "The tiger is strong.", "exampleMeaning": "老虎很强壮。" }, { "word": "elephant", "phonetic": "/ˈelɪfənt/", "meaning": "大象", "example": "The elephant has a long nose.", "exampleMeaning": "大象有长长的鼻子。" }, @@ -67,11 +65,9 @@ { "word": "sheep", "phonetic": "/ʃiːp/", "meaning": "绵羊", "example": "The sheep eats grass.", "exampleMeaning": "绵羊吃草。" }, { "word": "pig", "phonetic": "/pɪɡ/", "meaning": "猪", "example": "The pig is fat.", "exampleMeaning": "这头猪很胖。" }, { "word": "cow", "phonetic": "/kaʊ/", "meaning": "奶牛", "example": "The cow gives milk.", "exampleMeaning": "奶牛产奶。" }, - { "word": "duck", "phonetic": "/dʌk/", "meaning": "鸭子", "example": "The duck swims in the pond.", "exampleMeaning": "鸭子在池塘里游泳。" }, { "word": "chicken", "phonetic": "/ˈtʃɪkɪn/", "meaning": "鸡", "example": "The chicken lays eggs.", "exampleMeaning": "母鸡下蛋。" }, { "word": "mouse", "phonetic": "/maʊs/", "meaning": "老鼠", "example": "The mouse likes cheese.", "exampleMeaning": "老鼠喜欢奶酪。" }, { "word": "snake", "phonetic": "/sneɪk/", "meaning": "蛇", "example": "The snake has no legs.", "exampleMeaning": "蛇没有腿。" }, - { "word": "frog", "phonetic": "/frɔːɡ/", "meaning": "青蛙", "example": "The frog can jump high.", "exampleMeaning": "青蛙能跳得很高。" }, { "word": "bear", "phonetic": "/ber/", "meaning": "熊", "example": "The bear sleeps in winter.", "exampleMeaning": "熊在冬天睡觉。" }, { "word": "giraffe", "phonetic": "/dʒəˈræf/", "meaning": "长颈鹿", "example": "The giraffe is tall.", "exampleMeaning": "长颈鹿很高。" }, { "word": "zebra", "phonetic": "/ˈziːbrə/", "meaning": "斑马", "example": "The zebra has stripes.", "exampleMeaning": "斑马身上有条纹。" }, @@ -79,14 +75,7 @@ { "word": "fox", "phonetic": "/fɑːks/", "meaning": "狐狸", "example": "The fox is clever.", "exampleMeaning": "狐狸很聪明。" }, { "word": "deer", "phonetic": "/dɪr/", "meaning": "鹿", "example": "The deer runs fast.", "exampleMeaning": "鹿跑得很快。" }, { "word": "squirrel", "phonetic": "/ˈskwɜːrəl/", "meaning": "松鼠", "example": "The squirrel likes nuts.", "exampleMeaning": "松鼠喜欢坚果。" }, - { "word": "penguin", "phonetic": "/ˈpeŋɡwɪn/", "meaning": "企鹅", "example": "The penguin cannot fly.", "exampleMeaning": "企鹅不会飞。" }, - { "word": "dolphin", "phonetic": "/ˈdɑːlfɪn/", "meaning": "海豚", "example": "The dolphin swims fast.", "exampleMeaning": "海豚游得很快。" }, - { "word": "whale", "phonetic": "/weɪl/", "meaning": "鲸鱼", "example": "The whale is very big.", "exampleMeaning": "鲸鱼非常大。" }, - { "word": "shark", "phonetic": "/ʃɑːrk/", "meaning": "鲨鱼", "example": "The shark has sharp teeth.", "exampleMeaning": "鲨鱼有锋利的牙齿。" }, { "word": "turtle", "phonetic": "/ˈtɜːrtl/", "meaning": "乌龟", "example": "The turtle walks slowly.", "exampleMeaning": "乌龟走得很慢。" }, - { "word": "owl", "phonetic": "/aʊl/", "meaning": "猫头鹰", "example": "The owl sleeps in the day.", "exampleMeaning": "猫头鹰白天睡觉。" }, - { "word": "bee", "phonetic": "/biː/", "meaning": "蜜蜂", "example": "The bee makes honey.", "exampleMeaning": "蜜蜂酿蜜。" }, - { "word": "butterfly", "phonetic": "/ˈbʌtərflaɪ/", "meaning": "蝴蝶", "example": "The butterfly is beautiful.", "exampleMeaning": "蝴蝶很漂亮。" }, { "word": "ant", "phonetic": "/ænt/", "meaning": "蚂蚁", "example": "The ant carries food.", "exampleMeaning": "蚂蚁搬运食物。" }, { "word": "spider", "phonetic": "/ˈspaɪdər/", "meaning": "蜘蛛", "example": "The spider makes a web.", "exampleMeaning": "蜘蛛织网。" }, { "word": "kangaroo", "phonetic": "/ˌkæŋɡəˈruː/", "meaning": "袋鼠", "example": "The kangaroo jumps high.", "exampleMeaning": "袋鼠跳得很高。" }, @@ -95,6 +84,54 @@ { "word": "camel", "phonetic": "/ˈkæml/", "meaning": "骆驼", "example": "The camel lives in the desert.", "exampleMeaning": "骆驼生活在沙漠里。" } ] }, + { + "id": "flying_animals", + "name": "飞翔动物", + "icon": "bird.fill", + "words": [ + { "word": "bird", "phonetic": "/bɜːrd/", "meaning": "鸟", "example": "The bird can fly.", "exampleMeaning": "鸟会飞。" }, + { "word": "owl", "phonetic": "/aʊl/", "meaning": "猫头鹰", "example": "The owl sleeps in the day.", "exampleMeaning": "猫头鹰白天睡觉。" }, + { "word": "bee", "phonetic": "/biː/", "meaning": "蜜蜂", "example": "The bee makes honey.", "exampleMeaning": "蜜蜂酿蜜。" }, + { "word": "butterfly", "phonetic": "/ˈbʌtərflaɪ/", "meaning": "蝴蝶", "example": "The butterfly is beautiful.", "exampleMeaning": "蝴蝶很漂亮。" } + ] + }, + { + "id": "amphibious_animals", + "name": "两栖动物", + "icon": "leaf.arrow.triangle.circlepath", + "words": [ + { "word": "duck", "phonetic": "/dʌk/", "meaning": "鸭子", "example": "The duck swims in the pond.", "exampleMeaning": "鸭子在池塘里游泳。" }, + { "word": "frog", "phonetic": "/frɔːɡ/", "meaning": "青蛙", "example": "The frog can jump high.", "exampleMeaning": "青蛙能跳得很高。" }, + { "word": "penguin", "phonetic": "/ˈpeŋɡwɪn/", "meaning": "企鹅", "example": "The penguin cannot fly.", "exampleMeaning": "企鹅不会飞。" } + ] + }, + { + "id": "freshwater_animals", + "name": "淡水动物", + "icon": "drop.fill", + "words": [ + { "word": "crayfish", "phonetic": "/ˈkreɪfɪʃ/", "meaning": "小龙虾", "example": "The crayfish lives in the river.", "exampleMeaning": "小龙虾生活在河里。" }, + { "word": "loach", "phonetic": "/loʊtʃ/", "meaning": "泥鳅", "example": "The loach hides in the mud.", "exampleMeaning": "泥鳅躲在泥里。" }, + { "word": "carp", "phonetic": "/kɑːrp/", "meaning": "鲤鱼", "example": "The carp swims in the pond.", "exampleMeaning": "鲤鱼在池塘里游泳。" }, + { "word": "goldfish", "phonetic": "/ˈɡoʊldfɪʃ/", "meaning": "金鱼", "example": "The goldfish is orange.", "exampleMeaning": "金鱼是橙色的。" }, + { "word": "eel", "phonetic": "/iːl/", "meaning": "鳗鱼", "example": "The eel is long and thin.", "exampleMeaning": "鳗鱼又长又细。" }, + { "word": "crab", "phonetic": "/kræb/", "meaning": "螃蟹", "example": "The crab walks sideways.", "exampleMeaning": "螃蟹横着走。" }, + { "word": "shrimp", "phonetic": "/ʃrɪmp/", "meaning": "虾", "example": "The shrimp is small.", "exampleMeaning": "虾很小。" }, + { "word": "otter", "phonetic": "/ˈɑːtər/", "meaning": "水獭", "example": "The otter swims in the river.", "exampleMeaning": "水獭在河里游泳。" }, + { "word": "beaver", "phonetic": "/ˈbiːvər/", "meaning": "河狸", "example": "The beaver builds a dam.", "exampleMeaning": "河狸筑水坝。" } + ] + }, + { + "id": "ocean_animals", + "name": "海洋动物", + "icon": "fish.fill", + "words": [ + { "word": "fish", "phonetic": "/fɪʃ/", "meaning": "鱼", "example": "The fish swims fast.", "exampleMeaning": "鱼游得很快。" }, + { "word": "dolphin", "phonetic": "/ˈdɑːlfɪn/", "meaning": "海豚", "example": "The dolphin swims fast.", "exampleMeaning": "海豚游得很快。" }, + { "word": "whale", "phonetic": "/weɪl/", "meaning": "鲸鱼", "example": "The whale is very big.", "exampleMeaning": "鲸鱼非常大。" }, + { "word": "shark", "phonetic": "/ʃɑːrk/", "meaning": "鲨鱼", "example": "The shark has sharp teeth.", "exampleMeaning": "鲨鱼有锋利的牙齿。" } + ] + }, { "id": "fruits", "name": "水果",