Your First iOS & SwiftUI App: Polishing the App

Mar 1 2022 · Swift 5.5, iOS 15, Xcode 13

Part 1: SwiftUI Views & View Modifiers

05. Challenge: Colors & Dark Mode

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 04. Dark Mode Next episode: 06. Extract Views
Transcript: 05. Challenge: Colors & Dark Mode

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.