Your First iOS & SwiftUI App: Polishing the App

Mar 1 2022 Swift 5.5, iOS 15, Xcode 13

Part 1: SwiftUI Views & View Modifiers

5. Challenge: Colors & Dark Mode

Lesson Complete

Play Next Lesson
Next
Save for later
About this episode
See versions

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 4. Dark Mode Next episode: 6. Extract Views

This video was last updated on Mar 1 2022

Now that you have some experience with creating colors in the asset catalogue for both light mode and dark mode, and applying them to views, it’s time to try this out for yourself.

It turns out if you look at Luke’s design, you’ll see that he’s not using the default black color for the text labels in the light mode version of the app; instead, it’s a subtle dark gray.

Your challenge is to add a new color to the asset catalogue for the text views, and then apply that to all the views in the app. Make sure the color of the text views is just the way Luke specified in both light and dark mode.

Pause the video and give it a shot. Good luck!

Add a new Color set called Text Color.

Set Any Appearance to #191919.

Apply this to all Text Views:

.foregroundColor(Color("TextColor"))

Show how you can test that it works by setting it to a more obvious color, then back.