0

Three enums are set to achieve: UIUserInterfaceStyleUnspecified -> To listen to iOS setting mode change UIUserInterfaceStyleLight -> To override LIGHT mode irrespective of iOS setting mode UIUserInterfaceStyleDark -> To override DARK mode irrespective of iOS setting mode

The problem arises when I set

(Parent_ViewController -> UIUserInterfaceStyleDark) and

(Child_ViewController -> UIUserInterfaceStyleUnspecified)

And then when we switch the settings iOS mode from light to dark or vice versa, there's no change in UI of Child_ViewController and being UIUserInterfaceStyleUnspecified it should've changed but it always has dark theme colors.

Any workarounds or solution is there to address this problem?

nvn
  • 21
  • 2

1 Answers1

1

Welcome!

ViewControllers will stop propagating the system changes to child controllers when they override the interface style. This also means that a child VC will inherit the interface style of its parent when overrideUserInterfaceStyle is set to .unspecified.

I'm afraid you need some custom implementation if you want to achieve that specific behavior. For instance, by setting the parts you always want to be dark to concrete (undynamic) colors instead of using dynamic system colors.

Frank Rupprecht
  • 9,191
  • 31
  • 56
  • Hi Frank: Thank you and I agree with what you said but I'm looking for more like we want to allow the user to switch between whole application color or just some parts of the application so it's more like two themes of the application. – nvn May 08 '20 at 13:22
  • 1
    I'm afraid you can't rely on the user interface style then but instead have to implement a custom theming system. – Frank Rupprecht May 08 '20 at 13:26