iOS Foundation (2023) Module 4 dark mode setting

Hello, I’m noticing that for the Guidebook module (module 4), Chris’s app has dark mode setting turned on. How do you activate this setting?

Please let me know.

Thank you,
Scott

@Scott.s.jeong

Hi Scott,

Welcome to the community.

If you are running your code in the Preview canvas you can add the following modifier to your Preview like this:

ContentView()
    .preferredColorScheme(.dark)

If you are running the code on your simulator then with your simulator as the active window, use the keyboard shortcut Shift + Command + A to toggle the simulator between light mode and dark mode.

magic! thank you very much Chris :pray:

1 Like