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