krz/daybyday

iOS learning games for young children: days, months, seasons, numbers, letters, animals and more. education ios kids swift https://krz.sh/apps/daybyday/

Commit 4b18bfdc94

4b18bfdc94bd7abedc1d369dca7fddc0e750e598

parent: 2e147ce8ad

Unsigned

cmc <hello@cleberg.net> · 2026-10-18 00:59 UTC

VoiceOver, Voice Control and Larger Text (!15)

Closes #14

## App Store accessibility features

Can now be claimed:
- **VoiceOver**: every control a child or grown-up uses is one labeled element. That covers profile setup, picking a child, every topic and game, the Today routine and Grown-Ups. Tracing finishes when the guide is activated. The parent gate's hold step passes on activation, and the sum still applies. "Hear it again" reads the current question as its value. Counting, the sort bins and the week train slots read their state.
- **Voice Control**: the same labels. The UI tests open every screen by these names.
- **Larger Text**: headings use `Font.custom(_:size:relativeTo:)` with the text style nearest their size. Grown-Ups text uses text styles. Layouts stack, widen or scroll at the accessibility sizes.
- **Sufficient Contrast**: the audit passes contrast on every screen. White labels on card and tile fills are at least 3:1, which meets WCAG AA for large text (all are at least 19 pt bold). Small gray text is now primary.
- Dark Interface and Reduced Motion, as before.

Not claimed: Differentiate Without Color (the Colors topic is about color), Captions and Audio Descriptions (no video).

## Changes

- `DayByDayUITests` (new target, `scripts/add-ui-test-target.rb`) runs `performAccessibilityAudit` on every screen at the default and the largest text size. The exceptions it allows are commented in the test:
  - system toolbar buttons and list headers
  - food emoji
  - the year wheel's month names, which are part of the picture
  - the sticker calendar grid, capped at `accessibility1` because seven columns leave no room; VoiceOver reads each full date
  - Dynamic Type growth, which is checked at the largest size only
  - clipping that does not repeat on a second check
- Look-and-listen card colors are darker, with flat fills, to reach 3:1 against white. The Colors cards use black labels on orange, yellow, green, pink and white. New `ContrastTests` cover each card color.
- The highlight glow on today's day, number, month and season card is on the card only, not the label.
- New `PromptBar` (mascot and "Hear it again") is shared by the games and the routine. New `CenteredScrollView` is used by the gate, welcome, voice tip, routine lines, Moves and the finished screen.
- Debug screenshot scenes `setup` and `picker` exist for the UI tests.
- `TEXT_SIZE=accessibility-extra-extra-extra-large scripts/take-screenshots.sh` writes `AppStore/screenshots-accessibility-extra-extra-extra-large` (committed).

## Not verified

- VoiceOver on a device: the Simulator has no VoiceOver. The trace and gate activation actions are not covered by the tests.
- Navigation bar titles truncate at the accessibility sizes (system behavior).

Layout: unified · split

AlphabetView.swift +1 −1
@@ -17,7 +17,7 @@ struct AlphabetView: View {
17 LazyVGrid(columns: columns, spacing: 20) { 17 LazyVGrid(columns: columns, spacing: 20) {
18 ForEach(LearnLetter.allCases) { letter in 18 ForEach(LearnLetter.allCases) { letter in
19 LetterCard(letter: letter) 19 LetterCard(letter: letter)
20 .frame(height: 160) 20 .frame(minHeight: 160)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
AnimalCard.swift +2
@@ -27,6 +27,7 @@ struct AnimalCard: View {
27 .font(.heading(32)) 27 .font(.heading(32))
28 .foregroundStyle(.white) 28 .foregroundStyle(.white)
29 } 29 }
30 .padding(16)
30 } 31 }
31 .scaleEffect(isTapped ? 1.12 : 1.0) 32 .scaleEffect(isTapped ? 1.12 : 1.0)
32 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 33 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct AnimalCard: View {
39 isTapped = false 40 isTapped = false
40 } 41 }
41 } 42 }
43 .accessibilityElement(children: .ignore)
42 .accessibilityLabel(animal.name) 44 .accessibilityLabel(animal.name)
43 .accessibilityAddTraits(.isButton) 45 .accessibilityAddTraits(.isButton)
44 } 46 }
AnimalsView.swift +1 −1
@@ -17,7 +17,7 @@ struct AnimalsView: View {
17 LazyVGrid(columns: columns, spacing: 24) { 17 LazyVGrid(columns: columns, spacing: 24) {
18 ForEach(LearnAnimal.allCases) { animal in 18 ForEach(LearnAnimal.allCases) { animal in
19 AnimalCard(animal: animal) 19 AnimalCard(animal: animal)
20 .frame(height: 200) 20 .frame(minHeight: 200)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
AppStore/header-16x9.png

Binary file not shown.

AppStore/header-21x9.png

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/01-home.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/02-routine.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/03-animals.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/04-train.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/05-trace.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/06-counting.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/07-calendar.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/ipad/08-progress.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/01-home.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/02-routine.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/03-animals.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/04-train.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/05-trace.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/06-counting.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/07-calendar.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.3/08-progress.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/01-home.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/02-routine.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/03-animals.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/04-train.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/05-trace.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/06-counting.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/07-calendar.png added

Binary file not shown.

AppStore/screenshots-accessibility-extra-extra-extra-large/iphone-6.9/08-progress.png added

Binary file not shown.

AppStore/screenshots/ipad/01-home.png

Binary file not shown.

AppStore/screenshots/ipad/02-routine.png

Binary file not shown.

AppStore/screenshots/ipad/04-train.png

Binary file not shown.

AppStore/screenshots/ipad/05-trace.png

Binary file not shown.

AppStore/screenshots/ipad/06-counting.png

Binary file not shown.

AppStore/screenshots/ipad/07-calendar.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/01-home.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/02-routine.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/03-animals.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/04-train.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/05-trace.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/06-counting.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/07-calendar.png

Binary file not shown.

AppStore/screenshots/iphone-6.3/08-progress.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/01-home.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/02-routine.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/03-animals.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/04-train.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/05-trace.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/06-counting.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/07-calendar.png

Binary file not shown.

AppStore/screenshots/iphone-6.9/08-progress.png

Binary file not shown.

AppStore/whats-new.md +8
@@ -1,5 +1,13 @@
1# What's New 1# What's New
2 2
3## 2.0.1
4
5Accessibility improvements throughout.
6
7- Works with VoiceOver and Voice Control: every button, card and game is labeled, and tracing and the parent gate can be completed without dragging or holding.
8- Text grows with the Larger Text setting, and screens rearrange to fit at the largest sizes.
9- Higher-contrast cards and labels.
10
3## 2.0 11## 2.0
4 12
5DayByDay now turns every topic into games. 13DayByDay now turns every topic into games.
BodyPartCard.swift +10 −8
@@ -14,7 +14,7 @@ struct BodyPartCard: View {
14 var body: some View { 14 var body: some View {
15 ZStack { 15 ZStack {
16 RoundedRectangle(cornerRadius: 32, style: .continuous) 16 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(bodyPart.color.gradient) 17 .fill(bodyPart.color)
18 .shadow(color: bodyPart.color.opacity(0.4), radius: 8, y: 4) 18 .shadow(color: bodyPart.color.opacity(0.4), radius: 8, y: 4)
19 19
20 VStack(spacing: 16) { 20 VStack(spacing: 16) {
@@ -27,6 +27,7 @@ struct BodyPartCard: View {
27 .font(.heading(32)) 27 .font(.heading(32))
28 .foregroundStyle(.white) 28 .foregroundStyle(.white)
29 } 29 }
30 .padding(16)
30 } 31 }
31 .scaleEffect(isTapped ? 1.12 : 1.0) 32 .scaleEffect(isTapped ? 1.12 : 1.0)
32 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 33 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct BodyPartCard: View {
39 isTapped = false 40 isTapped = false
40 } 41 }
41 } 42 }
43 .accessibilityElement(children: .ignore)
42 .accessibilityLabel(bodyPart.name) 44 .accessibilityLabel(bodyPart.name)
43 .accessibilityAddTraits(.isButton) 45 .accessibilityAddTraits(.isButton)
44 } 46 }
@@ -87,18 +89,18 @@ nonisolated enum LearnBodyPart: Int, CaseIterable, Identifiable {
87 89
88 var color: Color { 90 var color: Color {
89 switch self { 91 switch self {
90 case .head: Color(red: 0.9, green: 0.5, blue: 0.3) // warm orange 92 case .head: Color(red: 0.82, green: 0.46, blue: 0.27) // warm orange
91 case .eyes: Color(red: 0.3, green: 0.65, blue: 0.9) // blue 93 case .eyes: Color(red: 0.26, green: 0.58, blue: 0.8) // blue
92 case .ears: Color(red: 0.6, green: 0.45, blue: 0.85) // purple 94 case .ears: Color(red: 0.6, green: 0.45, blue: 0.85) // purple
93 case .nose: Color(red: 0.9, green: 0.4, blue: 0.5) // rose 95 case .nose: Color(red: 0.88, green: 0.39, blue: 0.49) // rose
94 case .mouth: Color(red: 0.9, green: 0.3, blue: 0.35) // red 96 case .mouth: Color(red: 0.9, green: 0.3, blue: 0.35) // red
95 case .hands: Color(red: 0.95, green: 0.7, blue: 0.3) // golden 97 case .hands: Color(red: 0.71, green: 0.52, blue: 0.22) // golden
96 case .fingers: Color(red: 0.35, green: 0.75, blue: 0.5) // green 98 case .fingers: Color(red: 0.28, green: 0.61, blue: 0.41) // green
97 case .arms: Color(red: 0.25, green: 0.7, blue: 0.7) // teal 99 case .arms: Color(red: 0.21, green: 0.61, blue: 0.61) // teal
98 case .legs: Color(red: 0.5, green: 0.4, blue: 0.8) // indigo 100 case .legs: Color(red: 0.5, green: 0.4, blue: 0.8) // indigo
99 case .feet: Color(red: 0.7, green: 0.5, blue: 0.3) // brown 101 case .feet: Color(red: 0.7, green: 0.5, blue: 0.3) // brown
100 case .heart: Color(red: 0.85, green: 0.3, blue: 0.45) // deep pink 102 case .heart: Color(red: 0.85, green: 0.3, blue: 0.45) // deep pink
101 case .belly: Color(red: 1.0, green: 0.6, blue: 0.4) // peach 103 case .belly: Color(red: 0.79, green: 0.47, blue: 0.32) // peach
102 } 104 }
103 } 105 }
104} 106}
BodyPartsView.swift +1 −1
@@ -16,7 +16,7 @@ struct BodyPartsView: View {
16 LazyVGrid(columns: columns, spacing: 24) { 16 LazyVGrid(columns: columns, spacing: 24) {
17 ForEach(LearnBodyPart.allCases) { part in 17 ForEach(LearnBodyPart.allCases) { part in
18 BodyPartCard(bodyPart: part) 18 BodyPartCard(bodyPart: part)
19 .frame(height: 200) 19 .frame(minHeight: 200)
20 } 20 }
21 } 21 }
22 .padding(32) 22 .padding(32)
ColorCard.swift +11 −3
@@ -13,13 +13,12 @@ struct ColorCard: View {
13 var body: some View { 13 var body: some View {
14 ZStack { 14 ZStack {
15 RoundedRectangle(cornerRadius: 32, style: .continuous) 15 RoundedRectangle(cornerRadius: 32, style: .continuous)
16 .fill(learnColor.color.gradient) 16 .fill(learnColor.color)
17 .shadow(color: learnColor.color.opacity(0.4), radius: 8, y: 4) 17 .shadow(color: learnColor.color.opacity(0.4), radius: 8, y: 4)
18 18
19 Text(learnColor.name) 19 Text(learnColor.name)
20 .font(.heading(36)) 20 .font(.heading(36))
21 .foregroundStyle(.white) 21 .foregroundStyle(learnColor.labelColor)
22 .shadow(color: .black.opacity(0.3), radius: 4, y: 2)
23 } 22 }
24 .scaleEffect(isTapped ? 1.12 : 1.0) 23 .scaleEffect(isTapped ? 1.12 : 1.0)
25 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 24 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -32,6 +31,7 @@ struct ColorCard: View {
32 isTapped = false 31 isTapped = false
33 } 32 }
34 } 33 }
34 .accessibilityElement(children: .ignore)
35 .accessibilityLabel(learnColor.name) 35 .accessibilityLabel(learnColor.name)
36 .accessibilityAddTraits(.isButton) 36 .accessibilityAddTraits(.isButton)
37 } 37 }
@@ -73,6 +73,14 @@ nonisolated enum LearnColor: Int, CaseIterable, Identifiable {
73 case .white: Color(red: 0.92, green: 0.92, blue: 0.92) 73 case .white: Color(red: 0.92, green: 0.92, blue: 0.92)
74 } 74 }
75 } 75 }
76
77 /// White or black, whichever is at least 3:1 on the color.
78 var labelColor: Color {
79 switch self {
80 case .orange, .yellow, .green, .pink, .white: .black
81 default: .white
82 }
83 }
76} 84}
77 85
78#Preview { 86#Preview {
ColorsView.swift +1 −1
@@ -17,7 +17,7 @@ struct ColorsView: View {
17 LazyVGrid(columns: columns, spacing: 24) { 17 LazyVGrid(columns: columns, spacing: 24) {
18 ForEach(LearnColor.allCases) { color in 18 ForEach(LearnColor.allCases) { color in
19 ColorCard(learnColor: color) 19 ColorCard(learnColor: color)
20 .frame(height: 200) 20 .frame(minHeight: 200)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
DayByDay.xcodeproj/project.pbxproj +114 −2
@@ -7,6 +7,7 @@
7 objects = { 7 objects = {
8 8
9/* Begin PBXBuildFile section */ 9/* Begin PBXBuildFile section */
10 064C33BF388C0C164246C8C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA83A180D07BFACBA92AC03E /* Foundation.framework */; };
10 8B1B4FF92F659AD1005C246F /* WeatherCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */; }; 11 8B1B4FF92F659AD1005C246F /* WeatherCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */; };
11 8B1B4FFB2F659AD1005C246F /* WeatherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */; }; 12 8B1B4FFB2F659AD1005C246F /* WeatherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */; };
12 8B1B4FFD2F659AD2005C246F /* BodyPartCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */; }; 13 8B1B4FFD2F659AD2005C246F /* BodyPartCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */; };
@@ -34,9 +35,17 @@
34 remoteGlobalIDString = 8B7051B12F5F908800491D58; 35 remoteGlobalIDString = 8B7051B12F5F908800491D58;
35 remoteInfo = DayByDay; 36 remoteInfo = DayByDay;
36 }; 37 };
38 3A90A0A4698DD0B1921863E6 /* PBXContainerItemProxy */ = {
39 isa = PBXContainerItemProxy;
40 containerPortal = 8B7051AA2F5F908800491D58 /* Project object */;
41 proxyType = 1;
42 remoteGlobalIDString = 8B7051B12F5F908800491D58;
43 remoteInfo = DayByDay;
44 };
37/* End PBXContainerItemProxy section */ 45/* End PBXContainerItemProxy section */
38 46
39/* Begin PBXFileReference section */ 47/* Begin PBXFileReference section */
48 888B02E423CDBC1710668F44 /* DayByDayUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DayByDayUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
40 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherCard.swift; sourceTree = "<group>"; }; 49 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherCard.swift; sourceTree = "<group>"; };
41 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherView.swift; sourceTree = "<group>"; }; 50 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherView.swift; sourceTree = "<group>"; };
42 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BodyPartCard.swift; sourceTree = "<group>"; }; 51 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BodyPartCard.swift; sourceTree = "<group>"; };
@@ -76,6 +85,13 @@
76 path = DayByDayTests; 85 path = DayByDayTests;
77 sourceTree = "<group>"; 86 sourceTree = "<group>";
78 }; 87 };
88 63A6B6AB1DFD8F1A3F120BDC /* DayByDayUITests */ = {
89 isa = PBXFileSystemSynchronizedRootGroup;
90 exceptions = (
91 );
92 path = DayByDayUITests;
93 sourceTree = "<group>";
94 };
79 8B7051B42F5F908800491D58 /* DayByDay */ = { 95 8B7051B42F5F908800491D58 /* DayByDay */ = {
80 isa = PBXFileSystemSynchronizedRootGroup; 96 isa = PBXFileSystemSynchronizedRootGroup;
81 exceptions = ( 97 exceptions = (
@@ -87,6 +103,14 @@
87/* End PBXFileSystemSynchronizedRootGroup section */ 103/* End PBXFileSystemSynchronizedRootGroup section */
88 104
89/* Begin PBXFrameworksBuildPhase section */ 105/* Begin PBXFrameworksBuildPhase section */
106 6F3337FFF2DE3E624FC30483 /* Frameworks */ = {
107 isa = PBXFrameworksBuildPhase;
108 buildActionMask = 2147483647;
109 files = (
110 064C33BF388C0C164246C8C5 /* Foundation.framework in Frameworks */,
111 );
112 runOnlyForDeploymentPostprocessing = 0;
113 };
90 8B7051AF2F5F908800491D58 /* Frameworks */ = { 114 8B7051AF2F5F908800491D58 /* Frameworks */ = {
91 isa = PBXFrameworksBuildPhase; 115 isa = PBXFrameworksBuildPhase;
92 buildActionMask = 2147483647; 116 buildActionMask = 2147483647;
@@ -144,6 +168,7 @@
144 8B1B50022F659AD4005C246F /* FoodView.swift */, 168 8B1B50022F659AD4005C246F /* FoodView.swift */,
145 43AAA6C6355BFA1D8A629985 /* Frameworks */, 169 43AAA6C6355BFA1D8A629985 /* Frameworks */,
146 4FDEBF44C97D137EF31F348A /* DayByDayTests */, 170 4FDEBF44C97D137EF31F348A /* DayByDayTests */,
171 63A6B6AB1DFD8F1A3F120BDC /* DayByDayUITests */,
147 ); 172 );
148 sourceTree = "<group>"; 173 sourceTree = "<group>";
149 }; 174 };
@@ -152,6 +177,7 @@
152 children = ( 177 children = (
153 8B7051B22F5F908800491D58 /* DayByDay.app */, 178 8B7051B22F5F908800491D58 /* DayByDay.app */,
154 B6E74F699AA6EB7ADABD5F88 /* DayByDayTests.xctest */, 179 B6E74F699AA6EB7ADABD5F88 /* DayByDayTests.xctest */,
180 888B02E423CDBC1710668F44 /* DayByDayUITests.xctest */,
155 ); 181 );
156 name = Products; 182 name = Products;
157 sourceTree = "<group>"; 183 sourceTree = "<group>";
@@ -159,6 +185,27 @@
159/* End PBXGroup section */ 185/* End PBXGroup section */
160 186
161/* Begin PBXNativeTarget section */ 187/* Begin PBXNativeTarget section */
188 403A770161DC84E4D6A3B44D /* DayByDayUITests */ = {
189 isa = PBXNativeTarget;
190 buildConfigurationList = 4896C67AB0D1CE76F1E50412 /* Build configuration list for PBXNativeTarget "DayByDayUITests" */;
191 buildPhases = (
192 E6FD65318FD1341227535EED /* Sources */,
193 6F3337FFF2DE3E624FC30483 /* Frameworks */,
194 860A78624F8B95D6FFD5B674 /* Resources */,
195 );
196 buildRules = (
197 );
198 dependencies = (
199 F12AC1A8951D64662983E318 /* PBXTargetDependency */,
200 );
201 fileSystemSynchronizedGroups = (
202 63A6B6AB1DFD8F1A3F120BDC /* DayByDayUITests */,
203 );
204 name = DayByDayUITests;
205 productName = DayByDayUITests;
206 productReference = 888B02E423CDBC1710668F44 /* DayByDayUITests.xctest */;
207 productType = "com.apple.product-type.bundle.ui-testing";
208 };
162 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */ = { 209 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */ = {
163 isa = PBXNativeTarget; 210 isa = PBXNativeTarget;
164 buildConfigurationList = F99EE566298541D2131D7F82 /* Build configuration list for PBXNativeTarget "DayByDayTests" */; 211 buildConfigurationList = F99EE566298541D2131D7F82 /* Build configuration list for PBXNativeTarget "DayByDayTests" */;
@@ -231,11 +278,19 @@
231 targets = ( 278 targets = (
232 8B7051B12F5F908800491D58 /* DayByDay */, 279 8B7051B12F5F908800491D58 /* DayByDay */,
233 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */, 280 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */,
281 403A770161DC84E4D6A3B44D /* DayByDayUITests */,
234 ); 282 );
235 }; 283 };
236/* End PBXProject section */ 284/* End PBXProject section */
237 285
238/* Begin PBXResourcesBuildPhase section */ 286/* Begin PBXResourcesBuildPhase section */
287 860A78624F8B95D6FFD5B674 /* Resources */ = {
288 isa = PBXResourcesBuildPhase;
289 buildActionMask = 2147483647;
290 files = (
291 );
292 runOnlyForDeploymentPostprocessing = 0;
293 };
239 8B7051B02F5F908800491D58 /* Resources */ = { 294 8B7051B02F5F908800491D58 /* Resources */ = {
240 isa = PBXResourcesBuildPhase; 295 isa = PBXResourcesBuildPhase;
241 buildActionMask = 2147483647; 296 buildActionMask = 2147483647;
@@ -283,6 +338,13 @@
283 ); 338 );
284 runOnlyForDeploymentPostprocessing = 0; 339 runOnlyForDeploymentPostprocessing = 0;
285 }; 340 };
341 E6FD65318FD1341227535EED /* Sources */ = {
342 isa = PBXSourcesBuildPhase;
343 buildActionMask = 2147483647;
344 files = (
345 );
346 runOnlyForDeploymentPostprocessing = 0;
347 };
286/* End PBXSourcesBuildPhase section */ 348/* End PBXSourcesBuildPhase section */
287 349
288/* Begin PBXTargetDependency section */ 350/* Begin PBXTargetDependency section */
@@ -292,9 +354,33 @@
292 target = 8B7051B12F5F908800491D58 /* DayByDay */; 354 target = 8B7051B12F5F908800491D58 /* DayByDay */;
293 targetProxy = 1015CD2FFBC39F380BE3151E /* PBXContainerItemProxy */; 355 targetProxy = 1015CD2FFBC39F380BE3151E /* PBXContainerItemProxy */;
294 }; 356 };
357 F12AC1A8951D64662983E318 /* PBXTargetDependency */ = {
358 isa = PBXTargetDependency;
359 name = DayByDay;
360 target = 8B7051B12F5F908800491D58 /* DayByDay */;
361 targetProxy = 3A90A0A4698DD0B1921863E6 /* PBXContainerItemProxy */;
362 };
295/* End PBXTargetDependency section */ 363/* End PBXTargetDependency section */
296 364
297/* Begin XCBuildConfiguration section */ 365/* Begin XCBuildConfiguration section */
366 473FC2426D94F491180BCDC1 /* Release */ = {
367 isa = XCBuildConfiguration;
368 buildSettings = {
369 CLANG_ENABLE_OBJC_WEAK = NO;
370 CODE_SIGN_STYLE = Automatic;
371 DEVELOPMENT_TEAM = ZCNAX3VL9D;
372 GENERATE_INFOPLIST_FILE = YES;
373 IPHONEOS_DEPLOYMENT_TARGET = 17.5;
374 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay.uitests;
375 PRODUCT_NAME = "$(TARGET_NAME)";
376 SDKROOT = iphoneos;
377 SWIFT_VERSION = 5.0;
378 TARGETED_DEVICE_FAMILY = "1,2";
379 TEST_TARGET_NAME = DayByDay;
380 VALIDATE_PRODUCT = YES;
381 };
382 name = Release;
383 };
298 76F72CE42B474B4C420CFF4F /* Release */ = { 384 76F72CE42B474B4C420CFF4F /* Release */ = {
299 isa = XCBuildConfiguration; 385 isa = XCBuildConfiguration;
300 buildSettings = { 386 buildSettings = {
@@ -460,7 +546,7 @@
460 "$(inherited)", 546 "$(inherited)",
461 "@executable_path/Frameworks", 547 "@executable_path/Frameworks",
462 ); 548 );
463 MARKETING_VERSION = 2.0; 549 MARKETING_VERSION = 2.0.1;
464 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay; 550 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay;
465 PRODUCT_NAME = "$(TARGET_NAME)"; 551 PRODUCT_NAME = "$(TARGET_NAME)";
466 STRING_CATALOG_GENERATE_SYMBOLS = YES; 552 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -494,7 +580,7 @@
494 "$(inherited)", 580 "$(inherited)",
495 "@executable_path/Frameworks", 581 "@executable_path/Frameworks",
496 ); 582 );
497 MARKETING_VERSION = 2.0; 583 MARKETING_VERSION = 2.0.1;
498 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay; 584 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay;
499 PRODUCT_NAME = "$(TARGET_NAME)"; 585 PRODUCT_NAME = "$(TARGET_NAME)";
500 STRING_CATALOG_GENERATE_SYMBOLS = YES; 586 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -527,9 +613,35 @@
527 }; 613 };
528 name = Debug; 614 name = Debug;
529 }; 615 };
616 9063B041B4911ADEEE18B14C /* Debug */ = {
617 isa = XCBuildConfiguration;
618 buildSettings = {
619 CLANG_ENABLE_OBJC_WEAK = NO;
620 CODE_SIGN_STYLE = Automatic;
621 DEVELOPMENT_TEAM = ZCNAX3VL9D;
622 GENERATE_INFOPLIST_FILE = YES;
623 IPHONEOS_DEPLOYMENT_TARGET = 17.5;
624 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay.uitests;
625 PRODUCT_NAME = "$(TARGET_NAME)";
626 SDKROOT = iphoneos;
627 SWIFT_VERSION = 5.0;
628 TARGETED_DEVICE_FAMILY = "1,2";
629 TEST_TARGET_NAME = DayByDay;
630 };
631 name = Debug;
632 };
530/* End XCBuildConfiguration section */ 633/* End XCBuildConfiguration section */
531 634
532/* Begin XCConfigurationList section */ 635/* Begin XCConfigurationList section */
636 4896C67AB0D1CE76F1E50412 /* Build configuration list for PBXNativeTarget "DayByDayUITests" */ = {
637 isa = XCConfigurationList;
638 buildConfigurations = (
639 473FC2426D94F491180BCDC1 /* Release */,
640 9063B041B4911ADEEE18B14C /* Debug */,
641 );
642 defaultConfigurationIsVisible = 0;
643 defaultConfigurationName = Release;
644 };
533 8B7051AD2F5F908800491D58 /* Build configuration list for PBXProject "DayByDay" */ = { 645 8B7051AD2F5F908800491D58 /* Build configuration list for PBXProject "DayByDay" */ = {
534 isa = XCConfigurationList; 646 isa = XCConfigurationList;
535 buildConfigurations = ( 647 buildConfigurations = (
DayByDay.xcodeproj/xcshareddata/xcschemes/DayByDay.xcscheme +24
@@ -34,6 +34,20 @@
34 ReferencedContainer = "container:DayByDay.xcodeproj"> 34 ReferencedContainer = "container:DayByDay.xcodeproj">
35 </BuildableReference> 35 </BuildableReference>
36 </BuildActionEntry> 36 </BuildActionEntry>
37 <BuildActionEntry
38 buildForTesting = "YES"
39 buildForRunning = "NO"
40 buildForProfiling = "NO"
41 buildForArchiving = "NO"
42 buildForAnalyzing = "NO">
43 <BuildableReference
44 BuildableIdentifier = "primary"
45 BlueprintIdentifier = "403A770161DC84E4D6A3B44D"
46 BuildableName = "DayByDayUITests.xctest"
47 BlueprintName = "DayByDayUITests"
48 ReferencedContainer = "container:DayByDay.xcodeproj">
49 </BuildableReference>
50 </BuildActionEntry>
37 </BuildActionEntries> 51 </BuildActionEntries>
38 </BuildAction> 52 </BuildAction>
39 <TestAction 53 <TestAction
@@ -53,6 +67,16 @@
53 ReferencedContainer = "container:DayByDay.xcodeproj"> 67 ReferencedContainer = "container:DayByDay.xcodeproj">
54 </BuildableReference> 68 </BuildableReference>
55 </TestableReference> 69 </TestableReference>
70 <TestableReference
71 skipped = "NO">
72 <BuildableReference
73 BuildableIdentifier = "primary"
74 BlueprintIdentifier = "403A770161DC84E4D6A3B44D"
75 BuildableName = "DayByDayUITests.xctest"
76 BlueprintName = "DayByDayUITests"
77 ReferencedContainer = "container:DayByDay.xcodeproj">
78 </BuildableReference>
79 </TestableReference>
56 </Testables> 80 </Testables>
57 </TestAction> 81 </TestAction>
58 <LaunchAction 82 <LaunchAction
DayByDay/CenteredScrollView.swift added +21
@@ -0,0 +1,21 @@
1//
2// CenteredScrollView.swift
3// DayByDay
4//
5
6import SwiftUI
7
8/// Centers its content, and scrolls it when it is taller than the screen, as
9/// it can be at the accessibility text sizes.
10struct CenteredScrollView<Content: View>: View {
11 @ViewBuilder let content: Content
12
13 var body: some View {
14 GeometryReader { geo in
15 ScrollView {
16 content.frame(maxWidth: .infinity, minHeight: geo.size.height)
17 }
18 .scrollBounceBehavior(.basedOnSize)
19 }
20 }
21}
DayByDay/ContentView.swift +28 −23
@@ -107,8 +107,10 @@ struct CategoryTile: View {
107 .font(.heading(24)) 107 .font(.heading(24))
108 .foregroundStyle(.white) 108 .foregroundStyle(.white)
109 } 109 }
110 .padding(12)
110 .shadow(color: category.usesGradientBackground ? .black.opacity(0.6) : .clear, radius: 2) 111 .shadow(color: category.usesGradientBackground ? .black.opacity(0.6) : .clear, radius: 2)
111 } 112 }
113 .accessibilityElement(children: .ignore)
112 .accessibilityLabel(category.label) 114 .accessibilityLabel(category.label)
113 } 115 }
114} 116}
@@ -148,33 +150,36 @@ struct VoiceTipOverlay: View {
148 Color.black.opacity(0.4) 150 Color.black.opacity(0.4)
149 .ignoresSafeArea() 151 .ignoresSafeArea()
150 152
151 VStack(spacing: 20) { 153 CenteredScrollView {
152 Image(systemName: "speaker.wave.3.fill") 154 VStack(spacing: 20) {
153 .font(.system(size: 48)) 155 Image(systemName: "speaker.wave.3.fill")
154 .foregroundStyle(.blue) 156 .font(.system(size: 48))
155 157 .foregroundStyle(.blue)
156 Text("Better Voices Available") 158
157 .font(.system(size: 28, weight: .bold, design: .rounded)) 159 Text("Better Voices Available")
158 160 .font(.system(.title, design: .rounded, weight: .bold))
159 Text("For the best experience, download an enhanced voice on your device.\n\nSettings → Accessibility → Read & Speak → Voices → English → tap a voice marked Enhanced or Premium to download it.") 161
160 .font(.system(size: 18, design: .rounded)) 162 Text("For the best experience, download an enhanced voice on your device.\n\nSettings → Accessibility → Read & Speak → Voices → English → tap a voice marked Enhanced or Premium to download it.")
161 .multilineTextAlignment(.center) 163 .font(.system(.body, design: .rounded))
162 .foregroundStyle(.secondary) 164 .multilineTextAlignment(.center)
163 165
164 Text("Tap anywhere to dismiss") 166 Text("Tap anywhere to dismiss")
165 .font(.system(size: 16, weight: .medium, design: .rounded)) 167 .font(.system(.callout, design: .rounded, weight: .medium))
166 .foregroundStyle(.tertiary) 168 .padding(.top, 8)
167 .padding(.top, 8) 169 }
170 .padding(40)
171 .frame(maxWidth: 520)
172 .background(
173 RoundedRectangle(cornerRadius: 32, style: .continuous)
174 .fill(.regularMaterial)
175 )
176 .padding(24)
168 } 177 }
169 .padding(40)
170 .frame(maxWidth: 520)
171 .background(
172 RoundedRectangle(cornerRadius: 32, style: .continuous)
173 .fill(.regularMaterial)
174 )
175 } 178 }
176 .contentShape(Rectangle()) 179 .contentShape(Rectangle())
177 .onTapGesture(perform: onDismiss) 180 .onTapGesture(perform: onDismiss)
181 .accessibilityElement(children: .combine)
182 .accessibilityAddTraits(.isButton)
178 } 183 }
179} 184}
180 185
DayByDay/DayCard.swift +4 −1
@@ -25,6 +25,8 @@ struct DayCard: View {
25 RoundedRectangle(cornerRadius: 32, style: .continuous) 25 RoundedRectangle(cornerRadius: 32, style: .continuous)
26 .fill(day.color) 26 .fill(day.color)
27 .shadow(color: day.color.opacity(0.4), radius: 8, y: 4) 27 .shadow(color: day.color.opacity(0.4), radius: 8, y: 4)
28 // Glow on the card only: on the label it would lower the contrast.
29 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
28 30
29 VStack(spacing: 16) { 31 VStack(spacing: 16) {
30 Image(systemName: day.symbol) 32 Image(systemName: day.symbol)
@@ -36,6 +38,7 @@ struct DayCard: View {
36 .font(.heading(32)) 38 .font(.heading(32))
37 .foregroundStyle(.white) 39 .foregroundStyle(.white)
38 } 40 }
41 .padding(16)
39 } 42 }
40 .overlay(alignment: .topTrailing) { 43 .overlay(alignment: .topTrailing) {
41 if let picture { 44 if let picture {
@@ -54,7 +57,6 @@ struct DayCard: View {
54 .strokeBorder(.white, lineWidth: 5) 57 .strokeBorder(.white, lineWidth: 5)
55 } 58 }
56 } 59 }
57 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
58 .scaleEffect(cardScale) 60 .scaleEffect(cardScale)
59 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 61 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
60 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) 62 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -66,6 +68,7 @@ struct DayCard: View {
66 isTapped = false 68 isTapped = false
67 } 69 }
68 } 70 }
71 .accessibilityElement(children: .ignore)
69 .accessibilityLabel(picture.map { "\(day.name), \($0.name)" } ?? day.name) 72 .accessibilityLabel(picture.map { "\(day.name), \($0.name)" } ?? day.name)
70 .accessibilityAddTraits(.isButton) 73 .accessibilityAddTraits(.isButton)
71 } 74 }
DayByDay/DaysOfWeekView.swift +1 −1
@@ -20,7 +20,7 @@ struct DaysOfWeekView: View {
20 LazyVGrid(columns: columns, spacing: 24) { 20 LazyVGrid(columns: columns, spacing: 24) {
21 ForEach(DayOfWeek.allCases) { day in 21 ForEach(DayOfWeek.allCases) { day in
22 DayCard(day: day, isHighlighted: day == .current, picture: picture(on: day)) 22 DayCard(day: day, isHighlighted: day == .current, picture: picture(on: day))
23 .frame(height: 200) 23 .frame(minHeight: 200)
24 } 24 }
25 } 25 }
26 .padding(32) 26 .padding(32)
DayByDay/Fonts/HeadingFont.swift +25 −4
@@ -13,21 +13,42 @@ enum HeadingFont {
13 static let bold = "Baloo2-Bold" 13 static let bold = "Baloo2-Bold"
14 static let extraBold = "Baloo2-ExtraBold" 14 static let extraBold = "Baloo2-ExtraBold"
15 15
16 /// Registers the bundled font and styles navigation titles with it. 16 /// Registers the bundled font and styles navigation titles with it, at
17 /// the text size set when the app launches.
17 static func register() { 18 static func register() {
18 if let url = Bundle.main.url(forResource: "Baloo2", withExtension: "ttf") { 19 if let url = Bundle.main.url(forResource: "Baloo2", withExtension: "ttf") {
19 CTFontManagerRegisterFontsForURL(url as CFURL, .process, nil) 20 CTFontManagerRegisterFontsForURL(url as CFURL, .process, nil)
20 } 21 }
21 if let large = UIFont(name: extraBold, size: 34), let inline = UIFont(name: bold, size: 19) { 22 if let large = UIFont(name: extraBold, size: 34), let inline = UIFont(name: bold, size: 19) {
22 UINavigationBar.appearance().largeTitleTextAttributes = [.font: large] 23 UINavigationBar.appearance().largeTitleTextAttributes =
23 UINavigationBar.appearance().titleTextAttributes = [.font: inline] 24 [.font: UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: large)]
25 UINavigationBar.appearance().titleTextAttributes =
26 [.font: UIFontMetrics(forTextStyle: .headline).scaledFont(for: inline, maximumPointSize: 28)]
27 }
28 }
29
30 /// The text style whose default size is nearest `size`, so a heading
31 /// grows with Dynamic Type at the same rate as system text that size.
32 static func textStyle(for size: CGFloat) -> Font.TextStyle {
33 switch size {
34 case ..<12: .caption2
35 case ..<14: .footnote
36 case ..<16.5: .callout
37 case ..<18.5: .body
38 case ..<21: .title3
39 case ..<25: .title2
40 case ..<31: .title
41 default: .largeTitle
24 } 42 }
25 } 43 }
26} 44}
27 45
28extension Font { 46extension Font {
29 /// A heading in Baloo 2: ExtraBold for `.heavy` and `.black`, Bold otherwise. 47 /// A heading in Baloo 2: ExtraBold for `.heavy` and `.black`, Bold otherwise.
48 /// Scales with Dynamic Type like the text style nearest `size`.
30 static func heading(_ size: CGFloat, weight: Font.Weight = .bold) -> Font { 49 static func heading(_ size: CGFloat, weight: Font.Weight = .bold) -> Font {
31 .custom(weight == .heavy || weight == .black ? HeadingFont.extraBold : HeadingFont.bold, fixedSize: size) 50 .custom(weight == .heavy || weight == .black ? HeadingFont.extraBold : HeadingFont.bold,
51 size: size, relativeTo: HeadingFont.textStyle(for: size))
32 } 52 }
33} 53}
54
DayByDay/Home/CategoryHubView.swift +11 −4
@@ -9,6 +9,8 @@ import SwiftUI
9struct CategoryHubView: View { 9struct CategoryHubView: View {
10 let category: Category 10 let category: Category
11 11
12 @Environment(\.dynamicTypeSize) private var typeSize
13
12 var body: some View { 14 var body: some View {
13 ScrollView { 15 ScrollView {
14 VStack(spacing: 24) { 16 VStack(spacing: 24) {
@@ -22,7 +24,7 @@ struct CategoryHubView: View {
22 } 24 }
23 } 25 }
24 } 26 }
25 .padding(32) 27 .padding(typeSize.isAccessibilitySize ? 16 : 32)
26 .frame(maxWidth: 640) 28 .frame(maxWidth: 640)
27 .frame(maxWidth: .infinity) 29 .frame(maxWidth: .infinity)
28 } 30 }
@@ -31,7 +33,10 @@ struct CategoryHubView: View {
31 private func activity(_ title: String, systemImage: String, color: Color, 33 private func activity(_ title: String, systemImage: String, color: Color,
32 @ViewBuilder destination: @escaping () -> some View) -> some View { 34 @ViewBuilder destination: @escaping () -> some View) -> some View {
33 NavigationLink(destination: destination) { 35 NavigationLink(destination: destination) {
34 HStack(spacing: 20) { 36 // The symbol goes above the title at the accessibility text sizes.
37 let layout = typeSize.isAccessibilitySize
38 ? AnyLayout(VStackLayout(alignment: .leading, spacing: 8)) : AnyLayout(HStackLayout(spacing: 20))
39 layout {
35 Image(systemName: systemImage) 40 Image(systemName: systemImage)
36 .font(.system(size: 44)) 41 .font(.system(size: 44))
37 Text(title) 42 Text(title)
@@ -39,11 +44,13 @@ struct CategoryHubView: View {
39 Spacer(minLength: 0) 44 Spacer(minLength: 0)
40 } 45 }
41 .foregroundStyle(.white) 46 .foregroundStyle(.white)
42 .padding(.horizontal, 32) 47 .padding(.horizontal, typeSize.isAccessibilitySize ? 20 : 32)
43 .frame(height: 120) 48 .padding(.vertical, 16)
49 .frame(maxWidth: .infinity, minHeight: 120, alignment: .leading)
44 .background(RoundedRectangle(cornerRadius: 32, style: .continuous).fill(color)) 50 .background(RoundedRectangle(cornerRadius: 32, style: .continuous).fill(color))
45 } 51 }
46 .buttonStyle(.plain) 52 .buttonStyle(.plain)
53 .accessibilityIdentifier("activity:\(title)")
47 .simultaneousGesture(TapGesture().onEnded { SpeechSynthesizer.shared.speak(title) }) 54 .simultaneousGesture(TapGesture().onEnded { SpeechSynthesizer.shared.speak(title) })
48 } 55 }
49} 56}
DayByDay/Home/HomeView.swift +8 −7
@@ -8,13 +8,14 @@ import SwiftUI
8/// Today banner on top, then the topic grid. 8/// Today banner on top, then the topic grid.
9struct HomeView: View { 9struct HomeView: View {
10 @Environment(ProfileSession.self) private var session 10 @Environment(ProfileSession.self) private var session
11 @Environment(\.dynamicTypeSize) private var typeSize
11 @AppStorage("hasSeenVoiceTip") private var hasSeenVoiceTip = false 12 @AppStorage("hasSeenVoiceTip") private var hasSeenVoiceTip = false
12 @State private var showingParentArea = false 13 @State private var showingParentArea = false
13 14
14 private let columns = [ 15 /// Two square tiles a row; one wide tile at the accessibility text sizes.
15 GridItem(.flexible(), spacing: 24), 16 private var columns: [GridItem] {
16 GridItem(.flexible(), spacing: 24) 17 Array(repeating: GridItem(.flexible(), spacing: 24), count: typeSize.isAccessibilitySize ? 1 : 2)
17 ] 18 }
18 19
19 var body: some View { 20 var body: some View {
20 NavigationStack { 21 NavigationStack {
@@ -31,7 +32,7 @@ struct HomeView: View {
31 ForEach(Category.gridCases) { category in 32 ForEach(Category.gridCases) { category in
32 NavigationLink(value: category) { 33 NavigationLink(value: category) {
33 CategoryTile(category: category) 34 CategoryTile(category: category)
34 .aspectRatio(1, contentMode: .fit) 35 .aspectRatio(typeSize.isAccessibilitySize ? 2 : 1, contentMode: .fit)
35 } 36 }
36 .buttonStyle(.plain) 37 .buttonStyle(.plain)
37 } 38 }
@@ -82,8 +83,8 @@ struct HomeView: View {
82 private func footerButton(_ title: String, systemImage: String, action: @escaping () -> Void) -> some View { 83 private func footerButton(_ title: String, systemImage: String, action: @escaping () -> Void) -> some View {
83 Button(action: action) { 84 Button(action: action) {
84 Label(title, systemImage: systemImage) 85 Label(title, systemImage: systemImage)
85 .font(.system(size: 16, weight: .medium, design: .rounded)) 86 .font(.system(.callout, design: .rounded, weight: .medium))
86 .foregroundStyle(.secondary) 87 .foregroundStyle(.primary)
87 .frame(maxWidth: .infinity) 88 .frame(maxWidth: .infinity)
88 .padding(.vertical, 14) 89 .padding(.vertical, 14)
89 .background(Color(.systemGray6)) 90 .background(Color(.systemGray6))
DayByDay/Home/TodayBanner.swift +7 −4
@@ -8,13 +8,17 @@ import SwiftUI
8/// The mascot and today's day and date, at the top of home. 8/// The mascot and today's day and date, at the top of home.
9struct TodayBanner: View { 9struct TodayBanner: View {
10 @Environment(ProfileSession.self) private var session 10 @Environment(ProfileSession.self) private var session
11 @Environment(\.dynamicTypeSize) private var typeSize
11 /// Today's sticker, read when home appears. 12 /// Today's sticker, read when home appears.
12 @State private var sticker: LearnWeather? 13 @State private var sticker: LearnWeather?
13 14
14 static let gradientColors: [Color] = [Color(red: 0.84, green: 0.40, blue: 0.05), Color(red: 0.80, green: 0.45, blue: 0.0)] 15 static let gradientColors: [Color] = [Color(red: 0.84, green: 0.40, blue: 0.05), Color(red: 0.80, green: 0.45, blue: 0.0)]
15 16
16 var body: some View { 17 var body: some View {
17 HStack(spacing: 20) { 18 // The mascot goes above the words at the accessibility text sizes.
19 let layout = typeSize.isAccessibilitySize
20 ? AnyLayout(VStackLayout(alignment: .leading, spacing: 16)) : AnyLayout(HStackLayout(spacing: 20))
21 return layout {
18 // On white: the orange is too close to the owl's purple. 22 // On white: the orange is too close to the owl's purple.
19 MascotView(mood: .idle) 23 MascotView(mood: .idle)
20 .padding(8) 24 .padding(8)
@@ -24,13 +28,12 @@ struct TodayBanner: View {
24 Text("Today is \(DayOfWeek.current.name)!") 28 Text("Today is \(DayOfWeek.current.name)!")
25 .font(.heading(30, weight: .heavy)) 29 .font(.heading(30, weight: .heavy))
26 Text(Date.now.formatted(.dateTime.month(.wide).day())) 30 Text(Date.now.formatted(.dateTime.month(.wide).day()))
27 .font(.system(size: 22, weight: .semibold, design: .rounded)) 31 .font(.system(.title2, design: .rounded, weight: .bold))
28 .opacity(0.9)
29 if let sticker { 32 if let sticker {
30 StickerBadge(weather: sticker).frame(width: 56, height: 56) 33 StickerBadge(weather: sticker).frame(width: 56, height: 56)
31 } else { 34 } else {
32 Text("Tap for your sticker!") 35 Text("Tap for your sticker!")
33 .font(.heading(18)) 36 .font(.heading(20))
34 } 37 }
35 } 38 }
36 .foregroundStyle(.white) 39 .foregroundStyle(.white)
DayByDay/Mascot/MascotView.swift +1 −1
@@ -98,7 +98,7 @@ private struct OwlDrawing {
98 beakShape(&context) 98 beakShape(&context)
99 99
100 if mood == .puzzled { 100 if mood == .puzzled {
101 let mark = context.resolve(Text("?").font(.heading(24, weight: .heavy)) 101 let mark = context.resolve(Text("?").font(.custom(HeadingFont.extraBold, fixedSize: 24))
102 .foregroundStyle(MascotStyle.body)) 102 .foregroundStyle(MascotStyle.body))
103 context.draw(mark, at: CGPoint(x: 89, y: 22)) 103 context.draw(mark, at: CGPoint(x: 89, y: 22))
104 } 104 }
DayByDay/MonthCard.swift +12 −9
@@ -21,8 +21,10 @@ struct MonthCard: View {
21 var body: some View { 21 var body: some View {
22 ZStack { 22 ZStack {
23 RoundedRectangle(cornerRadius: 32, style: .continuous) 23 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(month.color.gradient) 24 .fill(month.color)
25 .shadow(color: month.color.opacity(0.4), radius: 8, y: 4) 25 .shadow(color: month.color.opacity(0.4), radius: 8, y: 4)
26 // Glow on the card only: on the label it would lower the contrast.
27 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
26 28
27 VStack(spacing: 16) { 29 VStack(spacing: 16) {
28 Image(systemName: month.symbol) 30 Image(systemName: month.symbol)
@@ -34,6 +36,7 @@ struct MonthCard: View {
34 .font(.heading(32)) 36 .font(.heading(32))
35 .foregroundStyle(.white) 37 .foregroundStyle(.white)
36 } 38 }
39 .padding(16)
37 } 40 }
38 .overlay { 41 .overlay {
39 if isHighlighted { 42 if isHighlighted {
@@ -41,7 +44,6 @@ struct MonthCard: View {
41 .strokeBorder(.white, lineWidth: 5) 44 .strokeBorder(.white, lineWidth: 5)
42 } 45 }
43 } 46 }
44 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
45 .scaleEffect(cardScale) 47 .scaleEffect(cardScale)
46 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 48 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
47 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) 49 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -53,6 +55,7 @@ struct MonthCard: View {
53 isTapped = false 55 isTapped = false
54 } 56 }
55 } 57 }
58 .accessibilityElement(children: .ignore)
56 .accessibilityLabel(month.name) 59 .accessibilityLabel(month.name)
57 .accessibilityAddTraits(.isButton) 60 .accessibilityAddTraits(.isButton)
58 } 61 }
@@ -109,16 +112,16 @@ nonisolated enum MonthOfYear: Int, CaseIterable, Identifiable {
109 112
110 var color: Color { 113 var color: Color {
111 switch self { 114 switch self {
112 case .january: Color(red: 0.55, green: 0.75, blue: 0.95) // ice blue 115 case .january: Color(red: 0.42, green: 0.56, blue: 0.72) // ice blue
113 case .february: Color(red: 0.9, green: 0.35, blue: 0.5) // pink 116 case .february: Color(red: 0.9, green: 0.35, blue: 0.5) // pink
114 case .march: Color(red: 0.45, green: 0.8, blue: 0.55) // spring green 117 case .march: Color(red: 0.35, green: 0.6, blue: 0.41) // spring green
115 case .april: Color(red: 0.5, green: 0.65, blue: 0.9) // rain blue 118 case .april: Color(red: 0.43, green: 0.55, blue: 0.77) // rain blue
116 case .may: Color(red: 0.95, green: 0.7, blue: 0.2) // golden 119 case .may: Color(red: 0.71, green: 0.52, blue: 0.15) // golden
117 case .june: Color(red: 1.0, green: 0.55, blue: 0.25) // warm orange 120 case .june: Color(red: 0.83, green: 0.45, blue: 0.2) // warm orange
118 case .july: Color(red: 0.85, green: 0.25, blue: 0.3) // red 121 case .july: Color(red: 0.85, green: 0.25, blue: 0.3) // red
119 case .august: Color(red: 0.2, green: 0.75, blue: 0.8) // ocean teal 122 case .august: Color(red: 0.16, green: 0.6, blue: 0.64) // ocean teal
120 case .september: Color(red: 0.6, green: 0.45, blue: 0.85) // purple 123 case .september: Color(red: 0.6, green: 0.45, blue: 0.85) // purple
121 case .october: Color(red: 0.9, green: 0.5, blue: 0.15) // pumpkin 124 case .october: Color(red: 0.82, green: 0.46, blue: 0.14) // pumpkin
122 case .november: Color(red: 0.7, green: 0.5, blue: 0.3) // brown 125 case .november: Color(red: 0.7, green: 0.5, blue: 0.3) // brown
123 case .december: Color(red: 0.3, green: 0.5, blue: 0.85) // winter blue 126 case .december: Color(red: 0.3, green: 0.5, blue: 0.85) // winter blue
124 } 127 }
DayByDay/MonthsOfYearView.swift +1 −1
@@ -17,7 +17,7 @@ struct MonthsOfYearView: View {
17 LazyVGrid(columns: columns, spacing: 24) { 17 LazyVGrid(columns: columns, spacing: 24) {
18 ForEach(MonthOfYear.allCases) { month in 18 ForEach(MonthOfYear.allCases) { month in
19 MonthCard(month: month, isHighlighted: month == .current) 19 MonthCard(month: month, isHighlighted: month == .current)
20 .frame(height: 200) 20 .frame(minHeight: 200)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
DayByDay/Parent/ChildProgressView.swift +1 −1
@@ -26,7 +26,7 @@ struct ChildProgressView: View {
26 .background(Circle().fill(category.color)) 26 .background(Circle().fill(category.color))
27 VStack(alignment: .leading, spacing: 4) { 27 VStack(alignment: .leading, spacing: 4) {
28 Text(category.label) 28 Text(category.label)
29 .font(.system(size: 20, weight: .semibold, design: .rounded)) 29 .font(.system(.title3, design: .rounded, weight: .semibold))
30 if let known = summary.known { 30 if let known = summary.known {
31 Text(known) 31 Text(known)
32 } 32 }
DayByDay/Parent/ParentAreaView.swift +6 −2
@@ -30,7 +30,11 @@ struct ParentAreaView: View {
30 NavigationLink { 30 NavigationLink {
31 ProfileEditorView(profile: nil) 31 ProfileEditorView(profile: nil)
32 } label: { 32 } label: {
33 Label("Add a child", systemImage: "plus.circle.fill") 33 HStack(spacing: 14) {
34 Image(systemName: "plus.circle.fill")
35 .foregroundStyle(Color.accentColor)
36 Text("Add a child")
37 }
34 } 38 }
35 } 39 }
36 if !session.profiles.isEmpty { 40 if !session.profiles.isEmpty {
@@ -78,7 +82,7 @@ private struct ProfileRow: View {
78 AvatarBadge(avatar: profile.avatar, color: profile.color) 82 AvatarBadge(avatar: profile.avatar, color: profile.color)
79 .frame(width: 44, height: 44) 83 .frame(width: 44, height: 44)
80 Text(profile.name) 84 Text(profile.name)
81 .font(.system(size: 20, weight: .semibold, design: .rounded)) 85 .font(.system(.title3, design: .rounded, weight: .semibold))
82 } 86 }
83 } 87 }
84} 88}
DayByDay/Parent/ParentGateView.swift +26 −18
@@ -22,22 +22,25 @@ struct ParentGateView: View {
22 } 22 }
23 23
24 var body: some View { 24 var body: some View {
25 VStack(spacing: 32) { 25 CenteredScrollView {
26 Text("For Grown-Ups") 26 VStack(spacing: 32) {
27 .font(.system(size: 32, weight: .bold, design: .rounded)) 27 Text("For Grown-Ups")
28 .font(.system(.largeTitle, design: .rounded, weight: .bold))
28 29
29 if held { 30 if held {
30 sumStep 31 sumStep
31 } else { 32 } else {
32 holdStep 33 holdStep
33 } 34 }
34 35
35 Button("Cancel", action: onCancel) 36 Button("Cancel", action: onCancel)
36 .font(.system(size: 18, weight: .medium, design: .rounded)) 37 .font(.system(.body, design: .rounded, weight: .medium))
37 .foregroundStyle(.secondary) 38 .foregroundStyle(.primary)
39 }
40 .padding(40)
41 .frame(maxWidth: 520)
42 .multilineTextAlignment(.center)
38 } 43 }
39 .padding(40)
40 .frame(maxWidth: 520)
41 } 44 }
42 45
43 private var holdStep: some View { 46 private var holdStep: some View {
@@ -67,28 +70,33 @@ struct ParentGateView: View {
67 } 70 }
68 .accessibilityLabel("Hold for grown-ups") 71 .accessibilityLabel("Hold for grown-ups")
69 .accessibilityAddTraits(.isButton) 72 .accessibilityAddTraits(.isButton)
73 // Assistive technologies skip the hold; the sum still keeps children out.
74 .accessibilityAction {
75 held = true
76 fieldFocused = true
77 }
70 78
71 Text("Press and hold") 79 Text("Press and hold")
72 .font(.system(size: 18, design: .rounded)) 80 .font(.system(.body, design: .rounded))
73 .foregroundStyle(.secondary) 81 .fixedSize(horizontal: false, vertical: true)
74 } 82 }
75 } 83 }
76 84
77 private var sumStep: some View { 85 private var sumStep: some View {
78 VStack(spacing: 20) { 86 VStack(spacing: 20) {
79 Text("What is \(challenge.a) + \(challenge.b)?") 87 Text("What is \(challenge.a) + \(challenge.b)?")
80 .font(.system(size: 26, weight: .semibold, design: .rounded)) 88 .font(.system(.title, design: .rounded, weight: .semibold))
81 TextField("Answer", text: $input) 89 TextField("Answer", text: $input)
82 .keyboardType(.numberPad) 90 .keyboardType(.numberPad)
83 .focused($fieldFocused) 91 .focused($fieldFocused)
84 .multilineTextAlignment(.center) 92 .multilineTextAlignment(.center)
85 .font(.system(size: 28, weight: .bold, design: .rounded)) 93 .font(.system(.title, design: .rounded, weight: .bold))
86 .padding(12) 94 .padding(12)
87 .frame(width: 160) 95 .frame(width: 160)
88 .background(Color(.systemGray6), in: RoundedRectangle(cornerRadius: 12)) 96 .background(Color(.systemGray6), in: RoundedRectangle(cornerRadius: 12))
89 Button("Continue", action: submit) 97 Button("Continue", action: submit)
90 .buttonStyle(.borderedProminent) 98 .buttonStyle(.borderedProminent)
91 .font(.system(size: 20, weight: .semibold, design: .rounded)) 99 .font(.system(.title3, design: .rounded, weight: .semibold))
92 } 100 }
93 } 101 }
94 102
DayByDay/Profiles/ProfilePickerView.swift +23 −17
@@ -37,10 +37,15 @@ struct ProfilePickerView: View {
37 .padding(32) 37 .padding(32)
38 } 38 }
39 .safeAreaInset(edge: .bottom) { 39 .safeAreaInset(edge: .bottom) {
40 Button("Grown-Ups") { showingParentArea = true } 40 Button { showingParentArea = true } label: {
41 .font(.system(size: 16, weight: .medium, design: .rounded)) 41 Text("Grown-Ups")
42 .foregroundStyle(.secondary) 42 .padding(.horizontal, 20)
43 .padding(.bottom, 12) 43 .frame(minHeight: 44)
44 .contentShape(Rectangle())
45 }
46 .font(.system(.callout, design: .rounded, weight: .medium))
47 .foregroundStyle(.primary)
48 .padding(.bottom, 4)
44 } 49 }
45 .onAppear { SpeechSynthesizer.shared.speak(Lines.whoIsPlaying) } 50 .onAppear { SpeechSynthesizer.shared.speak(Lines.whoIsPlaying) }
46 .sheet(isPresented: $showingParentArea) { 51 .sheet(isPresented: $showingParentArea) {
@@ -63,20 +68,21 @@ struct ProfileSetupView: View {
63 } 68 }
64 } 69 }
65 } else { 70 } else {
66 VStack(spacing: 24) { 71 CenteredScrollView {
67 MascotView(mood: .waving) 72 VStack(spacing: 24) {
68 .frame(width: 160, height: 160) 73 MascotView(mood: .waving)
69 Text("Welcome to Day By Day") 74 .frame(width: 160, height: 160)
70 .font(.heading(32)) 75 Text("Welcome to Day By Day")
71 Text("Set up a profile for your child.") 76 .font(.heading(32))
72 .font(.system(size: 20, design: .rounded)) 77 Text("Set up a profile for your child.")
73 .foregroundStyle(.secondary) 78 .font(.system(.title3, design: .rounded))
74 Button("Get Started") { started = true } 79 Button("Get Started") { started = true }
75 .buttonStyle(.borderedProminent) 80 .buttonStyle(.borderedProminent)
76 .font(.system(size: 22, weight: .semibold, design: .rounded)) 81 .font(.system(.title2, design: .rounded, weight: .semibold))
82 }
83 .padding(40)
84 .multilineTextAlignment(.center)
77 } 85 }
78 .padding(40)
79 .multilineTextAlignment(.center)
80 } 86 }
81 } 87 }
82} 88}
DayByDay/Quiz/ChoiceTile.swift +1 −3
@@ -101,9 +101,7 @@ struct ChoiceTile: View {
101 .font(.system(size: 52)) 101 .font(.system(size: 52))
102 .frame(height: 60) 102 .frame(height: 60)
103 Text(item.name) 103 Text(item.name)
104 .font(.heading(26)) 104 .font(.heading(22))
105 .lineLimit(1)
106 .minimumScaleFactor(0.6)
107 } 105 }
108 .foregroundStyle(.white) 106 .foregroundStyle(.white)
109 } 107 }
DayByDay/Quiz/ClothingTile.swift +1 −3
@@ -16,9 +16,7 @@ struct ClothingTile: View {
16 .font(.system(size: 56)) 16 .font(.system(size: 56))
17 .frame(height: 64) 17 .frame(height: 64)
18 Text(item.name) 18 Text(item.name)
19 .font(.heading(24)) 19 .font(.heading(22))
20 .lineLimit(1)
21 .minimumScaleFactor(0.6)
22 } 20 }
23 .foregroundStyle(.white) 21 .foregroundStyle(.white)
24 .frame(maxWidth: .infinity, maxHeight: .infinity) 22 .frame(maxWidth: .infinity, maxHeight: .infinity)
DayByDay/Quiz/CountingView.swift +6 −13
@@ -14,6 +14,8 @@ struct CountingView: View {
14 @State private var speechToken = 0 14 @State private var speechToken = 0
15 /// Bumped when the screen goes away, so pending work says nothing. 15 /// Bumped when the screen goes away, so pending work says nothing.
16 @State private var generation = 0 16 @State private var generation = 0
17 @ScaledMetric(relativeTo: .largeTitle) private var totalHeight = 110
18 @ScaledMetric(relativeTo: .largeTitle) private var objectHeight = 104
17 19
18 private let columns = [GridItem(.adaptive(minimum: 96, maximum: 140), spacing: 16)] 20 private let columns = [GridItem(.adaptive(minimum: 96, maximum: 140), spacing: 16)]
19 private let color = Category.numbers.color 21 private let color = Category.numbers.color
@@ -48,22 +50,12 @@ struct CountingView: View {
48 private var board: some View { 50 private var board: some View {
49 ScrollView { 51 ScrollView {
50 VStack(spacing: 28) { 52 VStack(spacing: 28) {
51 HStack(spacing: 12) { 53 PromptBar(mascot: $mascot, prompt: prompt) { ask(after: 0) }
52 GameMascot(state: $mascot)
53 Button { ask(after: 0) } label: {
54 Label("Hear it again", systemImage: "speaker.wave.2.fill")
55 .font(.heading(24))
56 .padding(.horizontal, 28)
57 .padding(.vertical, 16)
58 .background(Capsule().fill(Color(.systemGray6)))
59 }
60 .buttonStyle(.plain)
61 }
62 54
63 Text(showTotal ? "\(round.target)" : " ") 55 Text(showTotal ? "\(round.target)" : " ")
64 .font(.heading(96, weight: .heavy)) 56 .font(.heading(96, weight: .heavy))
65 .foregroundStyle(color) 57 .foregroundStyle(color)
66 .frame(height: 110) 58 .frame(height: totalHeight)
67 .accessibilityHidden(!showTotal) 59 .accessibilityHidden(!showTotal)
68 60
69 LazyVGrid(columns: columns, spacing: 16) { 61 LazyVGrid(columns: columns, spacing: 16) {
@@ -71,6 +63,7 @@ struct CountingView: View {
71 Button { tap(i) } label: { object(i) } 63 Button { tap(i) } label: { object(i) }
72 .buttonStyle(.plain) 64 .buttonStyle(.plain)
73 .accessibilityLabel(round.thing.singular) 65 .accessibilityLabel(round.thing.singular)
66 .accessibilityValue(round.counted.firstIndex(of: i).map { "\($0 + 1)" } ?? "")
74 } 67 }
75 } 68 }
76 } 69 }
@@ -98,7 +91,7 @@ struct CountingView: View {
98 .foregroundStyle(color) 91 .foregroundStyle(color)
99 } 92 }
100 } 93 }
101 .frame(height: 104) 94 .frame(height: objectHeight)
102 .contentShape(shape) 95 .contentShape(shape)
103 } 96 }
104 97
DayByDay/Quiz/FinishedView.swift +16 −14
@@ -12,22 +12,24 @@ struct FinishedView: View {
12 @State private var speechToken = 0 12 @State private var speechToken = 0
13 13
14 var body: some View { 14 var body: some View {
15 VStack(spacing: 28) { 15 CenteredScrollView {
16 MascotView(mood: .cheering) 16 VStack(spacing: 28) {
17 .frame(width: 180, height: 180) 17 MascotView(mood: .cheering)
18 Text("You did it!") 18 .frame(width: 180, height: 180)
19 .font(.heading(48, weight: .heavy)) 19 Text("You did it!")
20 Button(action: onPlayAgain) { 20 .font(.heading(48, weight: .heavy))
21 Label("Play again", systemImage: "arrow.clockwise") 21 Button(action: onPlayAgain) {
22 .font(.heading(28)) 22 Label("Play again", systemImage: "arrow.clockwise")
23 .foregroundStyle(.white) 23 .font(.heading(28))
24 .padding(.horizontal, 40) 24 .foregroundStyle(.white)
25 .padding(.vertical, 20) 25 .padding(.horizontal, 40)
26 .background(Capsule().fill(RoundStyle.playAgainFill)) 26 .padding(.vertical, 20)
27 .background(Capsule().fill(RoundStyle.playAgainFill))
28 }
29 .buttonStyle(.plain)
27 } 30 }
28 .buttonStyle(.plain) 31 .padding(32)
29 } 32 }
30 .padding(32)
31 .onAppear { 33 .onAppear {
32 SoundEngine.shared.play(.roundComplete) 34 SoundEngine.shared.play(.roundComplete)
33 speechToken += 1 35 speechToken += 1
DayByDay/Quiz/MovesView.swift +13 −21
@@ -25,29 +25,21 @@ struct MovesView: View {
25 var body: some View { 25 var body: some View {
26 ZStack { 26 ZStack {
27 if let part = round.current { 27 if let part = round.current {
28 VStack(spacing: 32) { 28 CenteredScrollView {
29 HStack(spacing: 12) { 29 VStack(spacing: 32) {
30 GameMascot(state: $mascot) 30 PromptBar(mascot: $mascot) { start() }
31 Button { start() } label: { 31 Image(systemName: part.symbol)
32 Label("Hear it again", systemImage: "speaker.wave.2.fill") 32 .font(.system(size: 140))
33 .font(.heading(24)) 33 .foregroundStyle(.white)
34 .padding(.horizontal, 28) 34 .frame(width: 240, height: 240)
35 .padding(.vertical, 16) 35 .background(RoundedRectangle(cornerRadius: 40, style: .continuous).fill(Category.bodyParts.color))
36 .background(Capsule().fill(Color(.systemGray6))) 36 .accessibilityLabel(part.name)
37 } 37 Text(part.command)
38 .buttonStyle(.plain) 38 .font(.heading(30, weight: .heavy))
39 .multilineTextAlignment(.center)
39 } 40 }
40 Image(systemName: part.symbol) 41 .padding(24)
41 .font(.system(size: 140))
42 .foregroundStyle(.white)
43 .frame(width: 240, height: 240)
44 .background(RoundedRectangle(cornerRadius: 40, style: .continuous).fill(Category.bodyParts.color))
45 .accessibilityLabel(part.name)
46 Text(part.command)
47 .font(.heading(30, weight: .heavy))
48 .multilineTextAlignment(.center)
49 } 42 }
50 .padding(24)
51 .overlay { CelebrationOverlay(isActive: celebrating) } 43 .overlay { CelebrationOverlay(isActive: celebrating) }
52 } else { 44 } else {
53 FinishedView { 45 FinishedView {
DayByDay/Quiz/PromptBar.swift added +40
@@ -0,0 +1,40 @@
1//
2// PromptBar.swift
3// DayByDay
4//
5
6import SwiftUI
7
8/// A game's mascot and "Hear it again", which repeats the spoken prompt.
9/// VoiceOver also reads the prompt as the button's value.
10struct PromptBar: View {
11 @Binding var mascot: MascotState
12 var prompt: String?
13 let action: () -> Void
14
15 @Environment(\.dynamicTypeSize) private var typeSize
16
17 var body: some View {
18 // The mascot goes above the button at the accessibility text sizes.
19 let layout = typeSize.isAccessibilitySize ? AnyLayout(VStackLayout(spacing: 12)) : AnyLayout(HStackLayout(spacing: 12))
20 layout {
21 GameMascot(state: $mascot)
22 Button(action: action) {
23 Label {
24 // Room for Baloo's tall glyphs inside the text's own frame.
25 Text("Hear it again").padding(.vertical, 4)
26 } icon: {
27 Image(systemName: "speaker.wave.2.fill")
28 }
29 .font(.heading(24))
30 .fixedSize(horizontal: false, vertical: true)
31 .padding(.horizontal, 28)
32 .padding(.vertical, 12)
33 .frame(maxWidth: typeSize.isAccessibilitySize ? .infinity : nil)
34 .background(RoundedRectangle(cornerRadius: 30, style: .continuous).fill(Color(.systemGray6)))
35 }
36 .buttonStyle(.plain)
37 .accessibilityValue(prompt ?? "")
38 }
39 }
40}
DayByDay/Quiz/RoundView.swift +7 −15
@@ -18,6 +18,8 @@ struct RoundView<Choice: View>: View {
18 private let choice: (QuizItem) -> Choice 18 private let choice: (QuizItem) -> Choice
19 19
20 @Environment(ProfileSession.self) private var session 20 @Environment(ProfileSession.self) private var session
21 /// Choices get wider as the text on them grows.
22 @ScaledMetric(relativeTo: .title2) private var choiceWidth: CGFloat = 150
21 @State private var round: Round 23 @State private var round: Round
22 @State private var praise = PraisePhrases() 24 @State private var praise = PraisePhrases()
23 @State private var celebrating = false 25 @State private var celebrating = false
@@ -27,7 +29,9 @@ struct RoundView<Choice: View>: View {
27 /// been overtaken stays quiet. 29 /// been overtaken stays quiet.
28 @State private var speechToken = 0 30 @State private var speechToken = 0
29 31
30 private let columns = [GridItem(.adaptive(minimum: 150, maximum: 320), spacing: 20)] 32 private var columns: [GridItem] {
33 [GridItem(.adaptive(minimum: choiceWidth, maximum: max(choiceWidth, 320)), spacing: 20)]
34 }
31 35
32 init(source: any QuestionSource, game: Game, @ViewBuilder choice: @escaping (QuizItem) -> Choice) { 36 init(source: any QuestionSource, game: Game, @ViewBuilder choice: @escaping (QuizItem) -> Choice) {
33 self.source = source 37 self.source = source
@@ -55,19 +59,7 @@ struct RoundView<Choice: View>: View {
55 private var question: some View { 59 private var question: some View {
56 ScrollView { 60 ScrollView {
57 VStack(spacing: 28) { 61 VStack(spacing: 28) {
58 HStack(spacing: 12) { 62 PromptBar(mascot: $mascot, prompt: round.current.prompt, action: speakPrompt)
59 GameMascot(state: $mascot)
60 Button(action: speakPrompt) {
61 Label("Hear it again", systemImage: "speaker.wave.2.fill")
62 .font(.heading(24))
63 .lineLimit(1)
64 .minimumScaleFactor(0.7)
65 .padding(.horizontal, 28)
66 .padding(.vertical, 16)
67 .background(Capsule().fill(Color(.systemGray6)))
68 }
69 .buttonStyle(.plain)
70 }
71 63
72 ProgressDots(filled: round.correctCount, total: Round.length) 64 ProgressDots(filled: round.correctCount, total: Round.length)
73 65
@@ -79,7 +71,7 @@ struct RoundView<Choice: View>: View {
79 ForEach(round.current.choices) { item in 71 ForEach(round.current.choices) { item in
80 Button { tap(item) } label: { 72 Button { tap(item) } label: {
81 choice(item) 73 choice(item)
82 .frame(height: 160) 74 .frame(minHeight: 160)
83 .opacity(dimmed == item ? 0.4 : 1) 75 .opacity(dimmed == item ? 0.4 : 1)
84 } 76 }
85 .buttonStyle(.plain) 77 .buttonStyle(.plain)
DayByDay/Quiz/SequencePuzzleView.swift +36 −37
@@ -12,6 +12,8 @@ struct SequencePuzzleView: View {
12 let make: () -> SequencePuzzle 12 let make: () -> SequencePuzzle
13 13
14 @Environment(ProfileSession.self) private var session 14 @Environment(ProfileSession.self) private var session
15 /// Cards and train cars grow with the text on the labeled cards.
16 @ScaledMetric(relativeTo: .title2) private var card: CGFloat = 140
15 @State private var puzzle: SequencePuzzle 17 @State private var puzzle: SequencePuzzle
16 @State private var praise = PraisePhrases() 18 @State private var praise = PraisePhrases()
17 @State private var dimmed: QuizItem? 19 @State private var dimmed: QuizItem?
@@ -24,7 +26,7 @@ struct SequencePuzzleView: View {
24 /// Counts finished games, so a timer from an earlier game is ignored. 26 /// Counts finished games, so a timer from an earlier game is ignored.
25 @State private var solves = 0 27 @State private var solves = 0
26 28
27 private let columns = [GridItem(.adaptive(minimum: 130, maximum: 220), spacing: 16)] 29 private var columns: [GridItem] { [GridItem(.adaptive(minimum: card, maximum: max(card, 220)), spacing: 16)] }
28 30
29 init(game: Game, make: @escaping () -> SequencePuzzle) { 31 init(game: Game, make: @escaping () -> SequencePuzzle) {
30 self.game = game 32 self.game = game
@@ -55,17 +57,7 @@ struct SequencePuzzleView: View {
55 private var board: some View { 57 private var board: some View {
56 ScrollView { 58 ScrollView {
57 VStack(spacing: 28) { 59 VStack(spacing: 28) {
58 HStack(spacing: 12) { 60 PromptBar(mascot: $mascot, prompt: puzzle.current?.prompt) { ask(after: 0) }
59 GameMascot(state: $mascot)
60 Button { ask(after: 0) } label: {
61 Label("Hear it again", systemImage: "speaker.wave.2.fill")
62 .font(.heading(24))
63 .padding(.horizontal, 28)
64 .padding(.vertical, 16)
65 .background(Capsule().fill(Color(.systemGray6)))
66 }
67 .buttonStyle(.plain)
68 }
69 61
70 slots 62 slots
71 .dropDestination(for: String.self) { ids, _ in 63 .dropDestination(for: String.self) { ids, _ in
@@ -80,14 +72,14 @@ struct SequencePuzzleView: View {
80 let isPlaced = puzzle.placed.contains(item) 72 let isPlaced = puzzle.placed.contains(item)
81 Button { place(item) } label: { 73 Button { place(item) } label: {
82 ChoiceTile(item: item) 74 ChoiceTile(item: item)
83 .frame(height: 130) 75 .frame(height: card)
84 .opacity(isPlaced ? 0 : dimmed == item ? 0.4 : 1) 76 .opacity(isPlaced ? 0 : dimmed == item ? 0.4 : 1)
85 } 77 }
86 .buttonStyle(.plain) 78 .buttonStyle(.plain)
87 .disabled(isPlaced) 79 .disabled(isPlaced)
88 .accessibilityHidden(isPlaced) 80 .accessibilityHidden(isPlaced)
89 .draggable(item.id) { 81 .draggable(item.id) {
90 ChoiceTile(item: item).frame(width: 130, height: 130) 82 ChoiceTile(item: item).frame(width: card, height: card)
91 } 83 }
92 .accessibilityLabel(item.name) 84 .accessibilityLabel(item.name)
93 } 85 }
@@ -101,27 +93,20 @@ struct SequencePuzzleView: View {
101 @ViewBuilder 93 @ViewBuilder
102 private var slots: some View { 94 private var slots: some View {
103 if let labels = puzzle.slotLabels { 95 if let labels = puzzle.slotLabels {
104 HStack(alignment: .top, spacing: 12) { 96 // Stacked when the labels no longer fit side by side.
105 ForEach(Array(labels.enumerated()), id: \.offset) { i, label in 97 ViewThatFits(in: .horizontal) {
106 VStack(spacing: 8) { 98 HStack(alignment: .top, spacing: 12) { labeledSlots(labels) }
107 Text(label) 99 VStack(spacing: 16) { labeledSlots(labels) }
108 .font(.heading(20))
109 .lineLimit(1)
110 .minimumScaleFactor(0.6)
111 slot(i).frame(height: 130)
112 }
113 .frame(maxWidth: .infinity)
114 }
115 } 100 }
116 } else { 101 } else {
117 ScrollViewReader { proxy in 102 ScrollViewReader { proxy in
118 ScrollView(.horizontal, showsIndicators: false) { 103 ScrollView(.horizontal, showsIndicators: false) {
119 HStack(alignment: .bottom, spacing: 6) { 104 HStack(alignment: .bottom, spacing: 6) {
120 TrainEngine() 105 TrainEngine()
121 .frame(width: 130, height: 150) 106 .frame(width: card, height: card * 15 / 14)
122 ForEach(puzzle.steps.indices, id: \.self) { i in 107 ForEach(puzzle.steps.indices, id: \.self) { i in
123 TrainCar { slot(i) } 108 TrainCar { slot(i) }
124 .frame(width: 130, height: 150) 109 .frame(width: card, height: card * 15 / 14)
125 .id(i) 110 .id(i)
126 } 111 }
127 } 112 }
@@ -138,22 +123,36 @@ struct SequencePuzzleView: View {
138 } 123 }
139 } 124 }
140 125
126 private func labeledSlots(_ labels: [String]) -> some View {
127 ForEach(Array(labels.enumerated()), id: \.offset) { i, label in
128 VStack(spacing: 8) {
129 Text(label)
130 .font(.heading(20))
131 slot(i).frame(height: card)
132 }
133 .frame(maxWidth: .infinity)
134 }
135 }
136
141 private var nextCar: Int { min(puzzle.placed.count, puzzle.steps.count - 1) } 137 private var nextCar: Int { min(puzzle.placed.count, puzzle.steps.count - 1) }
142 138
143 /// A placed card, the outlined next slot, or a faint empty slot. 139 /// A placed card, the outlined next slot, or a faint empty slot.
144 @ViewBuilder
145 private func slot(_ i: Int) -> some View { 140 private func slot(_ i: Int) -> some View {
146 let shape = RoundedRectangle(cornerRadius: 24, style: .continuous) 141 let shape = RoundedRectangle(cornerRadius: 24, style: .continuous)
147 if i < puzzle.placed.count { 142 return Group {
148 ChoiceTile(item: puzzle.placed[i]) 143 if i < puzzle.placed.count {
149 } else { 144 ChoiceTile(item: puzzle.placed[i])
150 shape 145 } else {
151 .fill(Color(.systemGray6)) 146 shape
152 .overlay { 147 .fill(Color(.systemGray6))
153 shape.strokeBorder(i == puzzle.placed.count ? Category.days.color : Color(.systemGray3), 148 .overlay {
154 style: StrokeStyle(lineWidth: i == puzzle.placed.count ? 5 : 2, dash: [10, 8])) 149 shape.strokeBorder(i == puzzle.placed.count ? Category.days.color : Color(.systemGray3),
155 } 150 style: StrokeStyle(lineWidth: i == puzzle.placed.count ? 5 : 2, dash: [10, 8]))
151 }
152 }
156 } 153 }
154 .accessibilityElement(children: .ignore)
155 .accessibilityLabel(i < puzzle.placed.count ? puzzle.placed[i].name : "Empty")
157 } 156 }
158 157
159 private func place(_ item: QuizItem) { 158 private func place(_ item: QuizItem) {
DayByDay/Quiz/SortView.swift +6 −12
@@ -13,6 +13,7 @@ enum SortStyle {
13/// "Fruit or vegetable?": tap a bin, or drag the food into it. 13/// "Fruit or vegetable?": tap a bin, or drag the food into it.
14struct SortView: View { 14struct SortView: View {
15 @Environment(ProfileSession.self) private var session 15 @Environment(ProfileSession.self) private var session
16 @Environment(\.dynamicTypeSize) private var typeSize
16 @State private var round: SortRound 17 @State private var round: SortRound
17 @State private var praise = PraisePhrases() 18 @State private var praise = PraisePhrases()
18 @State private var celebrating = false 19 @State private var celebrating = false
@@ -54,17 +55,7 @@ struct SortView: View {
54 private var board: some View { 55 private var board: some View {
55 ScrollView { 56 ScrollView {
56 VStack(spacing: 28) { 57 VStack(spacing: 28) {
57 HStack(spacing: 12) { 58 PromptBar(mascot: $mascot, prompt: round.prompt) { ask(after: 0) }
58 GameMascot(state: $mascot)
59 Button { ask(after: 0) } label: {
60 Label("Hear it again", systemImage: "speaker.wave.2.fill")
61 .font(.heading(24))
62 .padding(.horizontal, 28)
63 .padding(.vertical, 16)
64 .background(Capsule().fill(Color(.systemGray6)))
65 }
66 .buttonStyle(.plain)
67 }
68 59
69 if let food = round.current { 60 if let food = round.current {
70 let item = Category.food.item(food) 61 let item = Category.food.item(food)
@@ -75,7 +66,9 @@ struct SortView: View {
75 .accessibilityLabel(food.name) 66 .accessibilityLabel(food.name)
76 } 67 }
77 68
78 HStack(spacing: 20) { 69 // Stacked at the accessibility text sizes, so "Vegetables" fits.
70 let bins = typeSize.isAccessibilitySize ? AnyLayout(VStackLayout(spacing: 20)) : AnyLayout(HStackLayout(spacing: 20))
71 bins {
79 bin(isFruit: true) 72 bin(isFruit: true)
80 bin(isFruit: false) 73 bin(isFruit: false)
81 } 74 }
@@ -107,6 +100,7 @@ struct SortView: View {
107 return true 100 return true
108 } 101 }
109 .accessibilityLabel(isFruit ? "Fruit" : "Vegetables") 102 .accessibilityLabel(isFruit ? "Fruit" : "Vegetables")
103 .accessibilityValue(contents.map(\.name).joined(separator: ", "))
110 } 104 }
111 105
112 private func place(isFruit: Bool) { 106 private func place(isFruit: Bool) {
DayByDay/Quiz/TraceView.swift +38 −23
@@ -60,9 +60,10 @@ struct TraceView: View {
60 VStack(spacing: 20) { 60 VStack(spacing: 20) {
61 // Own row: beside both pills it would squeeze their labels on a phone. 61 // Own row: beside both pills it would squeeze their labels on a phone.
62 GameMascot(state: $mascot) 62 GameMascot(state: $mascot)
63 HStack(spacing: 16) { 63 // Stacked when side by side would cut the labels off.
64 pill("Hear it again", "speaker.wave.2.fill", action: prompt) 64 ViewThatFits(in: .horizontal) {
65 pill("Start over", "eraser.fill") { strokes = [] } 65 HStack(spacing: 16) { pills }
66 VStack(spacing: 12) { pills }
66 } 67 }
67 GeometryReader { geo in 68 GeometryReader { geo in
68 let size = min(geo.size.width, geo.size.height) 69 let size = min(geo.size.width, geo.size.height)
@@ -88,7 +89,11 @@ struct TraceView: View {
88 .onEnded { _ in check(item, size: size) } 89 .onEnded { _ in check(item, size: size) }
89 ) 90 )
90 .frame(maxWidth: .infinity, maxHeight: .infinity) 91 .frame(maxWidth: .infinity, maxHeight: .infinity)
92 // VoiceOver, Voice Control and Switch Control users trace by activating the guide.
93 .accessibilityElement()
91 .accessibilityLabel("Trace \(Lines.traceLabel(item))") 94 .accessibilityLabel("Trace \(Lines.traceLabel(item))")
95 .accessibilityAddTraits(.isButton)
96 .accessibilityAction { succeed(item) }
92 } 97 }
93 .frame(maxWidth: 520) 98 .frame(maxWidth: 520)
94 } 99 }
@@ -96,15 +101,20 @@ struct TraceView: View {
96 .overlay { CelebrationOverlay(isActive: celebrating) } 101 .overlay { CelebrationOverlay(isActive: celebrating) }
97 } 102 }
98 103
104 @ViewBuilder
105 private var pills: some View {
106 pill("Hear it again", "speaker.wave.2.fill", action: prompt)
107 pill("Start over", "eraser.fill") { strokes = [] }
108 }
109
99 private func pill(_ title: String, _ symbol: String, action: @escaping () -> Void) -> some View { 110 private func pill(_ title: String, _ symbol: String, action: @escaping () -> Void) -> some View {
100 Button(action: action) { 111 Button(action: action) {
101 Label(title, systemImage: symbol) 112 Label(title, systemImage: symbol)
102 .font(.heading(19)) 113 .font(.heading(19))
103 .lineLimit(1) 114 .fixedSize(horizontal: false, vertical: true)
104 .minimumScaleFactor(0.7)
105 .padding(.horizontal, 20) 115 .padding(.horizontal, 20)
106 .padding(.vertical, 14) 116 .padding(.vertical, 14)
107 .background(Capsule().fill(Color(.systemGray6))) 117 .background(RoundedRectangle(cornerRadius: 26, style: .continuous).fill(Color(.systemGray6)))
108 } 118 }
109 .buttonStyle(.plain) 119 .buttonStyle(.plain)
110 } 120 }
@@ -115,23 +125,7 @@ struct TraceView: View {
115 let drawn = strokes.flatMap { $0 } 125 let drawn = strokes.flatMap { $0 }
116 let score = checker.score(drawn) 126 let score = checker.score(drawn)
117 if checker.passes(drawn) { 127 if checker.passes(drawn) {
118 record(item, correct: true) 128 succeed(item)
119 busy = true
120 celebrating = true
121 SoundEngine.shared.play(.success)
122 mascot.handle(.correct)
123 passes += 1
124 let gen = generation, pass = passes
125 let advance = {
126 guard gen == generation, pass == passes, busy else { return }
127 busy = false
128 celebrating = false
129 strokes = []
130 index += 1
131 if self.item != nil { prompt() }
132 }
133 say(Lines.traceSuccess(item), after: RoundStyle.speechDelay, then: advance)
134 DispatchQueue.main.asyncAfter(deadline: .now() + 8, execute: advance)
135 } else if score.accuracy < 0.5 && score.coverage > 0.4 { 129 } else if score.accuracy < 0.5 && score.coverage > 0.4 {
136 record(item, correct: false) 130 record(item, correct: false)
137 SoundEngine.shared.play(.gentleMiss) 131 SoundEngine.shared.play(.gentleMiss)
@@ -141,6 +135,27 @@ struct TraceView: View {
141 } 135 }
142 } 136 }
143 137
138 private func succeed(_ item: QuizItem) {
139 guard !busy else { return }
140 record(item, correct: true)
141 busy = true
142 celebrating = true
143 SoundEngine.shared.play(.success)
144 mascot.handle(.correct)
145 passes += 1
146 let gen = generation, pass = passes
147 let advance = {
148 guard gen == generation, pass == passes, busy else { return }
149 busy = false
150 celebrating = false
151 strokes = []
152 index += 1
153 if self.item != nil { prompt() }
154 }
155 say(Lines.traceSuccess(item), after: RoundStyle.speechDelay, then: advance)
156 DispatchQueue.main.asyncAfter(deadline: .now() + 8, execute: advance)
157 }
158
144 private func record(_ item: QuizItem, correct: Bool) { 159 private func record(_ item: QuizItem, correct: Bool) {
145 if let profile = session.current { 160 if let profile = session.current {
146 session.store.record(item, game: .trace, correct: correct, for: profile) 161 session.store.record(item, game: .trace, correct: correct, for: profile)
DayByDay/Quiz/YearWheelView.swift +3 −1
@@ -75,12 +75,14 @@ struct YearWheelView: View {
75 } 75 }
76 .accessibilityLabel(month.name) 76 .accessibilityLabel(month.name)
77 .accessibilityAddTraits(.isButton) 77 .accessibilityAddTraits(.isButton)
78 // Part of the picture: sized to the wedge, not the text size.
78 Text(month.name.prefix(3)) 79 Text(month.name.prefix(3))
79 .font(.heading(size * 0.06, weight: .heavy)) 80 .font(.custom(HeadingFont.extraBold, fixedSize: size * 0.06))
80 .foregroundStyle(.white) 81 .foregroundStyle(.white)
81 .offset(y: -size * 0.38) 82 .offset(y: -size * 0.38)
82 .rotationEffect(.degrees(center)) 83 .rotationEffect(.degrees(center))
83 .allowsHitTesting(false) 84 .allowsHitTesting(false)
85 .accessibilityHidden(true)
84 } 86 }
85 Circle() 87 Circle()
86 .fill(Color(.systemBackground)) 88 .fill(Color(.systemBackground))
DayByDay/Screenshots/ScreenshotScene.swift +15 −2
@@ -8,9 +8,11 @@ import SwiftUI
8 8
9/// App Store screens, opened by `scripts/take-screenshots.sh` with 9/// App Store screens, opened by `scripts/take-screenshots.sh` with
10/// `-screenshot <name>`. The app then runs on an in-memory store seeded with 10/// `-screenshot <name>`. The app then runs on an in-memory store seeded with
11/// one demo child. 11/// one demo child. `setup` (no children) and `picker` (two children, none
12/// picked) are for the UI tests.
12enum ScreenshotScene: String, CaseIterable { 13enum ScreenshotScene: String, CaseIterable {
13 case home, routine, animals, train, trace, counting, calendar, progress 14 case home, routine, animals, train, trace, counting, calendar, progress
15 case setup, picker
14 16
15 static var requested: ScreenshotScene? { 17 static var requested: ScreenshotScene? {
16 let args = ProcessInfo.processInfo.arguments 18 let args = ProcessInfo.processInfo.arguments
@@ -21,7 +23,7 @@ enum ScreenshotScene: String, CaseIterable {
21 @ViewBuilder @MainActor 23 @ViewBuilder @MainActor
22 func view(_ session: ProfileSession) -> some View { 24 func view(_ session: ProfileSession) -> some View {
23 switch self { 25 switch self {
24 case .home: 26 case .home, .setup, .picker:
25 ContentView() 27 ContentView()
26 case .routine: 28 case .routine:
27 NavigationStack { TodayRoutineView().navigationTitle(Category.today.label) } 29 NavigationStack { TodayRoutineView().navigationTitle(Category.today.label) }
@@ -57,6 +59,17 @@ enum ScreenshotScene: String, CaseIterable {
57 /// earlier days this month, and answers that leave a few months to practice. 59 /// earlier days this month, and answers that leave a few months to practice.
58 @MainActor 60 @MainActor
59 static func seed(_ session: ProfileSession, calendar: Calendar = AppCalendar.current, now: Date = .now) { 61 static func seed(_ session: ProfileSession, calendar: Calendar = AppCalendar.current, now: Date = .now) {
62 switch requested {
63 case .setup:
64 return
65 case .picker:
66 _ = try? session.store.create(name: "Olive", avatar: .hare, color: .teal, birthday: nil)
67 _ = try? session.store.create(name: "Max", avatar: .dog, color: .blue, birthday: nil)
68 session.profilesChanged()
69 return
70 default:
71 break
72 }
60 let today = calendar.dateComponents([.year, .month, .day], from: now) 73 let today = calendar.dateComponents([.year, .month, .day], from: now)
61 guard let olive = try? session.store.create(name: "Olive", avatar: .hare, color: .teal, 74 guard let olive = try? session.store.create(name: "Olive", avatar: .hare, color: .teal,
62 birthday: (month: today.month!, day: today.day! == 28 ? 27 : 28)) else { return } 75 birthday: (month: today.month!, day: today.day! == 28 ? 27 : 28)) else { return }
DayByDay/SeasonCard.swift +9 −6
@@ -21,8 +21,10 @@ struct SeasonCard: View {
21 var body: some View { 21 var body: some View {
22 ZStack { 22 ZStack {
23 RoundedRectangle(cornerRadius: 32, style: .continuous) 23 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(season.color.gradient) 24 .fill(season.color)
25 .shadow(color: season.color.opacity(0.4), radius: 8, y: 4) 25 .shadow(color: season.color.opacity(0.4), radius: 8, y: 4)
26 // Glow on the card only: on the label it would lower the contrast.
27 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
26 28
27 VStack(spacing: 16) { 29 VStack(spacing: 16) {
28 Image(systemName: season.symbol) 30 Image(systemName: season.symbol)
@@ -34,6 +36,7 @@ struct SeasonCard: View {
34 .font(.heading(32)) 36 .font(.heading(32))
35 .foregroundStyle(.white) 37 .foregroundStyle(.white)
36 } 38 }
39 .padding(16)
37 } 40 }
38 .overlay { 41 .overlay {
39 if isHighlighted { 42 if isHighlighted {
@@ -41,7 +44,6 @@ struct SeasonCard: View {
41 .strokeBorder(.white, lineWidth: 5) 44 .strokeBorder(.white, lineWidth: 5)
42 } 45 }
43 } 46 }
44 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
45 .scaleEffect(cardScale) 47 .scaleEffect(cardScale)
46 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 48 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
47 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) 49 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -53,6 +55,7 @@ struct SeasonCard: View {
53 isTapped = false 55 isTapped = false
54 } 56 }
55 } 57 }
58 .accessibilityElement(children: .ignore)
56 .accessibilityLabel(season.name) 59 .accessibilityLabel(season.name)
57 .accessibilityAddTraits(.isButton) 60 .accessibilityAddTraits(.isButton)
58 } 61 }
@@ -98,10 +101,10 @@ nonisolated enum Season: Int, CaseIterable, Identifiable {
98 101
99 var color: Color { 102 var color: Color {
100 switch self { 103 switch self {
101 case .spring: Color(red: 0.45, green: 0.8, blue: 0.5) // fresh green 104 case .spring: Color(red: 0.35, green: 0.61, blue: 0.38) // fresh green
102 case .summer: Color(red: 1.0, green: 0.6, blue: 0.15) // sunny orange 105 case .summer: Color(red: 0.79, green: 0.47, blue: 0.12) // sunny orange
103 case .fall: Color(red: 0.85, green: 0.45, blue: 0.2) // autumn orange 106 case .fall: Color(red: 0.84, green: 0.45, blue: 0.2) // autumn orange
104 case .winter: Color(red: 0.4, green: 0.65, blue: 0.95) // cool blue 107 case .winter: Color(red: 0.35, green: 0.56, blue: 0.82) // cool blue
105 } 108 }
106 } 109 }
107} 110}
DayByDay/SeasonsView.swift +1 −1
@@ -17,7 +17,7 @@ struct SeasonsView: View {
17 LazyVGrid(columns: columns, spacing: 24) { 17 LazyVGrid(columns: columns, spacing: 24) {
18 ForEach(Season.allCases) { season in 18 ForEach(Season.allCases) { season in
19 SeasonCard(season: season, isHighlighted: season == .current) 19 SeasonCard(season: season, isHighlighted: season == .current)
20 .frame(height: 200) 20 .frame(minHeight: 200)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
DayByDay/Today/StickerCalendarView.swift +4 −1
@@ -71,6 +71,7 @@ struct StickerCalendarView: View {
71 LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 6), count: 7), spacing: 6) { 71 LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 6), count: 7), spacing: 6) {
72 ForEach(Array(["S", "M", "T", "W", "T", "F", "S"].enumerated()), id: \.offset) { _, d in 72 ForEach(Array(["S", "M", "T", "W", "T", "F", "S"].enumerated()), id: \.offset) { _, d in
73 Text(d).font(.heading(16)).foregroundStyle(.primary) 73 Text(d).font(.heading(16)).foregroundStyle(.primary)
74 .accessibilityHidden(true)
74 } 75 }
75 ForEach(Array(grid.cells.enumerated()), id: \.offset) { _, day in 76 ForEach(Array(grid.cells.enumerated()), id: \.offset) { _, day in
76 if let day { 77 if let day {
@@ -80,6 +81,8 @@ struct StickerCalendarView: View {
80 } 81 }
81 } 82 }
82 } 83 }
84 // Seven columns leave no room for larger dates; VoiceOver reads each one in full.
85 .dynamicTypeSize(...DynamicTypeSize.accessibility1)
83 } 86 }
84 .padding(16) 87 .padding(16)
85 } 88 }
@@ -98,7 +101,7 @@ struct StickerCalendarView: View {
98 .background(Circle().fill(Color(.systemBackground))) 101 .background(Circle().fill(Color(.systemBackground)))
99 } 102 }
100 } else { 103 } else {
101 Text("\(day)").font(.system(size: 18, weight: .semibold, design: .rounded)) 104 Text("\(day)").font(.system(.body, design: .rounded, weight: .semibold))
102 } 105 }
103 } 106 }
104 .frame(height: 48) 107 .frame(height: 48)
DayByDay/Today/TodayRoutineView.swift +29 −37
@@ -74,34 +74,36 @@ struct TodayRoutineView: View {
74 } 74 }
75 75
76 private func lineCard(_ line: RoutineScript.Line) -> some View { 76 private func lineCard(_ line: RoutineScript.Line) -> some View {
77 VStack(spacing: 28) { 77 CenteredScrollView {
78 hearAgain 78 VStack(spacing: 28) {
79 VStack(spacing: 20) { 79 hearAgain
80 Image(systemName: line.symbol) 80 VStack(spacing: 20) {
81 .font(.system(size: 110)) 81 Image(systemName: line.symbol)
82 .frame(height: 130) 82 .font(.system(size: 110))
83 Text(line.text) 83 .frame(height: 130)
84 .font(.heading(32, weight: .heavy)) 84 Text(line.text)
85 .multilineTextAlignment(.center) 85 .font(.heading(32, weight: .heavy))
86 .minimumScaleFactor(0.6) 86 .multilineTextAlignment(.center)
87 } 87 .minimumScaleFactor(0.6)
88 .foregroundStyle(.white) 88 }
89 .padding(28) 89 .foregroundStyle(.white)
90 .frame(maxWidth: 520, minHeight: 300) 90 .padding(28)
91 .background(RoundedRectangle(cornerRadius: 36, style: .continuous).fill(TodayBanner.gradientColors[0])) 91 .frame(maxWidth: 520, minHeight: 300)
92 .accessibilityElement(children: .combine) 92 .background(RoundedRectangle(cornerRadius: 36, style: .continuous).fill(TodayBanner.gradientColors[0]))
93 93 .accessibilityElement(children: .combine)
94 Button(action: next) { 94
95 Image(systemName: "arrow.right") 95 Button(action: next) {
96 .font(.system(size: 40, weight: .heavy)) 96 Image(systemName: "arrow.right")
97 .foregroundStyle(.white) 97 .font(.system(size: 40, weight: .heavy))
98 .frame(width: 96, height: 96) 98 .foregroundStyle(.white)
99 .background(Circle().fill(RoundStyle.playAgainFill)) 99 .frame(width: 96, height: 96)
100 .background(Circle().fill(RoundStyle.playAgainFill))
101 }
102 .buttonStyle(.plain)
103 .accessibilityLabel("Next")
100 } 104 }
101 .buttonStyle(.plain) 105 .padding(24)
102 .accessibilityLabel("Next")
103 } 106 }
104 .padding(24)
105 } 107 }
106 108
107 private var weatherPick: some View { 109 private var weatherPick: some View {
@@ -123,17 +125,7 @@ struct TodayRoutineView: View {
123 } 125 }
124 126
125 private var hearAgain: some View { 127 private var hearAgain: some View {
126 HStack(spacing: 12) { 128 PromptBar(mascot: $mascot, action: speakCurrent)
127 GameMascot(state: $mascot)
128 Button(action: speakCurrent) {
129 Label("Hear it again", systemImage: "speaker.wave.2.fill")
130 .font(.heading(22))
131 .padding(.horizontal, 24)
132 .padding(.vertical, 14)
133 .background(Capsule().fill(Color(.systemGray6)))
134 }
135 .buttonStyle(.plain)
136 }
137 } 129 }
138 130
139 private func next() { 131 private func next() {
DayByDayTests/ContrastTests.swift +32
@@ -68,6 +68,38 @@ struct ContrastTests {
68 #expect(contrast(SortStyle.binFill, .black, .dark) >= 3) 68 #expect(contrast(SortStyle.binFill, .black, .dark) >= 3)
69 } 69 }
70 70
71 @Test(arguments: LearnWeather.allCases) func weatherCardAgainstWhite(_ weather: LearnWeather) {
72 #expect(contrast(weather.color, .white, .light) >= 3, "\(weather)")
73 }
74
75 @Test(arguments: LearnShape.allCases) func shapeCardAgainstWhite(_ shape: LearnShape) {
76 #expect(contrast(shape.color, .white, .light) >= 3, "\(shape)")
77 }
78
79 @Test(arguments: Season.allCases) func seasonCardAgainstWhite(_ season: Season) {
80 #expect(contrast(season.color, .white, .light) >= 3, "\(season)")
81 }
82
83 @Test(arguments: MonthOfYear.allCases) func monthCardAgainstWhite(_ month: MonthOfYear) {
84 #expect(contrast(month.color, .white, .light) >= 3, "\(month)")
85 }
86
87 @Test(arguments: LearnFood.allCases) func foodCardAgainstWhite(_ food: LearnFood) {
88 #expect(contrast(food.color, .white, .light) >= 3, "\(food)")
89 }
90
91 @Test(arguments: LearnBodyPart.allCases) func bodyPartCardAgainstWhite(_ part: LearnBodyPart) {
92 #expect(contrast(part.color, .white, .light) >= 3, "\(part)")
93 }
94
95 @Test(arguments: LearnNumber.allCases) func numberCardAgainstWhite(_ number: LearnNumber) {
96 #expect(contrast(number.color, .white, .light) >= 3, "\(number)")
97 }
98
99 @Test(arguments: LearnColor.allCases) func colorCardLabel(_ color: LearnColor) {
100 #expect(contrast(color.color, color.labelColor, .light) >= 3, "\(color)")
101 }
102
71 @Test(arguments: DayOfWeek.allCases) func dayColorAgainstWhite(_ day: DayOfWeek) { 103 @Test(arguments: DayOfWeek.allCases) func dayColorAgainstWhite(_ day: DayOfWeek) {
72 #expect(contrast(day.color, .white, .light) >= 3, "\(day)") 104 #expect(contrast(day.color, .white, .light) >= 3, "\(day)")
73 } 105 }
DayByDayTests/HeadingFontTests.swift +8
@@ -10,4 +10,12 @@ struct HeadingFontTests {
10 #expect(UIFont(name: HeadingFont.bold, size: 20) != nil) 10 #expect(UIFont(name: HeadingFont.bold, size: 20) != nil)
11 #expect(UIFont(name: HeadingFont.extraBold, size: 20) != nil) 11 #expect(UIFont(name: HeadingFont.extraBold, size: 20) != nil)
12 } 12 }
13
14 @Test func headingsScaleLikeTheNearestTextStyle() {
15 #expect(HeadingFont.textStyle(for: 11) == .caption2)
16 #expect(HeadingFont.textStyle(for: 17) == .body)
17 #expect(HeadingFont.textStyle(for: 22) == .title2)
18 #expect(HeadingFont.textStyle(for: 28) == .title)
19 #expect(HeadingFont.textStyle(for: 96) == .largeTitle)
20 }
13} 21}
DayByDayUITests/AccessibilityAuditTests.swift added +191
@@ -0,0 +1,191 @@
1import XCTest
2
3/// Opens every screen a child or grown-up uses, by the labels VoiceOver and
4/// Voice Control see, and runs Xcode's accessibility audit on each one: at the
5/// default text size and at the largest accessibility size.
6final class AccessibilityAuditTests: XCTestCase {
7 static let largestText = "UICTContentSizeCategoryAccessibilityXXXL"
8 static let topics = ["Days", "Months", "Seasons", "Numbers", "Colors", "Shapes", "Animals",
9 "Alphabet", "Weather", "Body", "Food"]
10
11 private var sizeName = ""
12
13 override func setUp() {
14 continueAfterFailure = true
15 }
16
17 func testTopicsAndGames() throws { try topicsAndGames(textSize: nil) }
18 func testTopicsAndGamesLargestText() throws { try topicsAndGames(textSize: Self.largestText) }
19 func testTodayRoutine() throws { try todayRoutine(textSize: nil) }
20 func testTodayRoutineLargestText() throws { try todayRoutine(textSize: Self.largestText) }
21 func testGrownUps() throws { try grownUps(textSize: nil) }
22 func testGrownUpsLargestText() throws { try grownUps(textSize: Self.largestText) }
23 func testProfiles() throws { try profiles(textSize: nil) }
24 func testProfilesLargestText() throws { try profiles(textSize: Self.largestText) }
25
26 // MARK: - Walks
27
28 private func topicsAndGames(textSize: String?) throws {
29 let app = launch("home", textSize: textSize)
30 try audit(app, "home")
31 for topic in Self.topics {
32 let hub = app.buttons["activity:Look and listen"]
33 tap(app.buttons[topic], in: app)
34 // A tap that lands while the grid is still scrolling does not navigate.
35 if !hub.waitForExistence(timeout: 3) { tap(app.buttons[topic], in: app) }
36 XCTAssert(hub.waitForExistence(timeout: 3), "\(topic) did not open")
37 try audit(app, topic)
38 let activities = app.buttons.matching(NSPredicate(format: "identifier BEGINSWITH 'activity:'"))
39 let titles = activities.allElementsBoundByIndex.map(\.identifier)
40 for id in titles {
41 tap(app.buttons[id], in: app)
42 try audit(app, "\(topic) \(id.dropFirst("activity:".count))")
43 back(app)
44 }
45 back(app)
46 }
47 }
48
49 private func todayRoutine(textSize: String?) throws {
50 let app = launch("home", textSize: textSize)
51 tap(app.buttons.matching(NSPredicate(format: "label BEGINSWITH 'Today is'")).firstMatch, in: app)
52 var lines = 0
53 while app.buttons["Next"].waitForExistence(timeout: 2) {
54 try audit(app, "routine line \(lines)")
55 app.buttons["Next"].tap()
56 lines += 1
57 }
58 try audit(app, "routine weather")
59 tap(app.buttons["Sunny"], in: app)
60 XCTAssert(app.buttons["Done"].waitForExistence(timeout: 3))
61 try audit(app, "routine calendar")
62 }
63
64 private func grownUps(textSize: String?) throws {
65 let app = launch("home", textSize: textSize)
66 tap(app.buttons["Grown-Ups"], in: app)
67 try passGate(app)
68 XCTAssert(app.navigationBars["Grown-Ups"].waitForExistence(timeout: 3))
69 try audit(app, "grown-ups")
70 app.buttons.matching(NSPredicate(format: "label CONTAINS 'Olive'")).firstMatch.tap()
71 try audit(app, "edit profile")
72 back(app)
73 app.buttons.matching(NSPredicate(format: "label CONTAINS 'Olive'")).element(boundBy: 1).tap()
74 try audit(app, "progress")
75 }
76
77 private func profiles(textSize: String?) throws {
78 var app = launch("setup", textSize: textSize)
79 try audit(app, "welcome")
80 app.buttons["Get Started"].tap()
81 try passGate(app)
82 XCTAssert(app.navigationBars["New Child"].waitForExistence(timeout: 3))
83 try audit(app, "new child")
84 app.textFields["Child's name"].tap()
85 app.textFields["Child's name"].typeText("Robin")
86 app.buttons["Bunny"].tap()
87 app.buttons["Save"].tap()
88 XCTAssert(app.buttons["Grown-Ups"].waitForExistence(timeout: 3))
89
90 app.terminate()
91 app = launch("picker", textSize: textSize)
92 try audit(app, "picker")
93 app.buttons["Max"].tap()
94 XCTAssert(app.buttons["Switch child"].waitForExistence(timeout: 3))
95 }
96
97 // MARK: - Helpers
98
99 private func launch(_ scene: String, textSize: String?) -> XCUIApplication {
100 sizeName = textSize == nil ? "default" : "largest"
101 let app = XCUIApplication()
102 app.launchArguments = ["-screenshot", scene, "-hasSeenVoiceTip", "YES"]
103 if let textSize { app.launchArguments += ["-UIPreferredContentSizeCategoryName", textSize] }
104 app.launch()
105 return app
106 }
107
108 /// Press and hold, then answer the sum.
109 private func passGate(_ app: XCUIApplication) throws {
110 let hold = app.buttons["Hold for grown-ups"]
111 XCTAssert(hold.waitForExistence(timeout: 3))
112 try audit(app, "gate")
113 hold.press(forDuration: 2.5)
114 let question = app.staticTexts.matching(NSPredicate(format: "label BEGINSWITH 'What is'")).firstMatch
115 XCTAssert(question.waitForExistence(timeout: 3))
116 let numbers = question.label.split(whereSeparator: { !$0.isNumber }).compactMap { Int($0) }
117 app.textFields["Answer"].typeText("\(numbers.reduce(0, +))")
118 app.buttons["Continue"].tap()
119 }
120
121 /// Scrolls until `element` can be tapped, then taps it.
122 private func tap(_ element: XCUIElement, in app: XCUIApplication) {
123 for _ in 0..<12 where !(element.exists && element.isHittable) {
124 app.swipeUp()
125 }
126 XCTAssert(element.exists, "\(element) not found")
127 element.tap()
128 }
129
130 private func back(_ app: XCUIApplication) {
131 let button = app.navigationBars.buttons.firstMatch
132 XCTAssert(button.waitForExistence(timeout: 5), "No back button")
133 button.tap()
134 }
135
136 private func audit(_ app: XCUIApplication, _ name: String) throws {
137 // Lets celebrations and scrolling finish.
138 sleep(2)
139 let shot = XCTAttachment(screenshot: app.screenshot())
140 shot.name = name
141 shot.lifetime = .keepAlways
142 add(shot)
143 let screen = app.windows.firstMatch.frame
144 let navigationBar = app.navigationBars.firstMatch
145 let barFrame = navigationBar.exists ? navigationBar.frame : .null
146 var clipped: [String] = []
147 try app.performAccessibilityAudit { issue in
148 if self.isExpected(issue, screen: screen, barFrame: barFrame, name: name) { return true }
149 // Clipping is re-checked below: it is reported now and then for text that is not clipped.
150 if issue.auditType == .textClipped {
151 clipped.append(issue.element?.label ?? "")
152 return true
153 }
154 self.report(issue, name)
155 return false
156 }
157 guard !clipped.isEmpty else { return }
158 sleep(1)
159 try app.performAccessibilityAudit(for: .textClipped) { issue in
160 guard clipped.contains(issue.element?.label ?? "") else { return true }
161 self.report(issue, name)
162 return false
163 }
164 }
165
166 private func isExpected(_ issue: XCUIAccessibilityAuditIssue, screen: CGRect, barFrame: CGRect, name: String) -> Bool {
167 // Toolbar buttons are drawn by the system.
168 if let element = issue.element, barFrame.intersects(element.frame) { return true }
169 // Text growth is checked by the largest-text run, where clipping shows; at the
170 // default size the audit reports any label in a sized tile as partly unsupported.
171 if sizeName == "default", issue.auditType == .dynamicType { return true }
172 // The sticker calendar's seven columns stop growing at the first accessibility size.
173 if name.hasSuffix("calendar"), issue.auditType == .dynamicType { return true }
174 // The year wheel's month names are part of the picture, sized to its wedges.
175 if name.hasSuffix("Year wheel"), issue.auditType == .dynamicType { return true }
176 // Contrast is measured from pixels, so text partly off screen measures wrong.
177 if issue.auditType == .contrast, let element = issue.element, !screen.contains(element.frame) { return true }
178 // Contrast warnings without an element come from system list section headers.
179 if issue.auditType == .contrast, issue.element == nil { return true }
180 // Food emoji are pictures, not text.
181 if let label = issue.element?.label, !label.isEmpty,
182 label.unicodeScalars.allSatisfy({ $0.properties.isEmojiPresentation || $0.properties.isEmojiModifier }) {
183 return true
184 }
185 return false
186 }
187
188 private func report(_ issue: XCUIAccessibilityAuditIssue, _ name: String) {
189 print("AUDIT [\(sizeName)] [\(name)] \(issue.auditType.rawValue) \(issue.compactDescription) :: \(issue.element?.debugDescription.prefix(200) ?? "-")")
190 }
191}
FoodCard.swift +11 −9
@@ -15,7 +15,7 @@ struct FoodCard: View {
15 var body: some View { 15 var body: some View {
16 ZStack { 16 ZStack {
17 RoundedRectangle(cornerRadius: 32, style: .continuous) 17 RoundedRectangle(cornerRadius: 32, style: .continuous)
18 .fill(food.color.gradient) 18 .fill(food.color)
19 .shadow(color: food.color.opacity(0.4), radius: 8, y: 4) 19 .shadow(color: food.color.opacity(0.4), radius: 8, y: 4)
20 20
21 VStack(spacing: 16) { 21 VStack(spacing: 16) {
@@ -26,6 +26,7 @@ struct FoodCard: View {
26 .font(.heading(28)) 26 .font(.heading(28))
27 .foregroundStyle(.white) 27 .foregroundStyle(.white)
28 } 28 }
29 .padding(16)
29 } 30 }
30 .scaleEffect(isTapped ? 1.12 : 1.0) 31 .scaleEffect(isTapped ? 1.12 : 1.0)
31 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 32 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -38,6 +39,7 @@ struct FoodCard: View {
38 isTapped = false 39 isTapped = false
39 } 40 }
40 } 41 }
42 .accessibilityElement(children: .ignore)
41 .accessibilityLabel(food.name) 43 .accessibilityLabel(food.name)
42 .accessibilityAddTraits(.isButton) 44 .accessibilityAddTraits(.isButton)
43 } 45 }
@@ -96,17 +98,17 @@ nonisolated enum LearnFood: Int, CaseIterable, Identifiable {
96 var color: Color { 98 var color: Color {
97 switch self { 99 switch self {
98 case .apple: Color(red: 0.85, green: 0.2, blue: 0.2) // red 100 case .apple: Color(red: 0.85, green: 0.2, blue: 0.2) // red
99 case .banana: Color(red: 0.95, green: 0.8, blue: 0.2) // yellow 101 case .banana: Color(red: 0.64, green: 0.54, blue: 0.14) // yellow
100 case .carrot: Color(red: 1.0, green: 0.55, blue: 0.15) // orange 102 case .carrot: Color(red: 0.83, green: 0.45, blue: 0.12) // orange
101 case .strawberry: Color(red: 0.9, green: 0.25, blue: 0.3) // strawberry red 103 case .strawberry: Color(red: 0.9, green: 0.25, blue: 0.3) // strawberry red
102 case .grapes: Color(red: 0.55, green: 0.3, blue: 0.7) // purple 104 case .grapes: Color(red: 0.55, green: 0.3, blue: 0.7) // purple
103 case .lemon: Color(red: 0.9, green: 0.8, blue: 0.2) // lemon yellow 105 case .lemon: Color(red: 0.62, green: 0.55, blue: 0.14) // lemon yellow
104 case .broccoli: Color(red: 0.3, green: 0.65, blue: 0.3) // green 106 case .broccoli: Color(red: 0.29, green: 0.62, blue: 0.29) // green
105 case .watermelon: Color(red: 0.35, green: 0.7, blue: 0.4) // watermelon green 107 case .watermelon: Color(red: 0.31, green: 0.61, blue: 0.36) // watermelon green
106 case .cherry: Color(red: 0.7, green: 0.15, blue: 0.2) // dark red 108 case .cherry: Color(red: 0.7, green: 0.15, blue: 0.2) // dark red
107 case .orange: Color(red: 1.0, green: 0.6, blue: 0.15) // orange 109 case .orange: Color(red: 0.79, green: 0.47, blue: 0.12) // orange
108 case .corn: Color(red: 0.9, green: 0.75, blue: 0.2) // golden yellow 110 case .corn: Color(red: 0.65, green: 0.54, blue: 0.15) // golden yellow
109 case .pear: Color(red: 0.55, green: 0.75, blue: 0.3) // pear green 111 case .pear: Color(red: 0.45, green: 0.6, blue: 0.24) // pear green
110 } 112 }
111 } 113 }
112} 114}
FoodView.swift +1 −1
@@ -16,7 +16,7 @@ struct FoodView: View {
16 LazyVGrid(columns: columns, spacing: 24) { 16 LazyVGrid(columns: columns, spacing: 24) {
17 ForEach(LearnFood.allCases) { food in 17 ForEach(LearnFood.allCases) { food in
18 FoodCard(food: food) 18 FoodCard(food: food)
19 .frame(height: 200) 19 .frame(minHeight: 200)
20 } 20 }
21 } 21 }
22 .padding(32) 22 .padding(32)
LetterCard.swift +1
@@ -32,6 +32,7 @@ struct LetterCard: View {
32 isTapped = false 32 isTapped = false
33 } 33 }
34 } 34 }
35 .accessibilityElement(children: .ignore)
35 .accessibilityLabel(letter.spokenName) 36 .accessibilityLabel(letter.spokenName)
36 .accessibilityAddTraits(.isButton) 37 .accessibilityAddTraits(.isButton)
37 } 38 }
NumberCard.swift +11 −8
@@ -21,8 +21,10 @@ struct NumberCard: View {
21 var body: some View { 21 var body: some View {
22 ZStack { 22 ZStack {
23 RoundedRectangle(cornerRadius: 32, style: .continuous) 23 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(number.color.gradient) 24 .fill(number.color)
25 .shadow(color: number.color.opacity(0.4), radius: 8, y: 4) 25 .shadow(color: number.color.opacity(0.4), radius: 8, y: 4)
26 // Glow on the card only: on the label it would lower the contrast.
27 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
26 28
27 VStack(spacing: 10) { 29 VStack(spacing: 10) {
28 Text("\(number.numeral)") 30 Text("\(number.numeral)")
@@ -37,6 +39,7 @@ struct NumberCard: View {
37 DotPattern(count: number.numeral) 39 DotPattern(count: number.numeral)
38 .padding(.top, 4) 40 .padding(.top, 4)
39 } 41 }
42 .padding(16)
40 } 43 }
41 .overlay { 44 .overlay {
42 if isHighlighted { 45 if isHighlighted {
@@ -44,7 +47,6 @@ struct NumberCard: View {
44 .strokeBorder(.white, lineWidth: 5) 47 .strokeBorder(.white, lineWidth: 5)
45 } 48 }
46 } 49 }
47 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
48 .scaleEffect(cardScale) 50 .scaleEffect(cardScale)
49 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 51 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
50 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0)) 52 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -56,6 +58,7 @@ struct NumberCard: View {
56 isTapped = false 58 isTapped = false
57 } 59 }
58 } 60 }
61 .accessibilityElement(children: .ignore)
59 .accessibilityLabel(number.name) 62 .accessibilityLabel(number.name)
60 .accessibilityAddTraits(.isButton) 63 .accessibilityAddTraits(.isButton)
61 } 64 }
@@ -94,15 +97,15 @@ nonisolated enum LearnNumber: Int, CaseIterable, Identifiable {
94 var color: Color { 97 var color: Color {
95 switch self { 98 switch self {
96 case .one: Color(red: 0.9, green: 0.3, blue: 0.3) // red 99 case .one: Color(red: 0.9, green: 0.3, blue: 0.3) // red
97 case .two: Color(red: 1.0, green: 0.55, blue: 0.2) // orange 100 case .two: Color(red: 0.83, green: 0.45, blue: 0.16) // orange
98 case .three: Color(red: 1.0, green: 0.8, blue: 0.2) // yellow 101 case .three: Color(red: 0.67, green: 0.53, blue: 0.14) // yellow
99 case .four: Color(red: 0.35, green: 0.75, blue: 0.4) // green 102 case .four: Color(red: 0.29, green: 0.62, blue: 0.33) // green
100 case .five: Color(red: 0.2, green: 0.7, blue: 0.85) // sky blue 103 case .five: Color(red: 0.17, green: 0.6, blue: 0.72) // sky blue
101 case .six: Color(red: 0.4, green: 0.45, blue: 0.9) // blue 104 case .six: Color(red: 0.4, green: 0.45, blue: 0.9) // blue
102 case .seven: Color(red: 0.6, green: 0.4, blue: 0.85) // purple 105 case .seven: Color(red: 0.6, green: 0.4, blue: 0.85) // purple
103 case .eight: Color(red: 0.85, green: 0.35, blue: 0.6) // pink 106 case .eight: Color(red: 0.85, green: 0.35, blue: 0.6) // pink
104 case .nine: Color(red: 0.5, green: 0.75, blue: 0.45) // lime 107 case .nine: Color(red: 0.4, green: 0.6, blue: 0.36) // lime
105 case .ten: Color(red: 0.25, green: 0.8, blue: 0.75) // teal 108 case .ten: Color(red: 0.19, green: 0.61, blue: 0.57) // teal
106 } 109 }
107 } 110 }
108} 111}
NumbersView.swift +1 −1
@@ -20,7 +20,7 @@ struct NumbersView: View {
20 number: number, 20 number: number,
21 isHighlighted: number == .current 21 isHighlighted: number == .current
22 ) 22 )
23 .frame(height: 200) 23 .frame(minHeight: 200)
24 } 24 }
25 } 25 }
26 .padding(32) 26 .padding(32)
README.org +6
@@ -18,6 +18,12 @@ Settings > Accessibility > Read & Speak > Voices.
18* release 18* release
19=scripts/take-screenshots.sh= retakes =AppStore/screenshots= on the iPhone 18 Pro Max 19=scripts/take-screenshots.sh= retakes =AppStore/screenshots= on the iPhone 18 Pro Max
20and iPad Pro 13-inch (M5) simulators; the 6.3" set is resized from the 6.9" one. 20and iPad Pro 13-inch (M5) simulators; the 6.3" set is resized from the 6.9" one.
21=TEXT_SIZE=accessibility-extra-extra-extra-large scripts/take-screenshots.sh= takes
22the same set at the largest text size, into
23=AppStore/screenshots-accessibility-extra-extra-extra-large=.
24
25The =DayByDayUITests= target opens every screen by its VoiceOver labels and runs
26Xcode's accessibility audit on it, at the default and the largest text size.
21 27
22=scripts/release-ios.sh= archives the app and uploads it to App Store Connect for 28=scripts/release-ios.sh= archives the app and uploads it to App Store Connect for
23TestFlight, from a clean =main=, signed through the Apple ID in Xcode (Xcode > 29TestFlight, from a clean =main=, signed through the Apple ID in Xcode (Xcode >
ShapeCard.swift +7 −5
@@ -14,7 +14,7 @@ struct ShapeCard: View {
14 var body: some View { 14 var body: some View {
15 ZStack { 15 ZStack {
16 RoundedRectangle(cornerRadius: 32, style: .continuous) 16 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(shape.color.gradient) 17 .fill(shape.color)
18 .shadow(color: shape.color.opacity(0.4), radius: 8, y: 4) 18 .shadow(color: shape.color.opacity(0.4), radius: 8, y: 4)
19 19
20 VStack(spacing: 16) { 20 VStack(spacing: 16) {
@@ -26,6 +26,7 @@ struct ShapeCard: View {
26 .font(.heading(32)) 26 .font(.heading(32))
27 .foregroundStyle(.white) 27 .foregroundStyle(.white)
28 } 28 }
29 .padding(16)
29 } 30 }
30 .scaleEffect(isTapped ? 1.12 : 1.0) 31 .scaleEffect(isTapped ? 1.12 : 1.0)
31 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 32 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -38,6 +39,7 @@ struct ShapeCard: View {
38 isTapped = false 39 isTapped = false
39 } 40 }
40 } 41 }
42 .accessibilityElement(children: .ignore)
41 .accessibilityLabel(shape.name) 43 .accessibilityLabel(shape.name)
42 .accessibilityAddTraits(.isButton) 44 .accessibilityAddTraits(.isButton)
43 } 45 }
@@ -106,12 +108,12 @@ nonisolated enum LearnShape: Int, CaseIterable, Identifiable {
106 switch self { 108 switch self {
107 case .circle: Color(red: 0.9, green: 0.3, blue: 0.3) // red 109 case .circle: Color(red: 0.9, green: 0.3, blue: 0.3) // red
108 case .square: Color(red: 0.3, green: 0.5, blue: 0.9) // blue 110 case .square: Color(red: 0.3, green: 0.5, blue: 0.9) // blue
109 case .triangle: Color(red: 0.35, green: 0.75, blue: 0.45) // green 111 case .triangle: Color(red: 0.29, green: 0.62, blue: 0.38) // green
110 case .star: Color(red: 1.0, green: 0.75, blue: 0.15) // gold 112 case .star: Color(red: 0.7, green: 0.52, blue: 0.11) // gold
111 case .heart: Color(red: 0.9, green: 0.35, blue: 0.5) // pink 113 case .heart: Color(red: 0.9, green: 0.35, blue: 0.5) // pink
112 case .oval: Color(red: 0.55, green: 0.4, blue: 0.85) // purple 114 case .oval: Color(red: 0.55, green: 0.4, blue: 0.85) // purple
113 case .diamond: Color(red: 0.2, green: 0.75, blue: 0.8) // teal 115 case .diamond: Color(red: 0.16, green: 0.6, blue: 0.64) // teal
114 case .rectangle: Color(red: 1.0, green: 0.55, blue: 0.2) // orange 116 case .rectangle: Color(red: 0.83, green: 0.45, blue: 0.16) // orange
115 } 117 }
116 } 118 }
117} 119}
ShapesView.swift +1 −1
@@ -17,7 +17,7 @@ struct ShapesView: View {
17 LazyVGrid(columns: columns, spacing: 24) { 17 LazyVGrid(columns: columns, spacing: 24) {
18 ForEach(LearnShape.allCases) { shape in 18 ForEach(LearnShape.allCases) { shape in
19 ShapeCard(shape: shape) 19 ShapeCard(shape: shape)
20 .frame(height: 200) 20 .frame(minHeight: 200)
21 } 21 }
22 } 22 }
23 .padding(32) 23 .padding(32)
WeatherCard.swift +9 −7
@@ -14,7 +14,7 @@ struct WeatherCard: View {
14 var body: some View { 14 var body: some View {
15 ZStack { 15 ZStack {
16 RoundedRectangle(cornerRadius: 32, style: .continuous) 16 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(weather.color.gradient) 17 .fill(weather.color)
18 .shadow(color: weather.color.opacity(0.4), radius: 8, y: 4) 18 .shadow(color: weather.color.opacity(0.4), radius: 8, y: 4)
19 19
20 VStack(spacing: 16) { 20 VStack(spacing: 16) {
@@ -27,6 +27,7 @@ struct WeatherCard: View {
27 .font(.heading(32)) 27 .font(.heading(32))
28 .foregroundStyle(.white) 28 .foregroundStyle(.white)
29 } 29 }
30 .padding(16)
30 } 31 }
31 .scaleEffect(isTapped ? 1.12 : 1.0) 32 .scaleEffect(isTapped ? 1.12 : 1.0)
32 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous)) 33 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct WeatherCard: View {
39 isTapped = false 40 isTapped = false
40 } 41 }
41 } 42 }
43 .accessibilityElement(children: .ignore)
42 .accessibilityLabel(weather.name) 44 .accessibilityLabel(weather.name)
43 .accessibilityAddTraits(.isButton) 45 .accessibilityAddTraits(.isButton)
44 } 46 }
@@ -79,14 +81,14 @@ nonisolated enum LearnWeather: Int, CaseIterable, Identifiable {
79 81
80 var color: Color { 82 var color: Color {
81 switch self { 83 switch self {
82 case .sunny: Color(red: 1.0, green: 0.7, blue: 0.2) // orange 84 case .sunny: Color(red: 0.73, green: 0.51, blue: 0.15) // orange
83 case .cloudy: Color(red: 0.6, green: 0.6, blue: 0.65) // gray 85 case .cloudy: Color(red: 0.55, green: 0.55, blue: 0.6) // gray
84 case .rainy: Color(red: 0.3, green: 0.6, blue: 0.9) // blue 86 case .rainy: Color(red: 0.28, green: 0.57, blue: 0.85) // blue
85 case .snowy: Color(red: 0.55, green: 0.8, blue: 0.95) // light blue 87 case .snowy: Color(red: 0.4, green: 0.57, blue: 0.68) // light blue
86 case .windy: Color(red: 0.25, green: 0.7, blue: 0.7) // teal 88 case .windy: Color(red: 0.21, green: 0.61, blue: 0.61) // teal
87 case .stormy: Color(red: 0.2, green: 0.3, blue: 0.6) // dark blue 89 case .stormy: Color(red: 0.2, green: 0.3, blue: 0.6) // dark blue
88 case .foggy: Color(red: 0.6, green: 0.5, blue: 0.7) // muted purple 90 case .foggy: Color(red: 0.6, green: 0.5, blue: 0.7) // muted purple
89 case .rainbow: Color(red: 0.9, green: 0.45, blue: 0.6) // pink 91 case .rainbow: Color(red: 0.83, green: 0.42, blue: 0.56) // pink
90 } 92 }
91 } 93 }
92} 94}
WeatherView.swift +1 −1
@@ -31,7 +31,7 @@ struct WeatherView: View {
31 LazyVGrid(columns: columns, spacing: 24) { 31 LazyVGrid(columns: columns, spacing: 24) {
32 ForEach(LearnWeather.allCases) { weather in 32 ForEach(LearnWeather.allCases) { weather in
33 WeatherCard(weather: weather) 33 WeatherCard(weather: weather)
34 .frame(height: 200) 34 .frame(minHeight: 200)
35 } 35 }
36 } 36 }
37 .padding(32) 37 .padding(32)
scripts/add-ui-test-target.rb added +42
@@ -0,0 +1,42 @@
1# Adds the DayByDayUITests UI test target to the project and the shared DayByDay scheme.
2require 'xcodeproj'
3
4project_path = File.expand_path('../DayByDay.xcodeproj', __dir__)
5project = Xcodeproj::Project.open(project_path)
6app = project.targets.find { |t| t.name == 'DayByDay' }
7abort 'DayByDayUITests already exists' if project.targets.any? { |t| t.name == 'DayByDayUITests' }
8
9tests = project.new_target(:ui_test_bundle, 'DayByDayUITests', :ios, '17.5')
10tests.add_dependency(app)
11
12group = project.new(Xcodeproj::Project::Object::PBXFileSystemSynchronizedRootGroup)
13group.path = 'DayByDayUITests'
14group.source_tree = '<group>'
15project.main_group.children << group
16tests.file_system_synchronized_groups ||= []
17tests.file_system_synchronized_groups << group
18
19tests.build_configurations.each do |config|
20 s = config.build_settings
21 s['TEST_TARGET_NAME'] = 'DayByDay'
22 s['PRODUCT_BUNDLE_IDENTIFIER'] = "#{app.build_configurations.first.build_settings['PRODUCT_BUNDLE_IDENTIFIER']}.uitests"
23 s['PRODUCT_NAME'] = '$(TARGET_NAME)'
24 s['GENERATE_INFOPLIST_FILE'] = 'YES'
25 s['SWIFT_VERSION'] = '5.0'
26 s['TARGETED_DEVICE_FAMILY'] = '1,2'
27 s['DEVELOPMENT_TEAM'] = app.build_configurations.first.build_settings['DEVELOPMENT_TEAM']
28 s['CODE_SIGN_STYLE'] = 'Automatic'
29end
30
31project.save
32
33scheme_path = File.join(project_path, 'xcshareddata', 'xcschemes', 'DayByDay.xcscheme')
34scheme = Xcodeproj::XCScheme.new(scheme_path)
35scheme.build_action.add_entry(Xcodeproj::XCScheme::BuildAction::Entry.new(tests).tap do |e|
36 e.build_for_running = false
37 e.build_for_profiling = false
38 e.build_for_archiving = false
39 e.build_for_analyzing = false
40end)
41scheme.test_action.add_testable(Xcodeproj::XCScheme::TestAction::TestableReference.new(tests))
42scheme.save!
scripts/take-screenshots.sh +9 −3
@@ -4,12 +4,15 @@
4# build's -screenshot launch argument (DayByDay/Screenshots/ScreenshotScene.swift) on a demo 4# build's -screenshot launch argument (DayByDay/Screenshots/ScreenshotScene.swift) on a demo
5# child. The 6.3" set is resized from the 6.9" one; every PNG is flattened to RGB. 5# child. The 6.3" set is resized from the 6.9" one; every PNG is flattened to RGB.
6# Usage: scripts/take-screenshots.sh [scene ...] (default: every scene, in App Store order) 6# Usage: scripts/take-screenshots.sh [scene ...] (default: every scene, in App Store order)
7# TEXT_SIZE=accessibility-extra-extra-extra-large (any simctl content_size) shoots at that text
8# size into AppStore/screenshots-<size> instead.
7set -eu 9set -eu
8 10
9cd "$(dirname "$0")/.." 11cd "$(dirname "$0")/.."
10all="home routine animals train trace counting calendar progress" 12all="home routine animals train trace counting calendar progress"
11scenes="${*:-$all}" 13scenes="${*:-$all}"
12out=AppStore/screenshots 14size="${TEXT_SIZE:-}"
15out=AppStore/screenshots${size:+-$size}
13derived=.build/screenshots 16derived=.build/screenshots
14app="$derived/Build/Products/Debug-iphonesimulator/DayByDay.app" 17app="$derived/Build/Products/Debug-iphonesimulator/DayByDay.app"
15bundle=net.cleberg.DayByDay 18bundle=net.cleberg.DayByDay
@@ -34,14 +37,16 @@ shoot() { # device name, output folder
34 xcrun simctl boot "$device" 2>/dev/null || true 37 xcrun simctl boot "$device" 2>/dev/null || true
35 xcrun simctl bootstatus "$device" -b >/dev/null 38 xcrun simctl bootstatus "$device" -b >/dev/null
36 xcrun simctl ui "$device" appearance light 39 xcrun simctl ui "$device" appearance light
37 xcrun simctl status_bar "$device" override --time 9:41 --dataNetwork wifi --wifiMode active \ 40 xcrun simctl ui "$device" content_size "${size:-large}"
38 --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100
39 xcrun simctl install "$device" "$app" 41 xcrun simctl install "$device" "$app"
40 mkdir -p "$out/$2" 42 mkdir -p "$out/$2"
41 for scene in $scenes; do 43 for scene in $scenes; do
42 n="$(printf '%s\n' $all | grep -nx "$scene" | cut -d: -f1)" 44 n="$(printf '%s\n' $all | grep -nx "$scene" | cut -d: -f1)"
43 [ -n "$n" ] || { echo "Unknown scene $scene; one of: $all" >&2; exit 1; } 45 [ -n "$n" ] || { echo "Unknown scene $scene; one of: $all" >&2; exit 1; }
44 xcrun simctl terminate "$device" "$bundle" 2>/dev/null || true 46 xcrun simctl terminate "$device" "$bundle" 2>/dev/null || true
47 # Set per launch: changing content_size restarts the status bar and drops the override.
48 xcrun simctl status_bar "$device" override --time 9:41 --dataNetwork wifi --wifiMode active \
49 --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100
45 xcrun simctl launch "$device" "$bundle" -screenshot "$scene" -hasSeenVoiceTip YES >/dev/null 50 xcrun simctl launch "$device" "$bundle" -screenshot "$scene" -hasSeenVoiceTip YES >/dev/null
46 file="$out/$2/$(printf %02d "$n")-$scene.png" 51 file="$out/$2/$(printf %02d "$n")-$scene.png"
47 # A screen that has not drawn yet is blank white, which compresses to a few KB. 52 # A screen that has not drawn yet is blank white, which compresses to a few KB.
@@ -58,6 +63,7 @@ shoot() { # device name, output folder
58 done 63 done
59 xcrun simctl terminate "$device" "$bundle" 2>/dev/null || true 64 xcrun simctl terminate "$device" "$bundle" 2>/dev/null || true
60 xcrun simctl status_bar "$device" clear 65 xcrun simctl status_bar "$device" clear
66 xcrun simctl ui "$device" content_size large
61} 67}
62 68
63shoot "iPhone 18 Pro Max" iphone-6.9 69shoot "iPhone 18 Pro Max" iphone-6.9