Photo App vs Dark Mode

Hi everyone,
Ive just finished PhotoApp Lesson today and everything was working perfectly fine on the simulator. However, when I run the app on my phone, all the white background turned to black. It takes me quite of longtime to figure it out because my phone’s dark mode was on.
If you don’t want to make the same mistake as I did and run your app without effected by dark mode, you can just add:

override func viewDidLoad() {
    super.viewDidLoad()

        overrideUserInterfaceStyle = .light

    }

for more information pls visit https://developer.apple.com/documentation/xcode/supporting_dark_mode_in_your_interface/choosing_a_specific_interface_style_for_your_ios_app

1 Like

The challenge now is to adapt the App for Dark and Light mode.

You can do that by making sure that the background and foreground colours are set to systemBackground and systemForeground respectively which will change the App appearance automatically when you switch from Dark to Light mode.

You might also have to change the dateLabel colour to be systemGrayColor so that it adapts automatically as well.

1 Like