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 {
1717 LazyVGrid(columns: columns, spacing: 20) {
1818 ForEach(LearnLetter.allCases) { letter in
1919 LetterCard(letter: letter)
20 .frame(height: 160)
20 .frame(minHeight: 160)
2121 }
2222 }
2323 .padding(32)
AnimalCard.swift +2
@@ -27,6 +27,7 @@ struct AnimalCard: View {
2727 .font(.heading(32))
2828 .foregroundStyle(.white)
2929 }
30 .padding(16)
3031 }
3132 .scaleEffect(isTapped ? 1.12 : 1.0)
3233 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct AnimalCard: View {
3940 isTapped = false
4041 }
4142 }
43 .accessibilityElement(children: .ignore)
4244 .accessibilityLabel(animal.name)
4345 .accessibilityAddTraits(.isButton)
4446 }
AnimalsView.swift +1 −1
@@ -17,7 +17,7 @@ struct AnimalsView: View {
1717 LazyVGrid(columns: columns, spacing: 24) {
1818 ForEach(LearnAnimal.allCases) { animal in
1919 AnimalCard(animal: animal)
20 .frame(height: 200)
20 .frame(minHeight: 200)
2121 }
2222 }
2323 .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 @@
11# What's New
22
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
311## 2.0
412
513DayByDay now turns every topic into games.
BodyPartCard.swift +10 −8
@@ -14,7 +14,7 @@ struct BodyPartCard: View {
1414 var body: some View {
1515 ZStack {
1616 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(bodyPart.color.gradient)
17 .fill(bodyPart.color)
1818 .shadow(color: bodyPart.color.opacity(0.4), radius: 8, y: 4)
1919
2020 VStack(spacing: 16) {
@@ -27,6 +27,7 @@ struct BodyPartCard: View {
2727 .font(.heading(32))
2828 .foregroundStyle(.white)
2929 }
30 .padding(16)
3031 }
3132 .scaleEffect(isTapped ? 1.12 : 1.0)
3233 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct BodyPartCard: View {
3940 isTapped = false
4041 }
4142 }
43 .accessibilityElement(children: .ignore)
4244 .accessibilityLabel(bodyPart.name)
4345 .accessibilityAddTraits(.isButton)
4446 }
@@ -87,18 +89,18 @@ nonisolated enum LearnBodyPart: Int, CaseIterable, Identifiable {
8789
8890 var color: Color {
8991 switch self {
90 case .head: Color(red: 0.9, green: 0.5, blue: 0.3) // warm orange
91 case .eyes: Color(red: 0.3, green: 0.65, blue: 0.9) // blue
92 case .head: Color(red: 0.82, green: 0.46, blue: 0.27) // warm orange
93 case .eyes: Color(red: 0.26, green: 0.58, blue: 0.8) // blue
9294 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
9496 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
96 case .fingers: Color(red: 0.35, green: 0.75, blue: 0.5) // green
97 case .arms: Color(red: 0.25, green: 0.7, blue: 0.7) // teal
97 case .hands: Color(red: 0.71, green: 0.52, blue: 0.22) // golden
98 case .fingers: Color(red: 0.28, green: 0.61, blue: 0.41) // green
99 case .arms: Color(red: 0.21, green: 0.61, blue: 0.61) // teal
98100 case .legs: Color(red: 0.5, green: 0.4, blue: 0.8) // indigo
99101 case .feet: Color(red: 0.7, green: 0.5, blue: 0.3) // brown
100102 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
102104 }
103105 }
104106}
BodyPartsView.swift +1 −1
@@ -16,7 +16,7 @@ struct BodyPartsView: View {
1616 LazyVGrid(columns: columns, spacing: 24) {
1717 ForEach(LearnBodyPart.allCases) { part in
1818 BodyPartCard(bodyPart: part)
19 .frame(height: 200)
19 .frame(minHeight: 200)
2020 }
2121 }
2222 .padding(32)
ColorCard.swift +11 −3
@@ -13,13 +13,12 @@ struct ColorCard: View {
1313 var body: some View {
1414 ZStack {
1515 RoundedRectangle(cornerRadius: 32, style: .continuous)
16 .fill(learnColor.color.gradient)
16 .fill(learnColor.color)
1717 .shadow(color: learnColor.color.opacity(0.4), radius: 8, y: 4)
1818
1919 Text(learnColor.name)
2020 .font(.heading(36))
21 .foregroundStyle(.white)
22 .shadow(color: .black.opacity(0.3), radius: 4, y: 2)
21 .foregroundStyle(learnColor.labelColor)
2322 }
2423 .scaleEffect(isTapped ? 1.12 : 1.0)
2524 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -32,6 +31,7 @@ struct ColorCard: View {
3231 isTapped = false
3332 }
3433 }
34 .accessibilityElement(children: .ignore)
3535 .accessibilityLabel(learnColor.name)
3636 .accessibilityAddTraits(.isButton)
3737 }
@@ -73,6 +73,14 @@ nonisolated enum LearnColor: Int, CaseIterable, Identifiable {
7373 case .white: Color(red: 0.92, green: 0.92, blue: 0.92)
7474 }
7575 }
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 }
7684}
7785
7886#Preview {
ColorsView.swift +1 −1
@@ -17,7 +17,7 @@ struct ColorsView: View {
1717 LazyVGrid(columns: columns, spacing: 24) {
1818 ForEach(LearnColor.allCases) { color in
1919 ColorCard(learnColor: color)
20 .frame(height: 200)
20 .frame(minHeight: 200)
2121 }
2222 }
2323 .padding(32)
DayByDay.xcodeproj/project.pbxproj +114 −2
@@ -7,6 +7,7 @@
77 objects = {
88
99/* Begin PBXBuildFile section */
10 064C33BF388C0C164246C8C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA83A180D07BFACBA92AC03E /* Foundation.framework */; };
1011 8B1B4FF92F659AD1005C246F /* WeatherCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */; };
1112 8B1B4FFB2F659AD1005C246F /* WeatherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */; };
1213 8B1B4FFD2F659AD2005C246F /* BodyPartCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */; };
@@ -34,9 +35,17 @@
3435 remoteGlobalIDString = 8B7051B12F5F908800491D58;
3536 remoteInfo = DayByDay;
3637 };
38 3A90A0A4698DD0B1921863E6 /* PBXContainerItemProxy */ = {
39 isa = PBXContainerItemProxy;
40 containerPortal = 8B7051AA2F5F908800491D58 /* Project object */;
41 proxyType = 1;
42 remoteGlobalIDString = 8B7051B12F5F908800491D58;
43 remoteInfo = DayByDay;
44 };
3745/* End PBXContainerItemProxy section */
3846
3947/* Begin PBXFileReference section */
48 888B02E423CDBC1710668F44 /* DayByDayUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DayByDayUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
4049 8B1B4FF82F659AD1005C246F /* WeatherCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherCard.swift; sourceTree = "<group>"; };
4150 8B1B4FFA2F659AD1005C246F /* WeatherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherView.swift; sourceTree = "<group>"; };
4251 8B1B4FFC2F659AD2005C246F /* BodyPartCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BodyPartCard.swift; sourceTree = "<group>"; };
@@ -76,6 +85,13 @@
7685 path = DayByDayTests;
7786 sourceTree = "<group>";
7887 };
88 63A6B6AB1DFD8F1A3F120BDC /* DayByDayUITests */ = {
89 isa = PBXFileSystemSynchronizedRootGroup;
90 exceptions = (
91 );
92 path = DayByDayUITests;
93 sourceTree = "<group>";
94 };
7995 8B7051B42F5F908800491D58 /* DayByDay */ = {
8096 isa = PBXFileSystemSynchronizedRootGroup;
8197 exceptions = (
@@ -87,6 +103,14 @@
87103/* End PBXFileSystemSynchronizedRootGroup section */
88104
89105/* 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 };
90114 8B7051AF2F5F908800491D58 /* Frameworks */ = {
91115 isa = PBXFrameworksBuildPhase;
92116 buildActionMask = 2147483647;
@@ -144,6 +168,7 @@
144168 8B1B50022F659AD4005C246F /* FoodView.swift */,
145169 43AAA6C6355BFA1D8A629985 /* Frameworks */,
146170 4FDEBF44C97D137EF31F348A /* DayByDayTests */,
171 63A6B6AB1DFD8F1A3F120BDC /* DayByDayUITests */,
147172 );
148173 sourceTree = "<group>";
149174 };
@@ -152,6 +177,7 @@
152177 children = (
153178 8B7051B22F5F908800491D58 /* DayByDay.app */,
154179 B6E74F699AA6EB7ADABD5F88 /* DayByDayTests.xctest */,
180 888B02E423CDBC1710668F44 /* DayByDayUITests.xctest */,
155181 );
156182 name = Products;
157183 sourceTree = "<group>";
@@ -159,6 +185,27 @@
159185/* End PBXGroup section */
160186
161187/* 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 };
162209 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */ = {
163210 isa = PBXNativeTarget;
164211 buildConfigurationList = F99EE566298541D2131D7F82 /* Build configuration list for PBXNativeTarget "DayByDayTests" */;
@@ -231,11 +278,19 @@
231278 targets = (
232279 8B7051B12F5F908800491D58 /* DayByDay */,
233280 62BDB36DEC1B9FC5E49D7819 /* DayByDayTests */,
281 403A770161DC84E4D6A3B44D /* DayByDayUITests */,
234282 );
235283 };
236284/* End PBXProject section */
237285
238286/* Begin PBXResourcesBuildPhase section */
287 860A78624F8B95D6FFD5B674 /* Resources */ = {
288 isa = PBXResourcesBuildPhase;
289 buildActionMask = 2147483647;
290 files = (
291 );
292 runOnlyForDeploymentPostprocessing = 0;
293 };
239294 8B7051B02F5F908800491D58 /* Resources */ = {
240295 isa = PBXResourcesBuildPhase;
241296 buildActionMask = 2147483647;
@@ -283,6 +338,13 @@
283338 );
284339 runOnlyForDeploymentPostprocessing = 0;
285340 };
341 E6FD65318FD1341227535EED /* Sources */ = {
342 isa = PBXSourcesBuildPhase;
343 buildActionMask = 2147483647;
344 files = (
345 );
346 runOnlyForDeploymentPostprocessing = 0;
347 };
286348/* End PBXSourcesBuildPhase section */
287349
288350/* Begin PBXTargetDependency section */
@@ -292,9 +354,33 @@
292354 target = 8B7051B12F5F908800491D58 /* DayByDay */;
293355 targetProxy = 1015CD2FFBC39F380BE3151E /* PBXContainerItemProxy */;
294356 };
357 F12AC1A8951D64662983E318 /* PBXTargetDependency */ = {
358 isa = PBXTargetDependency;
359 name = DayByDay;
360 target = 8B7051B12F5F908800491D58 /* DayByDay */;
361 targetProxy = 3A90A0A4698DD0B1921863E6 /* PBXContainerItemProxy */;
362 };
295363/* End PBXTargetDependency section */
296364
297365/* 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 };
298384 76F72CE42B474B4C420CFF4F /* Release */ = {
299385 isa = XCBuildConfiguration;
300386 buildSettings = {
@@ -460,7 +546,7 @@
460546 "$(inherited)",
461547 "@executable_path/Frameworks",
462548 );
463 MARKETING_VERSION = 2.0;
549 MARKETING_VERSION = 2.0.1;
464550 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay;
465551 PRODUCT_NAME = "$(TARGET_NAME)";
466552 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -494,7 +580,7 @@
494580 "$(inherited)",
495581 "@executable_path/Frameworks",
496582 );
497 MARKETING_VERSION = 2.0;
583 MARKETING_VERSION = 2.0.1;
498584 PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.DayByDay;
499585 PRODUCT_NAME = "$(TARGET_NAME)";
500586 STRING_CATALOG_GENERATE_SYMBOLS = YES;
@@ -527,9 +613,35 @@
527613 };
528614 name = Debug;
529615 };
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 };
530633/* End XCBuildConfiguration section */
531634
532635/* 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 };
533645 8B7051AD2F5F908800491D58 /* Build configuration list for PBXProject "DayByDay" */ = {
534646 isa = XCConfigurationList;
535647 buildConfigurations = (
DayByDay.xcodeproj/xcshareddata/xcschemes/DayByDay.xcscheme +24
@@ -34,6 +34,20 @@
3434 ReferencedContainer = "container:DayByDay.xcodeproj">
3535 </BuildableReference>
3636 </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>
3751 </BuildActionEntries>
3852 </BuildAction>
3953 <TestAction
@@ -53,6 +67,16 @@
5367 ReferencedContainer = "container:DayByDay.xcodeproj">
5468 </BuildableReference>
5569 </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>
5680 </Testables>
5781 </TestAction>
5882 <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 {
107107 .font(.heading(24))
108108 .foregroundStyle(.white)
109109 }
110 .padding(12)
110111 .shadow(color: category.usesGradientBackground ? .black.opacity(0.6) : .clear, radius: 2)
111112 }
113 .accessibilityElement(children: .ignore)
112114 .accessibilityLabel(category.label)
113115 }
114116}
@@ -148,33 +150,36 @@ struct VoiceTipOverlay: View {
148150 Color.black.opacity(0.4)
149151 .ignoresSafeArea()
150152
151 VStack(spacing: 20) {
152 Image(systemName: "speaker.wave.3.fill")
153 .font(.system(size: 48))
154 .foregroundStyle(.blue)
155
156 Text("Better Voices Available")
157 .font(.system(size: 28, weight: .bold, design: .rounded))
158
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.")
160 .font(.system(size: 18, design: .rounded))
161 .multilineTextAlignment(.center)
162 .foregroundStyle(.secondary)
163
164 Text("Tap anywhere to dismiss")
165 .font(.system(size: 16, weight: .medium, design: .rounded))
166 .foregroundStyle(.tertiary)
167 .padding(.top, 8)
153 CenteredScrollView {
154 VStack(spacing: 20) {
155 Image(systemName: "speaker.wave.3.fill")
156 .font(.system(size: 48))
157 .foregroundStyle(.blue)
158
159 Text("Better Voices Available")
160 .font(.system(.title, design: .rounded, weight: .bold))
161
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.")
163 .font(.system(.body, design: .rounded))
164 .multilineTextAlignment(.center)
165
166 Text("Tap anywhere to dismiss")
167 .font(.system(.callout, design: .rounded, weight: .medium))
168 .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)
168177 }
169 .padding(40)
170 .frame(maxWidth: 520)
171 .background(
172 RoundedRectangle(cornerRadius: 32, style: .continuous)
173 .fill(.regularMaterial)
174 )
175178 }
176179 .contentShape(Rectangle())
177180 .onTapGesture(perform: onDismiss)
181 .accessibilityElement(children: .combine)
182 .accessibilityAddTraits(.isButton)
178183 }
179184}
180185
DayByDay/DayCard.swift +4 −1
@@ -25,6 +25,8 @@ struct DayCard: View {
2525 RoundedRectangle(cornerRadius: 32, style: .continuous)
2626 .fill(day.color)
2727 .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)
2830
2931 VStack(spacing: 16) {
3032 Image(systemName: day.symbol)
@@ -36,6 +38,7 @@ struct DayCard: View {
3638 .font(.heading(32))
3739 .foregroundStyle(.white)
3840 }
41 .padding(16)
3942 }
4043 .overlay(alignment: .topTrailing) {
4144 if let picture {
@@ -54,7 +57,6 @@ struct DayCard: View {
5457 .strokeBorder(.white, lineWidth: 5)
5558 }
5659 }
57 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
5860 .scaleEffect(cardScale)
5961 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
6062 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -66,6 +68,7 @@ struct DayCard: View {
6668 isTapped = false
6769 }
6870 }
71 .accessibilityElement(children: .ignore)
6972 .accessibilityLabel(picture.map { "\(day.name), \($0.name)" } ?? day.name)
7073 .accessibilityAddTraits(.isButton)
7174 }
DayByDay/DaysOfWeekView.swift +1 −1
@@ -20,7 +20,7 @@ struct DaysOfWeekView: View {
2020 LazyVGrid(columns: columns, spacing: 24) {
2121 ForEach(DayOfWeek.allCases) { day in
2222 DayCard(day: day, isHighlighted: day == .current, picture: picture(on: day))
23 .frame(height: 200)
23 .frame(minHeight: 200)
2424 }
2525 }
2626 .padding(32)
DayByDay/Fonts/HeadingFont.swift +25 −4
@@ -13,21 +13,42 @@ enum HeadingFont {
1313 static let bold = "Baloo2-Bold"
1414 static let extraBold = "Baloo2-ExtraBold"
1515
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.
1718 static func register() {
1819 if let url = Bundle.main.url(forResource: "Baloo2", withExtension: "ttf") {
1920 CTFontManagerRegisterFontsForURL(url as CFURL, .process, nil)
2021 }
2122 if let large = UIFont(name: extraBold, size: 34), let inline = UIFont(name: bold, size: 19) {
22 UINavigationBar.appearance().largeTitleTextAttributes = [.font: large]
23 UINavigationBar.appearance().titleTextAttributes = [.font: inline]
23 UINavigationBar.appearance().largeTitleTextAttributes =
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
2442 }
2543 }
2644}
2745
2846extension Font {
2947 /// A heading in Baloo 2: ExtraBold for `.heavy` and `.black`, Bold otherwise.
48 /// Scales with Dynamic Type like the text style nearest `size`.
3049 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))
3252 }
3353}
54
DayByDay/Home/CategoryHubView.swift +11 −4
@@ -9,6 +9,8 @@ import SwiftUI
99struct CategoryHubView: View {
1010 let category: Category
1111
12 @Environment(\.dynamicTypeSize) private var typeSize
13
1214 var body: some View {
1315 ScrollView {
1416 VStack(spacing: 24) {
@@ -22,7 +24,7 @@ struct CategoryHubView: View {
2224 }
2325 }
2426 }
25 .padding(32)
27 .padding(typeSize.isAccessibilitySize ? 16 : 32)
2628 .frame(maxWidth: 640)
2729 .frame(maxWidth: .infinity)
2830 }
@@ -31,7 +33,10 @@ struct CategoryHubView: View {
3133 private func activity(_ title: String, systemImage: String, color: Color,
3234 @ViewBuilder destination: @escaping () -> some View) -> some View {
3335 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 {
3540 Image(systemName: systemImage)
3641 .font(.system(size: 44))
3742 Text(title)
@@ -39,11 +44,13 @@ struct CategoryHubView: View {
3944 Spacer(minLength: 0)
4045 }
4146 .foregroundStyle(.white)
42 .padding(.horizontal, 32)
43 .frame(height: 120)
47 .padding(.horizontal, typeSize.isAccessibilitySize ? 20 : 32)
48 .padding(.vertical, 16)
49 .frame(maxWidth: .infinity, minHeight: 120, alignment: .leading)
4450 .background(RoundedRectangle(cornerRadius: 32, style: .continuous).fill(color))
4551 }
4652 .buttonStyle(.plain)
53 .accessibilityIdentifier("activity:\(title)")
4754 .simultaneousGesture(TapGesture().onEnded { SpeechSynthesizer.shared.speak(title) })
4855 }
4956}
DayByDay/Home/HomeView.swift +8 −7
@@ -8,13 +8,14 @@ import SwiftUI
88/// Today banner on top, then the topic grid.
99struct HomeView: View {
1010 @Environment(ProfileSession.self) private var session
11 @Environment(\.dynamicTypeSize) private var typeSize
1112 @AppStorage("hasSeenVoiceTip") private var hasSeenVoiceTip = false
1213 @State private var showingParentArea = false
1314
14 private let columns = [
15 GridItem(.flexible(), spacing: 24),
16 GridItem(.flexible(), spacing: 24)
17 ]
15 /// Two square tiles a row; one wide tile at the accessibility text sizes.
16 private var columns: [GridItem] {
17 Array(repeating: GridItem(.flexible(), spacing: 24), count: typeSize.isAccessibilitySize ? 1 : 2)
18 }
1819
1920 var body: some View {
2021 NavigationStack {
@@ -31,7 +32,7 @@ struct HomeView: View {
3132 ForEach(Category.gridCases) { category in
3233 NavigationLink(value: category) {
3334 CategoryTile(category: category)
34 .aspectRatio(1, contentMode: .fit)
35 .aspectRatio(typeSize.isAccessibilitySize ? 2 : 1, contentMode: .fit)
3536 }
3637 .buttonStyle(.plain)
3738 }
@@ -82,8 +83,8 @@ struct HomeView: View {
8283 private func footerButton(_ title: String, systemImage: String, action: @escaping () -> Void) -> some View {
8384 Button(action: action) {
8485 Label(title, systemImage: systemImage)
85 .font(.system(size: 16, weight: .medium, design: .rounded))
86 .foregroundStyle(.secondary)
86 .font(.system(.callout, design: .rounded, weight: .medium))
87 .foregroundStyle(.primary)
8788 .frame(maxWidth: .infinity)
8889 .padding(.vertical, 14)
8990 .background(Color(.systemGray6))
DayByDay/Home/TodayBanner.swift +7 −4
@@ -8,13 +8,17 @@ import SwiftUI
88/// The mascot and today's day and date, at the top of home.
99struct TodayBanner: View {
1010 @Environment(ProfileSession.self) private var session
11 @Environment(\.dynamicTypeSize) private var typeSize
1112 /// Today's sticker, read when home appears.
1213 @State private var sticker: LearnWeather?
1314
1415 static let gradientColors: [Color] = [Color(red: 0.84, green: 0.40, blue: 0.05), Color(red: 0.80, green: 0.45, blue: 0.0)]
1516
1617 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 {
1822 // On white: the orange is too close to the owl's purple.
1923 MascotView(mood: .idle)
2024 .padding(8)
@@ -24,13 +28,12 @@ struct TodayBanner: View {
2428 Text("Today is \(DayOfWeek.current.name)!")
2529 .font(.heading(30, weight: .heavy))
2630 Text(Date.now.formatted(.dateTime.month(.wide).day()))
27 .font(.system(size: 22, weight: .semibold, design: .rounded))
28 .opacity(0.9)
31 .font(.system(.title2, design: .rounded, weight: .bold))
2932 if let sticker {
3033 StickerBadge(weather: sticker).frame(width: 56, height: 56)
3134 } else {
3235 Text("Tap for your sticker!")
33 .font(.heading(18))
36 .font(.heading(20))
3437 }
3538 }
3639 .foregroundStyle(.white)
DayByDay/Mascot/MascotView.swift +1 −1
@@ -98,7 +98,7 @@ private struct OwlDrawing {
9898 beakShape(&context)
9999
100100 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))
102102 .foregroundStyle(MascotStyle.body))
103103 context.draw(mark, at: CGPoint(x: 89, y: 22))
104104 }
DayByDay/MonthCard.swift +12 −9
@@ -21,8 +21,10 @@ struct MonthCard: View {
2121 var body: some View {
2222 ZStack {
2323 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(month.color.gradient)
24 .fill(month.color)
2525 .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)
2628
2729 VStack(spacing: 16) {
2830 Image(systemName: month.symbol)
@@ -34,6 +36,7 @@ struct MonthCard: View {
3436 .font(.heading(32))
3537 .foregroundStyle(.white)
3638 }
39 .padding(16)
3740 }
3841 .overlay {
3942 if isHighlighted {
@@ -41,7 +44,6 @@ struct MonthCard: View {
4144 .strokeBorder(.white, lineWidth: 5)
4245 }
4346 }
44 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
4547 .scaleEffect(cardScale)
4648 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
4749 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -53,6 +55,7 @@ struct MonthCard: View {
5355 isTapped = false
5456 }
5557 }
58 .accessibilityElement(children: .ignore)
5659 .accessibilityLabel(month.name)
5760 .accessibilityAddTraits(.isButton)
5861 }
@@ -109,16 +112,16 @@ nonisolated enum MonthOfYear: Int, CaseIterable, Identifiable {
109112
110113 var color: Color {
111114 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
113116 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
115 case .april: Color(red: 0.5, green: 0.65, blue: 0.9) // rain blue
116 case .may: Color(red: 0.95, green: 0.7, blue: 0.2) // golden
117 case .june: Color(red: 1.0, green: 0.55, blue: 0.25) // warm orange
117 case .march: Color(red: 0.35, green: 0.6, blue: 0.41) // spring green
118 case .april: Color(red: 0.43, green: 0.55, blue: 0.77) // rain blue
119 case .may: Color(red: 0.71, green: 0.52, blue: 0.15) // golden
120 case .june: Color(red: 0.83, green: 0.45, blue: 0.2) // warm orange
118121 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
120123 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
122125 case .november: Color(red: 0.7, green: 0.5, blue: 0.3) // brown
123126 case .december: Color(red: 0.3, green: 0.5, blue: 0.85) // winter blue
124127 }
DayByDay/MonthsOfYearView.swift +1 −1
@@ -17,7 +17,7 @@ struct MonthsOfYearView: View {
1717 LazyVGrid(columns: columns, spacing: 24) {
1818 ForEach(MonthOfYear.allCases) { month in
1919 MonthCard(month: month, isHighlighted: month == .current)
20 .frame(height: 200)
20 .frame(minHeight: 200)
2121 }
2222 }
2323 .padding(32)
DayByDay/Parent/ChildProgressView.swift +1 −1
@@ -26,7 +26,7 @@ struct ChildProgressView: View {
2626 .background(Circle().fill(category.color))
2727 VStack(alignment: .leading, spacing: 4) {
2828 Text(category.label)
29 .font(.system(size: 20, weight: .semibold, design: .rounded))
29 .font(.system(.title3, design: .rounded, weight: .semibold))
3030 if let known = summary.known {
3131 Text(known)
3232 }
DayByDay/Parent/ParentAreaView.swift +6 −2
@@ -30,7 +30,11 @@ struct ParentAreaView: View {
3030 NavigationLink {
3131 ProfileEditorView(profile: nil)
3232 } 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 }
3438 }
3539 }
3640 if !session.profiles.isEmpty {
@@ -78,7 +82,7 @@ private struct ProfileRow: View {
7882 AvatarBadge(avatar: profile.avatar, color: profile.color)
7983 .frame(width: 44, height: 44)
8084 Text(profile.name)
81 .font(.system(size: 20, weight: .semibold, design: .rounded))
85 .font(.system(.title3, design: .rounded, weight: .semibold))
8286 }
8387 }
8488}
DayByDay/Parent/ParentGateView.swift +26 −18
@@ -22,22 +22,25 @@ struct ParentGateView: View {
2222 }
2323
2424 var body: some View {
25 VStack(spacing: 32) {
26 Text("For Grown-Ups")
27 .font(.system(size: 32, weight: .bold, design: .rounded))
25 CenteredScrollView {
26 VStack(spacing: 32) {
27 Text("For Grown-Ups")
28 .font(.system(.largeTitle, design: .rounded, weight: .bold))
2829
29 if held {
30 sumStep
31 } else {
32 holdStep
33 }
30 if held {
31 sumStep
32 } else {
33 holdStep
34 }
3435
35 Button("Cancel", action: onCancel)
36 .font(.system(size: 18, weight: .medium, design: .rounded))
37 .foregroundStyle(.secondary)
36 Button("Cancel", action: onCancel)
37 .font(.system(.body, design: .rounded, weight: .medium))
38 .foregroundStyle(.primary)
39 }
40 .padding(40)
41 .frame(maxWidth: 520)
42 .multilineTextAlignment(.center)
3843 }
39 .padding(40)
40 .frame(maxWidth: 520)
4144 }
4245
4346 private var holdStep: some View {
@@ -67,28 +70,33 @@ struct ParentGateView: View {
6770 }
6871 .accessibilityLabel("Hold for grown-ups")
6972 .accessibilityAddTraits(.isButton)
73 // Assistive technologies skip the hold; the sum still keeps children out.
74 .accessibilityAction {
75 held = true
76 fieldFocused = true
77 }
7078
7179 Text("Press and hold")
72 .font(.system(size: 18, design: .rounded))
73 .foregroundStyle(.secondary)
80 .font(.system(.body, design: .rounded))
81 .fixedSize(horizontal: false, vertical: true)
7482 }
7583 }
7684
7785 private var sumStep: some View {
7886 VStack(spacing: 20) {
7987 Text("What is \(challenge.a) + \(challenge.b)?")
80 .font(.system(size: 26, weight: .semibold, design: .rounded))
88 .font(.system(.title, design: .rounded, weight: .semibold))
8189 TextField("Answer", text: $input)
8290 .keyboardType(.numberPad)
8391 .focused($fieldFocused)
8492 .multilineTextAlignment(.center)
85 .font(.system(size: 28, weight: .bold, design: .rounded))
93 .font(.system(.title, design: .rounded, weight: .bold))
8694 .padding(12)
8795 .frame(width: 160)
8896 .background(Color(.systemGray6), in: RoundedRectangle(cornerRadius: 12))
8997 Button("Continue", action: submit)
9098 .buttonStyle(.borderedProminent)
91 .font(.system(size: 20, weight: .semibold, design: .rounded))
99 .font(.system(.title3, design: .rounded, weight: .semibold))
92100 }
93101 }
94102
DayByDay/Profiles/ProfilePickerView.swift +23 −17
@@ -37,10 +37,15 @@ struct ProfilePickerView: View {
3737 .padding(32)
3838 }
3939 .safeAreaInset(edge: .bottom) {
40 Button("Grown-Ups") { showingParentArea = true }
41 .font(.system(size: 16, weight: .medium, design: .rounded))
42 .foregroundStyle(.secondary)
43 .padding(.bottom, 12)
40 Button { showingParentArea = true } label: {
41 Text("Grown-Ups")
42 .padding(.horizontal, 20)
43 .frame(minHeight: 44)
44 .contentShape(Rectangle())
45 }
46 .font(.system(.callout, design: .rounded, weight: .medium))
47 .foregroundStyle(.primary)
48 .padding(.bottom, 4)
4449 }
4550 .onAppear { SpeechSynthesizer.shared.speak(Lines.whoIsPlaying) }
4651 .sheet(isPresented: $showingParentArea) {
@@ -63,20 +68,21 @@ struct ProfileSetupView: View {
6368 }
6469 }
6570 } else {
66 VStack(spacing: 24) {
67 MascotView(mood: .waving)
68 .frame(width: 160, height: 160)
69 Text("Welcome to Day By Day")
70 .font(.heading(32))
71 Text("Set up a profile for your child.")
72 .font(.system(size: 20, design: .rounded))
73 .foregroundStyle(.secondary)
74 Button("Get Started") { started = true }
75 .buttonStyle(.borderedProminent)
76 .font(.system(size: 22, weight: .semibold, design: .rounded))
71 CenteredScrollView {
72 VStack(spacing: 24) {
73 MascotView(mood: .waving)
74 .frame(width: 160, height: 160)
75 Text("Welcome to Day By Day")
76 .font(.heading(32))
77 Text("Set up a profile for your child.")
78 .font(.system(.title3, design: .rounded))
79 Button("Get Started") { started = true }
80 .buttonStyle(.borderedProminent)
81 .font(.system(.title2, design: .rounded, weight: .semibold))
82 }
83 .padding(40)
84 .multilineTextAlignment(.center)
7785 }
78 .padding(40)
79 .multilineTextAlignment(.center)
8086 }
8187 }
8288}
DayByDay/Quiz/ChoiceTile.swift +1 −3
@@ -101,9 +101,7 @@ struct ChoiceTile: View {
101101 .font(.system(size: 52))
102102 .frame(height: 60)
103103 Text(item.name)
104 .font(.heading(26))
105 .lineLimit(1)
106 .minimumScaleFactor(0.6)
104 .font(.heading(22))
107105 }
108106 .foregroundStyle(.white)
109107 }
DayByDay/Quiz/ClothingTile.swift +1 −3
@@ -16,9 +16,7 @@ struct ClothingTile: View {
1616 .font(.system(size: 56))
1717 .frame(height: 64)
1818 Text(item.name)
19 .font(.heading(24))
20 .lineLimit(1)
21 .minimumScaleFactor(0.6)
19 .font(.heading(22))
2220 }
2321 .foregroundStyle(.white)
2422 .frame(maxWidth: .infinity, maxHeight: .infinity)
DayByDay/Quiz/CountingView.swift +6 −13
@@ -14,6 +14,8 @@ struct CountingView: View {
1414 @State private var speechToken = 0
1515 /// Bumped when the screen goes away, so pending work says nothing.
1616 @State private var generation = 0
17 @ScaledMetric(relativeTo: .largeTitle) private var totalHeight = 110
18 @ScaledMetric(relativeTo: .largeTitle) private var objectHeight = 104
1719
1820 private let columns = [GridItem(.adaptive(minimum: 96, maximum: 140), spacing: 16)]
1921 private let color = Category.numbers.color
@@ -48,22 +50,12 @@ struct CountingView: View {
4850 private var board: some View {
4951 ScrollView {
5052 VStack(spacing: 28) {
51 HStack(spacing: 12) {
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 }
53 PromptBar(mascot: $mascot, prompt: prompt) { ask(after: 0) }
6254
6355 Text(showTotal ? "\(round.target)" : " ")
6456 .font(.heading(96, weight: .heavy))
6557 .foregroundStyle(color)
66 .frame(height: 110)
58 .frame(height: totalHeight)
6759 .accessibilityHidden(!showTotal)
6860
6961 LazyVGrid(columns: columns, spacing: 16) {
@@ -71,6 +63,7 @@ struct CountingView: View {
7163 Button { tap(i) } label: { object(i) }
7264 .buttonStyle(.plain)
7365 .accessibilityLabel(round.thing.singular)
66 .accessibilityValue(round.counted.firstIndex(of: i).map { "\($0 + 1)" } ?? "")
7467 }
7568 }
7669 }
@@ -98,7 +91,7 @@ struct CountingView: View {
9891 .foregroundStyle(color)
9992 }
10093 }
101 .frame(height: 104)
94 .frame(height: objectHeight)
10295 .contentShape(shape)
10396 }
10497
DayByDay/Quiz/FinishedView.swift +16 −14
@@ -12,22 +12,24 @@ struct FinishedView: View {
1212 @State private var speechToken = 0
1313
1414 var body: some View {
15 VStack(spacing: 28) {
16 MascotView(mood: .cheering)
17 .frame(width: 180, height: 180)
18 Text("You did it!")
19 .font(.heading(48, weight: .heavy))
20 Button(action: onPlayAgain) {
21 Label("Play again", systemImage: "arrow.clockwise")
22 .font(.heading(28))
23 .foregroundStyle(.white)
24 .padding(.horizontal, 40)
25 .padding(.vertical, 20)
26 .background(Capsule().fill(RoundStyle.playAgainFill))
15 CenteredScrollView {
16 VStack(spacing: 28) {
17 MascotView(mood: .cheering)
18 .frame(width: 180, height: 180)
19 Text("You did it!")
20 .font(.heading(48, weight: .heavy))
21 Button(action: onPlayAgain) {
22 Label("Play again", systemImage: "arrow.clockwise")
23 .font(.heading(28))
24 .foregroundStyle(.white)
25 .padding(.horizontal, 40)
26 .padding(.vertical, 20)
27 .background(Capsule().fill(RoundStyle.playAgainFill))
28 }
29 .buttonStyle(.plain)
2730 }
28 .buttonStyle(.plain)
31 .padding(32)
2932 }
30 .padding(32)
3133 .onAppear {
3234 SoundEngine.shared.play(.roundComplete)
3335 speechToken += 1
DayByDay/Quiz/MovesView.swift +13 −21
@@ -25,29 +25,21 @@ struct MovesView: View {
2525 var body: some View {
2626 ZStack {
2727 if let part = round.current {
28 VStack(spacing: 32) {
29 HStack(spacing: 12) {
30 GameMascot(state: $mascot)
31 Button { start() } label: {
32 Label("Hear it again", systemImage: "speaker.wave.2.fill")
33 .font(.heading(24))
34 .padding(.horizontal, 28)
35 .padding(.vertical, 16)
36 .background(Capsule().fill(Color(.systemGray6)))
37 }
38 .buttonStyle(.plain)
28 CenteredScrollView {
29 VStack(spacing: 32) {
30 PromptBar(mascot: $mascot) { start() }
31 Image(systemName: part.symbol)
32 .font(.system(size: 140))
33 .foregroundStyle(.white)
34 .frame(width: 240, height: 240)
35 .background(RoundedRectangle(cornerRadius: 40, style: .continuous).fill(Category.bodyParts.color))
36 .accessibilityLabel(part.name)
37 Text(part.command)
38 .font(.heading(30, weight: .heavy))
39 .multilineTextAlignment(.center)
3940 }
40 Image(systemName: part.symbol)
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)
41 .padding(24)
4942 }
50 .padding(24)
5143 .overlay { CelebrationOverlay(isActive: celebrating) }
5244 } else {
5345 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 {
1818 private let choice: (QuizItem) -> Choice
1919
2020 @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
2123 @State private var round: Round
2224 @State private var praise = PraisePhrases()
2325 @State private var celebrating = false
@@ -27,7 +29,9 @@ struct RoundView<Choice: View>: View {
2729 /// been overtaken stays quiet.
2830 @State private var speechToken = 0
2931
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 }
3135
3236 init(source: any QuestionSource, game: Game, @ViewBuilder choice: @escaping (QuizItem) -> Choice) {
3337 self.source = source
@@ -55,19 +59,7 @@ struct RoundView<Choice: View>: View {
5559 private var question: some View {
5660 ScrollView {
5761 VStack(spacing: 28) {
58 HStack(spacing: 12) {
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 }
62 PromptBar(mascot: $mascot, prompt: round.current.prompt, action: speakPrompt)
7163
7264 ProgressDots(filled: round.correctCount, total: Round.length)
7365
@@ -79,7 +71,7 @@ struct RoundView<Choice: View>: View {
7971 ForEach(round.current.choices) { item in
8072 Button { tap(item) } label: {
8173 choice(item)
82 .frame(height: 160)
74 .frame(minHeight: 160)
8375 .opacity(dimmed == item ? 0.4 : 1)
8476 }
8577 .buttonStyle(.plain)
DayByDay/Quiz/SequencePuzzleView.swift +36 −37
@@ -12,6 +12,8 @@ struct SequencePuzzleView: View {
1212 let make: () -> SequencePuzzle
1313
1414 @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
1517 @State private var puzzle: SequencePuzzle
1618 @State private var praise = PraisePhrases()
1719 @State private var dimmed: QuizItem?
@@ -24,7 +26,7 @@ struct SequencePuzzleView: View {
2426 /// Counts finished games, so a timer from an earlier game is ignored.
2527 @State private var solves = 0
2628
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)] }
2830
2931 init(game: Game, make: @escaping () -> SequencePuzzle) {
3032 self.game = game
@@ -55,17 +57,7 @@ struct SequencePuzzleView: View {
5557 private var board: some View {
5658 ScrollView {
5759 VStack(spacing: 28) {
58 HStack(spacing: 12) {
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 }
60 PromptBar(mascot: $mascot, prompt: puzzle.current?.prompt) { ask(after: 0) }
6961
7062 slots
7163 .dropDestination(for: String.self) { ids, _ in
@@ -80,14 +72,14 @@ struct SequencePuzzleView: View {
8072 let isPlaced = puzzle.placed.contains(item)
8173 Button { place(item) } label: {
8274 ChoiceTile(item: item)
83 .frame(height: 130)
75 .frame(height: card)
8476 .opacity(isPlaced ? 0 : dimmed == item ? 0.4 : 1)
8577 }
8678 .buttonStyle(.plain)
8779 .disabled(isPlaced)
8880 .accessibilityHidden(isPlaced)
8981 .draggable(item.id) {
90 ChoiceTile(item: item).frame(width: 130, height: 130)
82 ChoiceTile(item: item).frame(width: card, height: card)
9183 }
9284 .accessibilityLabel(item.name)
9385 }
@@ -101,27 +93,20 @@ struct SequencePuzzleView: View {
10193 @ViewBuilder
10294 private var slots: some View {
10395 if let labels = puzzle.slotLabels {
104 HStack(alignment: .top, spacing: 12) {
105 ForEach(Array(labels.enumerated()), id: \.offset) { i, label in
106 VStack(spacing: 8) {
107 Text(label)
108 .font(.heading(20))
109 .lineLimit(1)
110 .minimumScaleFactor(0.6)
111 slot(i).frame(height: 130)
112 }
113 .frame(maxWidth: .infinity)
114 }
96 // Stacked when the labels no longer fit side by side.
97 ViewThatFits(in: .horizontal) {
98 HStack(alignment: .top, spacing: 12) { labeledSlots(labels) }
99 VStack(spacing: 16) { labeledSlots(labels) }
115100 }
116101 } else {
117102 ScrollViewReader { proxy in
118103 ScrollView(.horizontal, showsIndicators: false) {
119104 HStack(alignment: .bottom, spacing: 6) {
120105 TrainEngine()
121 .frame(width: 130, height: 150)
106 .frame(width: card, height: card * 15 / 14)
122107 ForEach(puzzle.steps.indices, id: \.self) { i in
123108 TrainCar { slot(i) }
124 .frame(width: 130, height: 150)
109 .frame(width: card, height: card * 15 / 14)
125110 .id(i)
126111 }
127112 }
@@ -138,22 +123,36 @@ struct SequencePuzzleView: View {
138123 }
139124 }
140125
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
141137 private var nextCar: Int { min(puzzle.placed.count, puzzle.steps.count - 1) }
142138
143139 /// A placed card, the outlined next slot, or a faint empty slot.
144 @ViewBuilder
145140 private func slot(_ i: Int) -> some View {
146141 let shape = RoundedRectangle(cornerRadius: 24, style: .continuous)
147 if i < puzzle.placed.count {
148 ChoiceTile(item: puzzle.placed[i])
149 } else {
150 shape
151 .fill(Color(.systemGray6))
152 .overlay {
153 shape.strokeBorder(i == puzzle.placed.count ? Category.days.color : Color(.systemGray3),
154 style: StrokeStyle(lineWidth: i == puzzle.placed.count ? 5 : 2, dash: [10, 8]))
155 }
142 return Group {
143 if i < puzzle.placed.count {
144 ChoiceTile(item: puzzle.placed[i])
145 } else {
146 shape
147 .fill(Color(.systemGray6))
148 .overlay {
149 shape.strokeBorder(i == puzzle.placed.count ? Category.days.color : Color(.systemGray3),
150 style: StrokeStyle(lineWidth: i == puzzle.placed.count ? 5 : 2, dash: [10, 8]))
151 }
152 }
156153 }
154 .accessibilityElement(children: .ignore)
155 .accessibilityLabel(i < puzzle.placed.count ? puzzle.placed[i].name : "Empty")
157156 }
158157
159158 private func place(_ item: QuizItem) {
DayByDay/Quiz/SortView.swift +6 −12
@@ -13,6 +13,7 @@ enum SortStyle {
1313/// "Fruit or vegetable?": tap a bin, or drag the food into it.
1414struct SortView: View {
1515 @Environment(ProfileSession.self) private var session
16 @Environment(\.dynamicTypeSize) private var typeSize
1617 @State private var round: SortRound
1718 @State private var praise = PraisePhrases()
1819 @State private var celebrating = false
@@ -54,17 +55,7 @@ struct SortView: View {
5455 private var board: some View {
5556 ScrollView {
5657 VStack(spacing: 28) {
57 HStack(spacing: 12) {
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 }
58 PromptBar(mascot: $mascot, prompt: round.prompt) { ask(after: 0) }
6859
6960 if let food = round.current {
7061 let item = Category.food.item(food)
@@ -75,7 +66,9 @@ struct SortView: View {
7566 .accessibilityLabel(food.name)
7667 }
7768
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 {
7972 bin(isFruit: true)
8073 bin(isFruit: false)
8174 }
@@ -107,6 +100,7 @@ struct SortView: View {
107100 return true
108101 }
109102 .accessibilityLabel(isFruit ? "Fruit" : "Vegetables")
103 .accessibilityValue(contents.map(\.name).joined(separator: ", "))
110104 }
111105
112106 private func place(isFruit: Bool) {
DayByDay/Quiz/TraceView.swift +38 −23
@@ -60,9 +60,10 @@ struct TraceView: View {
6060 VStack(spacing: 20) {
6161 // Own row: beside both pills it would squeeze their labels on a phone.
6262 GameMascot(state: $mascot)
63 HStack(spacing: 16) {
64 pill("Hear it again", "speaker.wave.2.fill", action: prompt)
65 pill("Start over", "eraser.fill") { strokes = [] }
63 // Stacked when side by side would cut the labels off.
64 ViewThatFits(in: .horizontal) {
65 HStack(spacing: 16) { pills }
66 VStack(spacing: 12) { pills }
6667 }
6768 GeometryReader { geo in
6869 let size = min(geo.size.width, geo.size.height)
@@ -88,7 +89,11 @@ struct TraceView: View {
8889 .onEnded { _ in check(item, size: size) }
8990 )
9091 .frame(maxWidth: .infinity, maxHeight: .infinity)
92 // VoiceOver, Voice Control and Switch Control users trace by activating the guide.
93 .accessibilityElement()
9194 .accessibilityLabel("Trace \(Lines.traceLabel(item))")
95 .accessibilityAddTraits(.isButton)
96 .accessibilityAction { succeed(item) }
9297 }
9398 .frame(maxWidth: 520)
9499 }
@@ -96,15 +101,20 @@ struct TraceView: View {
96101 .overlay { CelebrationOverlay(isActive: celebrating) }
97102 }
98103
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
99110 private func pill(_ title: String, _ symbol: String, action: @escaping () -> Void) -> some View {
100111 Button(action: action) {
101112 Label(title, systemImage: symbol)
102113 .font(.heading(19))
103 .lineLimit(1)
104 .minimumScaleFactor(0.7)
114 .fixedSize(horizontal: false, vertical: true)
105115 .padding(.horizontal, 20)
106116 .padding(.vertical, 14)
107 .background(Capsule().fill(Color(.systemGray6)))
117 .background(RoundedRectangle(cornerRadius: 26, style: .continuous).fill(Color(.systemGray6)))
108118 }
109119 .buttonStyle(.plain)
110120 }
@@ -115,23 +125,7 @@ struct TraceView: View {
115125 let drawn = strokes.flatMap { $0 }
116126 let score = checker.score(drawn)
117127 if checker.passes(drawn) {
118 record(item, correct: true)
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)
128 succeed(item)
135129 } else if score.accuracy < 0.5 && score.coverage > 0.4 {
136130 record(item, correct: false)
137131 SoundEngine.shared.play(.gentleMiss)
@@ -141,6 +135,27 @@ struct TraceView: View {
141135 }
142136 }
143137
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
144159 private func record(_ item: QuizItem, correct: Bool) {
145160 if let profile = session.current {
146161 session.store.record(item, game: .trace, correct: correct, for: profile)
DayByDay/Quiz/YearWheelView.swift +3 −1
@@ -75,12 +75,14 @@ struct YearWheelView: View {
7575 }
7676 .accessibilityLabel(month.name)
7777 .accessibilityAddTraits(.isButton)
78 // Part of the picture: sized to the wedge, not the text size.
7879 Text(month.name.prefix(3))
79 .font(.heading(size * 0.06, weight: .heavy))
80 .font(.custom(HeadingFont.extraBold, fixedSize: size * 0.06))
8081 .foregroundStyle(.white)
8182 .offset(y: -size * 0.38)
8283 .rotationEffect(.degrees(center))
8384 .allowsHitTesting(false)
85 .accessibilityHidden(true)
8486 }
8587 Circle()
8688 .fill(Color(.systemBackground))
DayByDay/Screenshots/ScreenshotScene.swift +15 −2
@@ -8,9 +8,11 @@ import SwiftUI
88
99/// App Store screens, opened by `scripts/take-screenshots.sh` with
1010/// `-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.
1213enum ScreenshotScene: String, CaseIterable {
1314 case home, routine, animals, train, trace, counting, calendar, progress
15 case setup, picker
1416
1517 static var requested: ScreenshotScene? {
1618 let args = ProcessInfo.processInfo.arguments
@@ -21,7 +23,7 @@ enum ScreenshotScene: String, CaseIterable {
2123 @ViewBuilder @MainActor
2224 func view(_ session: ProfileSession) -> some View {
2325 switch self {
24 case .home:
26 case .home, .setup, .picker:
2527 ContentView()
2628 case .routine:
2729 NavigationStack { TodayRoutineView().navigationTitle(Category.today.label) }
@@ -57,6 +59,17 @@ enum ScreenshotScene: String, CaseIterable {
5759 /// earlier days this month, and answers that leave a few months to practice.
5860 @MainActor
5961 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 }
6073 let today = calendar.dateComponents([.year, .month, .day], from: now)
6174 guard let olive = try? session.store.create(name: "Olive", avatar: .hare, color: .teal,
6275 birthday: (month: today.month!, day: today.day! == 28 ? 27 : 28)) else { return }
DayByDay/SeasonCard.swift +9 −6
@@ -21,8 +21,10 @@ struct SeasonCard: View {
2121 var body: some View {
2222 ZStack {
2323 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(season.color.gradient)
24 .fill(season.color)
2525 .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)
2628
2729 VStack(spacing: 16) {
2830 Image(systemName: season.symbol)
@@ -34,6 +36,7 @@ struct SeasonCard: View {
3436 .font(.heading(32))
3537 .foregroundStyle(.white)
3638 }
39 .padding(16)
3740 }
3841 .overlay {
3942 if isHighlighted {
@@ -41,7 +44,6 @@ struct SeasonCard: View {
4144 .strokeBorder(.white, lineWidth: 5)
4245 }
4346 }
44 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
4547 .scaleEffect(cardScale)
4648 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
4749 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -53,6 +55,7 @@ struct SeasonCard: View {
5355 isTapped = false
5456 }
5557 }
58 .accessibilityElement(children: .ignore)
5659 .accessibilityLabel(season.name)
5760 .accessibilityAddTraits(.isButton)
5861 }
@@ -98,10 +101,10 @@ nonisolated enum Season: Int, CaseIterable, Identifiable {
98101
99102 var color: Color {
100103 switch self {
101 case .spring: Color(red: 0.45, green: 0.8, blue: 0.5) // fresh green
102 case .summer: Color(red: 1.0, green: 0.6, blue: 0.15) // sunny orange
103 case .fall: Color(red: 0.85, green: 0.45, blue: 0.2) // autumn orange
104 case .winter: Color(red: 0.4, green: 0.65, blue: 0.95) // cool blue
104 case .spring: Color(red: 0.35, green: 0.61, blue: 0.38) // fresh green
105 case .summer: Color(red: 0.79, green: 0.47, blue: 0.12) // sunny orange
106 case .fall: Color(red: 0.84, green: 0.45, blue: 0.2) // autumn orange
107 case .winter: Color(red: 0.35, green: 0.56, blue: 0.82) // cool blue
105108 }
106109 }
107110}
DayByDay/SeasonsView.swift +1 −1
@@ -17,7 +17,7 @@ struct SeasonsView: View {
1717 LazyVGrid(columns: columns, spacing: 24) {
1818 ForEach(Season.allCases) { season in
1919 SeasonCard(season: season, isHighlighted: season == .current)
20 .frame(height: 200)
20 .frame(minHeight: 200)
2121 }
2222 }
2323 .padding(32)
DayByDay/Today/StickerCalendarView.swift +4 −1
@@ -71,6 +71,7 @@ struct StickerCalendarView: View {
7171 LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 6), count: 7), spacing: 6) {
7272 ForEach(Array(["S", "M", "T", "W", "T", "F", "S"].enumerated()), id: \.offset) { _, d in
7373 Text(d).font(.heading(16)).foregroundStyle(.primary)
74 .accessibilityHidden(true)
7475 }
7576 ForEach(Array(grid.cells.enumerated()), id: \.offset) { _, day in
7677 if let day {
@@ -80,6 +81,8 @@ struct StickerCalendarView: View {
8081 }
8182 }
8283 }
84 // Seven columns leave no room for larger dates; VoiceOver reads each one in full.
85 .dynamicTypeSize(...DynamicTypeSize.accessibility1)
8386 }
8487 .padding(16)
8588 }
@@ -98,7 +101,7 @@ struct StickerCalendarView: View {
98101 .background(Circle().fill(Color(.systemBackground)))
99102 }
100103 } else {
101 Text("\(day)").font(.system(size: 18, weight: .semibold, design: .rounded))
104 Text("\(day)").font(.system(.body, design: .rounded, weight: .semibold))
102105 }
103106 }
104107 .frame(height: 48)
DayByDay/Today/TodayRoutineView.swift +29 −37
@@ -74,34 +74,36 @@ struct TodayRoutineView: View {
7474 }
7575
7676 private func lineCard(_ line: RoutineScript.Line) -> some View {
77 VStack(spacing: 28) {
78 hearAgain
79 VStack(spacing: 20) {
80 Image(systemName: line.symbol)
81 .font(.system(size: 110))
82 .frame(height: 130)
83 Text(line.text)
84 .font(.heading(32, weight: .heavy))
85 .multilineTextAlignment(.center)
86 .minimumScaleFactor(0.6)
87 }
88 .foregroundStyle(.white)
89 .padding(28)
90 .frame(maxWidth: 520, minHeight: 300)
91 .background(RoundedRectangle(cornerRadius: 36, style: .continuous).fill(TodayBanner.gradientColors[0]))
92 .accessibilityElement(children: .combine)
93
94 Button(action: next) {
95 Image(systemName: "arrow.right")
96 .font(.system(size: 40, weight: .heavy))
97 .foregroundStyle(.white)
98 .frame(width: 96, height: 96)
99 .background(Circle().fill(RoundStyle.playAgainFill))
77 CenteredScrollView {
78 VStack(spacing: 28) {
79 hearAgain
80 VStack(spacing: 20) {
81 Image(systemName: line.symbol)
82 .font(.system(size: 110))
83 .frame(height: 130)
84 Text(line.text)
85 .font(.heading(32, weight: .heavy))
86 .multilineTextAlignment(.center)
87 .minimumScaleFactor(0.6)
88 }
89 .foregroundStyle(.white)
90 .padding(28)
91 .frame(maxWidth: 520, minHeight: 300)
92 .background(RoundedRectangle(cornerRadius: 36, style: .continuous).fill(TodayBanner.gradientColors[0]))
93 .accessibilityElement(children: .combine)
94
95 Button(action: next) {
96 Image(systemName: "arrow.right")
97 .font(.system(size: 40, weight: .heavy))
98 .foregroundStyle(.white)
99 .frame(width: 96, height: 96)
100 .background(Circle().fill(RoundStyle.playAgainFill))
101 }
102 .buttonStyle(.plain)
103 .accessibilityLabel("Next")
100104 }
101 .buttonStyle(.plain)
102 .accessibilityLabel("Next")
105 .padding(24)
103106 }
104 .padding(24)
105107 }
106108
107109 private var weatherPick: some View {
@@ -123,17 +125,7 @@ struct TodayRoutineView: View {
123125 }
124126
125127 private var hearAgain: some View {
126 HStack(spacing: 12) {
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 }
128 PromptBar(mascot: $mascot, action: speakCurrent)
137129 }
138130
139131 private func next() {
DayByDayTests/ContrastTests.swift +32
@@ -68,6 +68,38 @@ struct ContrastTests {
6868 #expect(contrast(SortStyle.binFill, .black, .dark) >= 3)
6969 }
7070
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
71103 @Test(arguments: DayOfWeek.allCases) func dayColorAgainstWhite(_ day: DayOfWeek) {
72104 #expect(contrast(day.color, .white, .light) >= 3, "\(day)")
73105 }
DayByDayTests/HeadingFontTests.swift +8
@@ -10,4 +10,12 @@ struct HeadingFontTests {
1010 #expect(UIFont(name: HeadingFont.bold, size: 20) != nil)
1111 #expect(UIFont(name: HeadingFont.extraBold, size: 20) != nil)
1212 }
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 }
1321}
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 {
1515 var body: some View {
1616 ZStack {
1717 RoundedRectangle(cornerRadius: 32, style: .continuous)
18 .fill(food.color.gradient)
18 .fill(food.color)
1919 .shadow(color: food.color.opacity(0.4), radius: 8, y: 4)
2020
2121 VStack(spacing: 16) {
@@ -26,6 +26,7 @@ struct FoodCard: View {
2626 .font(.heading(28))
2727 .foregroundStyle(.white)
2828 }
29 .padding(16)
2930 }
3031 .scaleEffect(isTapped ? 1.12 : 1.0)
3132 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -38,6 +39,7 @@ struct FoodCard: View {
3839 isTapped = false
3940 }
4041 }
42 .accessibilityElement(children: .ignore)
4143 .accessibilityLabel(food.name)
4244 .accessibilityAddTraits(.isButton)
4345 }
@@ -96,17 +98,17 @@ nonisolated enum LearnFood: Int, CaseIterable, Identifiable {
9698 var color: Color {
9799 switch self {
98100 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
100 case .carrot: Color(red: 1.0, green: 0.55, blue: 0.15) // orange
101 case .banana: Color(red: 0.64, green: 0.54, blue: 0.14) // yellow
102 case .carrot: Color(red: 0.83, green: 0.45, blue: 0.12) // orange
101103 case .strawberry: Color(red: 0.9, green: 0.25, blue: 0.3) // strawberry red
102104 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
104 case .broccoli: Color(red: 0.3, green: 0.65, blue: 0.3) // green
105 case .watermelon: Color(red: 0.35, green: 0.7, blue: 0.4) // watermelon green
105 case .lemon: Color(red: 0.62, green: 0.55, blue: 0.14) // lemon yellow
106 case .broccoli: Color(red: 0.29, green: 0.62, blue: 0.29) // green
107 case .watermelon: Color(red: 0.31, green: 0.61, blue: 0.36) // watermelon green
106108 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
108 case .corn: Color(red: 0.9, green: 0.75, blue: 0.2) // golden yellow
109 case .pear: Color(red: 0.55, green: 0.75, blue: 0.3) // pear green
109 case .orange: Color(red: 0.79, green: 0.47, blue: 0.12) // orange
110 case .corn: Color(red: 0.65, green: 0.54, blue: 0.15) // golden yellow
111 case .pear: Color(red: 0.45, green: 0.6, blue: 0.24) // pear green
110112 }
111113 }
112114}
FoodView.swift +1 −1
@@ -16,7 +16,7 @@ struct FoodView: View {
1616 LazyVGrid(columns: columns, spacing: 24) {
1717 ForEach(LearnFood.allCases) { food in
1818 FoodCard(food: food)
19 .frame(height: 200)
19 .frame(minHeight: 200)
2020 }
2121 }
2222 .padding(32)
LetterCard.swift +1
@@ -32,6 +32,7 @@ struct LetterCard: View {
3232 isTapped = false
3333 }
3434 }
35 .accessibilityElement(children: .ignore)
3536 .accessibilityLabel(letter.spokenName)
3637 .accessibilityAddTraits(.isButton)
3738 }
NumberCard.swift +11 −8
@@ -21,8 +21,10 @@ struct NumberCard: View {
2121 var body: some View {
2222 ZStack {
2323 RoundedRectangle(cornerRadius: 32, style: .continuous)
24 .fill(number.color.gradient)
24 .fill(number.color)
2525 .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)
2628
2729 VStack(spacing: 10) {
2830 Text("\(number.numeral)")
@@ -37,6 +39,7 @@ struct NumberCard: View {
3739 DotPattern(count: number.numeral)
3840 .padding(.top, 4)
3941 }
42 .padding(16)
4043 }
4144 .overlay {
4245 if isHighlighted {
@@ -44,7 +47,6 @@ struct NumberCard: View {
4447 .strokeBorder(.white, lineWidth: 5)
4548 }
4649 }
47 .shadow(color: isHighlighted ? .white.opacity(0.8) : .clear, radius: 12)
4850 .scaleEffect(cardScale)
4951 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
5052 .rotation3DEffect(.degrees(isTapped ? 6 : 0), axis: (x: 1, y: 0, z: 0))
@@ -56,6 +58,7 @@ struct NumberCard: View {
5658 isTapped = false
5759 }
5860 }
61 .accessibilityElement(children: .ignore)
5962 .accessibilityLabel(number.name)
6063 .accessibilityAddTraits(.isButton)
6164 }
@@ -94,15 +97,15 @@ nonisolated enum LearnNumber: Int, CaseIterable, Identifiable {
9497 var color: Color {
9598 switch self {
9699 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
98 case .three: Color(red: 1.0, green: 0.8, blue: 0.2) // yellow
99 case .four: Color(red: 0.35, green: 0.75, blue: 0.4) // green
100 case .five: Color(red: 0.2, green: 0.7, blue: 0.85) // sky blue
100 case .two: Color(red: 0.83, green: 0.45, blue: 0.16) // orange
101 case .three: Color(red: 0.67, green: 0.53, blue: 0.14) // yellow
102 case .four: Color(red: 0.29, green: 0.62, blue: 0.33) // green
103 case .five: Color(red: 0.17, green: 0.6, blue: 0.72) // sky blue
101104 case .six: Color(red: 0.4, green: 0.45, blue: 0.9) // blue
102105 case .seven: Color(red: 0.6, green: 0.4, blue: 0.85) // purple
103106 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
105 case .ten: Color(red: 0.25, green: 0.8, blue: 0.75) // teal
107 case .nine: Color(red: 0.4, green: 0.6, blue: 0.36) // lime
108 case .ten: Color(red: 0.19, green: 0.61, blue: 0.57) // teal
106109 }
107110 }
108111}
NumbersView.swift +1 −1
@@ -20,7 +20,7 @@ struct NumbersView: View {
2020 number: number,
2121 isHighlighted: number == .current
2222 )
23 .frame(height: 200)
23 .frame(minHeight: 200)
2424 }
2525 }
2626 .padding(32)
README.org +6
@@ -18,6 +18,12 @@ Settings > Accessibility > Read & Speak > Voices.
1818* release
1919=scripts/take-screenshots.sh= retakes =AppStore/screenshots= on the iPhone 18 Pro Max
2020and 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.
2127
2228=scripts/release-ios.sh= archives the app and uploads it to App Store Connect for
2329TestFlight, from a clean =main=, signed through the Apple ID in Xcode (Xcode >
ShapeCard.swift +7 −5
@@ -14,7 +14,7 @@ struct ShapeCard: View {
1414 var body: some View {
1515 ZStack {
1616 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(shape.color.gradient)
17 .fill(shape.color)
1818 .shadow(color: shape.color.opacity(0.4), radius: 8, y: 4)
1919
2020 VStack(spacing: 16) {
@@ -26,6 +26,7 @@ struct ShapeCard: View {
2626 .font(.heading(32))
2727 .foregroundStyle(.white)
2828 }
29 .padding(16)
2930 }
3031 .scaleEffect(isTapped ? 1.12 : 1.0)
3132 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -38,6 +39,7 @@ struct ShapeCard: View {
3839 isTapped = false
3940 }
4041 }
42 .accessibilityElement(children: .ignore)
4143 .accessibilityLabel(shape.name)
4244 .accessibilityAddTraits(.isButton)
4345 }
@@ -106,12 +108,12 @@ nonisolated enum LearnShape: Int, CaseIterable, Identifiable {
106108 switch self {
107109 case .circle: Color(red: 0.9, green: 0.3, blue: 0.3) // red
108110 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
110 case .star: Color(red: 1.0, green: 0.75, blue: 0.15) // gold
111 case .triangle: Color(red: 0.29, green: 0.62, blue: 0.38) // green
112 case .star: Color(red: 0.7, green: 0.52, blue: 0.11) // gold
111113 case .heart: Color(red: 0.9, green: 0.35, blue: 0.5) // pink
112114 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
114 case .rectangle: Color(red: 1.0, green: 0.55, blue: 0.2) // orange
115 case .diamond: Color(red: 0.16, green: 0.6, blue: 0.64) // teal
116 case .rectangle: Color(red: 0.83, green: 0.45, blue: 0.16) // orange
115117 }
116118 }
117119}
ShapesView.swift +1 −1
@@ -17,7 +17,7 @@ struct ShapesView: View {
1717 LazyVGrid(columns: columns, spacing: 24) {
1818 ForEach(LearnShape.allCases) { shape in
1919 ShapeCard(shape: shape)
20 .frame(height: 200)
20 .frame(minHeight: 200)
2121 }
2222 }
2323 .padding(32)
WeatherCard.swift +9 −7
@@ -14,7 +14,7 @@ struct WeatherCard: View {
1414 var body: some View {
1515 ZStack {
1616 RoundedRectangle(cornerRadius: 32, style: .continuous)
17 .fill(weather.color.gradient)
17 .fill(weather.color)
1818 .shadow(color: weather.color.opacity(0.4), radius: 8, y: 4)
1919
2020 VStack(spacing: 16) {
@@ -27,6 +27,7 @@ struct WeatherCard: View {
2727 .font(.heading(32))
2828 .foregroundStyle(.white)
2929 }
30 .padding(16)
3031 }
3132 .scaleEffect(isTapped ? 1.12 : 1.0)
3233 .contentShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
@@ -39,6 +40,7 @@ struct WeatherCard: View {
3940 isTapped = false
4041 }
4142 }
43 .accessibilityElement(children: .ignore)
4244 .accessibilityLabel(weather.name)
4345 .accessibilityAddTraits(.isButton)
4446 }
@@ -79,14 +81,14 @@ nonisolated enum LearnWeather: Int, CaseIterable, Identifiable {
7981
8082 var color: Color {
8183 switch self {
82 case .sunny: Color(red: 1.0, green: 0.7, blue: 0.2) // orange
83 case .cloudy: Color(red: 0.6, green: 0.6, blue: 0.65) // gray
84 case .rainy: Color(red: 0.3, green: 0.6, blue: 0.9) // blue
85 case .snowy: Color(red: 0.55, green: 0.8, blue: 0.95) // light blue
86 case .windy: Color(red: 0.25, green: 0.7, blue: 0.7) // teal
84 case .sunny: Color(red: 0.73, green: 0.51, blue: 0.15) // orange
85 case .cloudy: Color(red: 0.55, green: 0.55, blue: 0.6) // gray
86 case .rainy: Color(red: 0.28, green: 0.57, blue: 0.85) // blue
87 case .snowy: Color(red: 0.4, green: 0.57, blue: 0.68) // light blue
88 case .windy: Color(red: 0.21, green: 0.61, blue: 0.61) // teal
8789 case .stormy: Color(red: 0.2, green: 0.3, blue: 0.6) // dark blue
8890 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
9092 }
9193 }
9294}
WeatherView.swift +1 −1
@@ -31,7 +31,7 @@ struct WeatherView: View {
3131 LazyVGrid(columns: columns, spacing: 24) {
3232 ForEach(LearnWeather.allCases) { weather in
3333 WeatherCard(weather: weather)
34 .frame(height: 200)
34 .frame(minHeight: 200)
3535 }
3636 }
3737 .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 @@
44# build's -screenshot launch argument (DayByDay/Screenshots/ScreenshotScene.swift) on a demo
55# child. The 6.3" set is resized from the 6.9" one; every PNG is flattened to RGB.
66# 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.
79set -eu
810
911cd "$(dirname "$0")/.."
1012all="home routine animals train trace counting calendar progress"
1113scenes="${*:-$all}"
12out=AppStore/screenshots
14size="${TEXT_SIZE:-}"
15out=AppStore/screenshots${size:+-$size}
1316derived=.build/screenshots
1417app="$derived/Build/Products/Debug-iphonesimulator/DayByDay.app"
1518bundle=net.cleberg.DayByDay
@@ -34,14 +37,16 @@ shoot() { # device name, output folder
3437 xcrun simctl boot "$device" 2>/dev/null || true
3538 xcrun simctl bootstatus "$device" -b >/dev/null
3639 xcrun simctl ui "$device" appearance light
37 xcrun simctl status_bar "$device" override --time 9:41 --dataNetwork wifi --wifiMode active \
38 --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100
40 xcrun simctl ui "$device" content_size "${size:-large}"
3941 xcrun simctl install "$device" "$app"
4042 mkdir -p "$out/$2"
4143 for scene in $scenes; do
4244 n="$(printf '%s\n' $all | grep -nx "$scene" | cut -d: -f1)"
4345 [ -n "$n" ] || { echo "Unknown scene $scene; one of: $all" >&2; exit 1; }
4446 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
4550 xcrun simctl launch "$device" "$bundle" -screenshot "$scene" -hasSeenVoiceTip YES >/dev/null
4651 file="$out/$2/$(printf %02d "$n")-$scene.png"
4752 # 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
5863 done
5964 xcrun simctl terminate "$device" "$bundle" 2>/dev/null || true
6065 xcrun simctl status_bar "$device" clear
66 xcrun simctl ui "$device" content_size large
6167}
6268
6369shoot "iPhone 18 Pro Max" iphone-6.9