title: How to enable Dark theme for iOS 12 and lower
body: <p>I have already added support for iOS13 where there are two switches: first one for the automatic, system based theme and the other switch to turn on and off dark theme and am switching it with the given method:</p>
  <pre><code>func changeThemeTo(theme: String){
          switch theme {
          case &quot;dark&quot;:
              UIApplication.shared.windows.forEach { window in
                  if #available(iOS 13.0, *) {
                      window.overrideUserInterfaceStyle = .dark
                  } else {
                      // Fallback on earlier versions
                  }
              }
          case &quot;light&quot;:
              UIApplication.shared.windows.forEach { window in
                  if #available(iOS 13.0, *) {
                      window.overrideUserInterfaceStyle = .light
                  } else {
                      // Fallback on earlier versions
                  }
              }
          case &quot;auto&quot;:
              UIApplication.shared.windows.forEach { window in
                  if #available(iOS 13.0, *) {
                      window.overrideUserInterfaceStyle = .unspecified
                  } else {
                      // Fallback on earlier versions
                  }
              }
          default: break
          }
  }
  </code></pre>
  <p>And everything is working fine for iOS 13, but now I need to enable this to work for iOS lower than 13. Is there something I can do similar to <code>window.overrideUserInterfaceStyle = .dark</code> or should I completely change the switching logic as did on <a href="https://www.onswiftwings.com/posts/dark-mode/" rel="nofollow noreferrer">https://www.onswiftwings.com/posts/dark-mode/</a></p>