To run the example project, clone the repo, and run pod install
from the Example directory first.
CustomDarkMode is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CustomTheme'
- 设置样式
view.theme({ view in
// 设置样式,在模式切换时会自动触发此 block
view.backgroundColor = (DarkModeManager.shared.currentMode == .light) ? .white : .black
})
- 切换模式
@IBAction func switchClick(_ sender: UISwitch) {
CustomThemeService.refresh()
}
liangdahong, hi@liangdahong.com
CustomDarkMode is available under the MIT license. See the LICENSE file for more info.