Detecting iOS Dark Mode Change

后端 未结 6 1722
悲哀的现实
悲哀的现实 2020-12-14 16:19

I read through the documentation regarding: https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interface

When the user chan

6条回答
  •  遥遥无期
    2020-12-14 16:56

    I think for colors is better to use

    UIColor.init { (trait) -> UIColor in
    
        return trait.userInterfaceStyle == .dark ? .label : .black
    }
    

    because this way if the system change, the color change too automatically.

提交回复
热议问题