Skip to content

一种自定义主题适配的尝试【暗黑模式等】,支持 iOS 8 +

License

Notifications You must be signed in to change notification settings

liangdahong/CustomTheme

Repository files navigation

CustomDarkMode

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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()
    }
  • 效果

Author

liangdahong, hi@liangdahong.com

License

CustomDarkMode is available under the MIT license. See the LICENSE file for more info.

About

一种自定义主题适配的尝试【暗黑模式等】,支持 iOS 8 +

Resources

License

Stars

Watchers

Forks

Packages

No packages published