Search code examples
swiftxcodeios-darkmode

How to change just my app between light and dark mode


I want to have a dark mode option within the settings page of my Xcode swift app. Is it possible to change dark mode just for the app, on all view controllers in the app? I have my dark colors selected in 'Assets.xcassets'


Solution

  • If you want to set your app to be only on dark mode, you can simply add

    overrideUserInterfaceStyle = .dark
    

    to your viewDidLoad(), or if you want it to be on the entire app:

    • Go to your Info.plist file
    • Add new key: UIUserInterfaceStyle with value Dark