How to Check for iOS Dark Mode? [duplicate]
问题 This question already has an answer here: How can I check whether dark mode is enabled in iOS/iPadOS? 9 answers • How to observe dark mode state in an iOS app • How to react to changes in dark mode state in an iOS app 回答1: UIKit has had UITraitCollection for a while now. Since iOS 9 you could use UITraitCollection to see whether the device supports 3D Touch (a sad conversation for another day) In iOS 12, UITraitCollection got a new property: var userInterfaceStyle: UIUserInterfaceStyle which