🎨 Powerful theme/skin manager for iOS 9+ 主题/换肤, 暗色模式

Overview

SwiftTheme

Introduction - Demos - Installation - Documents - FAQ - Contribution - 中文文档

Screenshot

Running:open SwiftTheme.xcworkspace, run target PlistDemo

Introduction

The Beginning Of The Story

As part of our project requirement, we need to add night mode to our app. It's not as simple as just changing brightness or alpha on the top-level view—in fact, it needs an entirely new interface: different colors, different alpha, different image cuts. More accurately, "night mode" is a theme/skinning feature that can switch between bright theme and dark themes.

So how do we achieve this? Maybe we can set a global variable that represents the currently selected theme, and use different background colors or image cuts based on the variable during the controller's initialization. But then how do we deal with views that have already been initialized? Yes, we could use notifications to change their colors or image cuts, but this leads to controllers unnecessarily full of notification register/unregister, if...else and UI updating code. Worse, if you forget to unregister the notifications, your app may crash.

After some consideration, we put forward higher requirements on the task: create a simple and reusable themes/skinning framework, here as you see.

Goals

Make SwiftTheme a simple, powerful, high-performance, extensible themes/skinning framework. Provide a unified solution for iOS.

Demos

Index Mode

Vary background color of UIView according to the theme setting:

view.theme_backgroundColor = ["#FFF", "#000"]

Vary text color of UILabel and UIButton:

label.theme_textColor = ["#000", "#FFF"]
button.theme_setTitleColor(["#000", "#FFF"], forState: .Normal)

Vary image of UIImageView:

imageView.theme_image = ["day", "night"]

// It's ok by using UIImage instances if you don't want to use image names.
imageView.theme_image = ThemeImagePicker(images: image1, image2)

A miracle happens after you execute the single line of code below!

// these numbers represent the parameters' index. 
// eg. "view.theme_backgroundColor = ["#FFF", "#000"]", index 0 represents "#FFF", index 1 represents "#000"
ThemeManager.setTheme(index: isNight ? 1 : 0)

Get current theme index.

ThemeManager.currentThemeIndex	// Readonly

Index mode is a fast way for the situation: a few themes, but not many, no need to download more new themes.

Notice About Literal:

// Wrong example:
let colors = ["#FFF", "#000"]
view.theme_backgroundColor = colors

// You should write like this:
view.theme_backgroundColor = ["#FFF", "#000"]
// or this:
let colorPickers: ThemeColorPicker = ["#FFF", "#000"]
view.theme_backgroundColor = colorPickers

Because theme_backgroundColor accepts an argument of type ThemeColorPicker,not Array. Nevertheless, "view.theme_backgroundColor = ["#FFF", "#000"]" does the same as initializing an instance of ThemeColorPicker by "Literal" and passing it to the theme_backgroundColor.

Plist/JSON Mode

You may want to make your app download and install an indefinite number of themes. To fulfill this requirement, we provide plist mode. Simply put, you write configuration info such as colors, image cuts and so on, in a plist file. Then, you can use their keys in the logic code. So, the plist file and the resource files are used to constitute a theme package.

Usage demo of plist mode.

view.theme_backgroundColor = "Global.backgroundColor"
imageView.theme_image = "SelectedThemeCell.iconImage"

Similar with the index mode. Only the specific parameters become keys. And as such, we give it the extension ability.

The plist file name is the first paramter of the switching method. In this example, the plist file and other resource files are in the application bundle. It's also ok if they are in sandbox.

ThemeManager.setTheme(plistName: "Red", path: .mainBundle)

plist mode allow you install more themes without modifying logic code. So, you can add the feature that, downloading and installing themes for your app.

the screenshots of the plist and image files we used above:

Objective-C

Fully compatible with Objective-C, usage demo:

lbl.theme_backgroundColor = [ThemeColorPicker pickerWithColors:@[@"#FAF9F9", @"#E2E2E2"]];

Features

  • Written in Swift
  • Fully compatible with Objective-C
  • Based on runtime
  • Simple integration
  • Extension property prefix with "theme_*", friendly with IDE auto-completion
  • Support UIAppearance
  • Index mode, fast integration
  • Plist mode, extend infinite themes
  • Friendly error logs
  • Strongly typed ThemePicker, detect errors during compilling
  • Complete demos

Installation

CocoaPods

pod 'SwiftTheme'
use_frameworks!

Carthage

github "wxxsw/SwiftTheme"

Swift Package Manager

  1. Select Xcode -> File -> Swift Packages -> Add Package Dependency...
  2. Enter https://github.com/wxxsw/SwiftTheme.
  3. Click Next, then select the version, complete.

Source files

Copy all the files in "Sources" folder into your project

Documents

Note: usage of index mode usage of plist mode

Basic Usage


Configure Appearance

SwiftTheme provides new properties for views, they all beigin with theme_. Such as theme_backgroundColor corresponds backgroundColor.

①
view.theme_backgroundColor = ThemeColorPicker(colors: "#FFF", "#000")
view.theme_image = ThemeImagePicker(names: "day", "night")
②
view.theme_backgroundColor = ThemeColorPicker(keyPath: "SomeColorKeyPath")
view.theme_image = ThemeImagePicker(keyPath: "SomeImageKeyPath")

Different type of properties receive different type of Pickers. Thus, IDE will warn you if you pass a wrong parameter.

Switch Themes

When you switch themes, all the theme_ properties you set will update with animation. Usage:

①
ThemeManager.setTheme(index: 0) // ThemePickers will use the first parameter, eg. "#FFF" "day"
ThemeManager.setTheme(index: 1) // ThemePickers will use the second parameter, eg. "#000" "night"
// use "day.plist" in the appllication bundle as the theme configuration file. 
// In this mode, SwiftTheme will find the resource files in the appllication bundle.
ThemeManager.setTheme(plistName: "day", path: .mainBundle)
// use "night.plist" in the sandbox as the theme configuration file, "someURL" is its file path. 
// In this mode, SwiftTheme will find the resource files in the same path.
ThemeManager.setTheme(plistName: "night", path: .sandbox(someURL))
// use a dictionary as the theme configuration, but find resource files in the sandbox.(Not recommend)
ThemeManager.setTheme(dict: dict, path: .sandbox(someURL))

Custom Behaviors

SwiftTheme posts a notification named ThemeUpdateNotification when theme changes, you can observe this notification anywhere and do whatever you want:

NotificationCenter.default.addObserver(
	self, 
	selector: #selector(doSomethingMethod),
	name: NSNotification.Name(rawValue: ThemeUpdateNotification), 
	object: nil
)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomethingMethod) name:@"ThemeUpdateNotification" object:nil];

Now Supported Properties


Child classes inherit the properties from their super class, such as UILabel have theme_alpha inherited from UIView. These properties will not be list in child classes below.

UIView
  • var theme_alpha: ThemeCGFloatPicker?
  • var theme_backgroundColor: ThemeColorPicker?
  • var theme_tintColor: ThemeColorPicker?
UIApplication
  • func theme_setStatusBarStyle(picker: ThemeStatusBarStylePicker, animated: Bool)
UIBarButtonItem
  • var theme_tintColor: ThemeColorPicker?
UILabel
  • var theme_font: ThemeFontPicker?
  • var theme_textColor: ThemeColorPicker?
  • var theme_textAttributes: ThemeStringAttributesPicker?
  • var theme_highlightedTextColor: ThemeColorPicker?
  • var theme_shadowColor: ThemeColorPicker?
UINavigationBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
  • var theme_titleTextAttributes: ThemeDictionaryPicker?
UITabBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UITableView
  • var theme_separatorColor: ThemeColorPicker?
UITextField
  • var theme_font: ThemeFontPicker?
  • var theme_keyboardAppearance: ThemeKeyboardAppearancePicker?
  • var theme_textColor: ThemeColorPicker?
  • var theme_placeholderAttributes: ThemeDictionaryPicker?
UITextView
  • var theme_font: ThemeFontPicker?
  • var theme_textColor: ThemeColorPicker?
UIToolbar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UISegmentedControl
  • var theme_selectedSegmentTintColor: ThemeColorPicker?
  • func theme_setTitleTextAttributes(_ picker: ThemeStringAttributesPicker?, forState state: UIControl.State)
UISwitch
  • var theme_onTintColor: ThemeColorPicker?
  • var theme_thumbTintColor: ThemeColorPicker?
UISlider
  • var theme_thumbTintColor: ThemeColorPicker?
  • var theme_minimumTrackTintColor: ThemeColorPicker?
  • var theme_maximumTrackTintColor: ThemeColorPicker?
UISearchBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UIProgressView
  • var theme_progressTintColor: ThemeColorPicker?
  • var theme_trackTintColor: ThemeColorPicker?
UIPageControl
  • var theme_pageIndicatorTintColor: ThemeColorPicker?
  • var theme_currentPageIndicatorTintColor: ThemeColorPicker?
UIImageView
  • var theme_image: ThemeImagePicker?
UIActivityIndicatorView
  • var theme_activityIndicatorViewStyle: ThemeActivityIndicatorViewStylePicker?
UIButton
  • func theme_setImage(picker: ThemeImagePicker?, forState state: UIControlState)
  • func theme_setBackgroundImage(picker: ThemeImagePicker?, forState state: UIControlState)
  • func theme_setTitleColor(picker: ThemeColorPicker?, forState state: UIControlState)
  • func theme_setAttributedTitle(picker: ThemeAttributedStringPicker?, forState state: UIControlState)
CALayer
  • var theme_backgroundColor: ThemeCGColorPicker?
  • var theme_borderWidth: ThemeCGFloatPicker?
  • var theme_borderColor: ThemeCGColorPicker?
  • var theme_shadowColor: ThemeCGColorPicker?
CATextLayer
  • var theme_foregroundColor: ThemeCGColorPicker?
CAGradientLayer
  • var theme_colors: ThemeAnyPicker?
UIRefreshControl
  • var theme_titleAttributes: ThemeDictionaryPicker?
UIVisualEffectView
  • var theme_effect: ThemeVisualEffectPicker?

Picker


ThemeColorPicker

// supported formats:
// "#ffcc00"		RGB
// "#ffcc00dd"		RGBA
// "#FFF"			RGB in short
// "#013E"			RGBA in short
ThemeColorPicker(colors: "#FFFFFF", "#000")
ThemeColorPicker(colors: UIColor.red, UIColor.blue)
ThemeColorPicker.pickerWithColors(["#FFFFFF", "#000"])
ThemeColorPicker.pickerWithUIColors([UIColor.red, UIColor.blue])
②
ThemeColorPicker(keyPath: "someStringKeyPath")
ThemeColorPicker.pickerWithKeyPath("someStringKeyPath")

ThemeImagePicker

ThemeImagePicker(names: "image1", "image2")
ThemeImagePicker.pickerWithNames(["image1", "image2"])
ThemeImagePicker(images: UIImage(named: "image1")!, UIImage(named: "image2")!)
ThemeImagePicker.pickerWithImages([UIImage(named: "image1")!, UIImage(named: "image2")!])
②
ThemeImagePicker(keyPath: "someStringKeyPath")
ThemeImagePicker.pickerWithKeyPath("someStringKeyPath")

ThemeCGFloatPicker

ThemeCGFloatPicker(floats: 1.0, 0.7)
ThemeCGFloatPicker.pickerWithFloats([1.0, 0.7])
②
ThemeCGFloatPicker(keyPath: "someNumberKeyPath")
ThemeCGFloatPicker.pickerWithKeyPath("someNumberKeyPath")

ThemeCGColorPicker

ThemeCGColorPicker(colors: "#FFFFFF", "#000")
ThemeCGColorPicker(colors: UIColor.red, UIColor.blue)
ThemeCGColorPicker(colors: UIColor.red.cgColor, UIColor.blue.cgColor)
ThemeCGColorPicker.pickerWithColors(["#FFFFFF", "#000"])
ThemeCGColorPicker.pickerWithUIColors([UIColor.blue, UIColor.red])
②
ThemeCGColorPicker(keyPath: "someStringKeyPath")
ThemeCGColorPicker.pickerWithKeyPath("someStringKeyPath")

ThemeFontPicker

ThemeFontPicker(fonts: UIFont.systemFont(ofSize: 10), UIFont.systemFont(ofSize: 11))
ThemeFontPicker.pickerWithFonts([UIFont.systemFont(ofSize: 10), UIFont.systemFont(ofSize: 11)])
②
// name the key you like, but the available values format like this: "PingFangSC-Regular,16"
ThemeFontPicker(keyPath: "someStringKeyPath")
ThemeFontPicker.pickerWithKeyPath("someStringKeyPath")

ThemeDictionaryPicker

ThemeDictionaryPicker(dicts: ["key": "value"], ["key": "value"])
ThemeDictionaryPicker.pickerWithDicts([["key": "value"], ["key": "value"]])
②
ThemeDictionaryPicker(keyPath: "someStringKeyPath") { (Any?) -> [String: AnyObject]? in ... }

ThemeStringAttributesPicker

ThemeStringAttributesPicker(["key": "value"], ["key": "value"])
ThemeStringAttributesPicker.pickerWithAttributes([NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16)])
②
ThemeStringAttributesPicker(keyPath: "someStringKeyPath") { (Any?) -> [NSAttributedString.Key: Any]? in ... }

ThemeAttributedStringPicker

ThemeAttributedStringPicker(NSAttributedString(...), NSAttributedString(...))
ThemeAttributedStringPicker.pickerWithAttributedStrings([NSAttributedString(...)])
②
ThemeAttributedStringPicker(keyPath: "someStringKeyPath") { (Any?) -> NSAttributedString? in ... }

ThemeBarStylePicker

ThemeBarStylePicker(styles: .default, .black)
ThemeBarStylePicker.pickerWithStyles([.default, .black])
ThemeBarStylePicker.pickerWithStringStyles(["default", "black"])
②
// name the key you like, but the available values are "default" and "black"
ThemeBarStylePicker(keyPath: "someStringKeyPath")
ThemeBarStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeStatusBarStylePicker

ThemeStatusBarStylePicker(styles: .default, .lightContent, .darkContent)
ThemeStatusBarStylePicker.pickerWithStyles([.default, .lightContent, .darkContent])
ThemeStatusBarStylePicker.pickerWithStringStyles(["default", "lightContent", "darkContent"])
②
// name the key you like, but the available values are "default", "lightContent" and "darkContent"
ThemeStatusBarStylePicker(keyPath: "someStringKeyPath")
ThemeStatusBarStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeKeyboardAppearancePicker

ThemeKeyboardAppearancePicker(styles: .default, .dark, .light)
ThemeKeyboardAppearancePicker.pickerWithStyles([.default, .dark, .light])
ThemeKeyboardAppearancePicker.pickerWithStringStyles(["default", "dark", "light"])
②
// name the key you like, but the available values are "default", "dark" and "light"
ThemeKeyboardAppearancePicker(keyPath: "someStringKeyPath")
ThemeKeyboardAppearancePicker.pickerWithKeyPath("someStringKeyPath")

ThemeActivityIndicatorViewStylePicker

ThemeActivityIndicatorViewStylePicker(styles: .whiteLarge, .white, .gray)
ThemeActivityIndicatorViewStylePicker.pickerWithStyles([.whiteLarge, .white, .gray])
ThemeActivityIndicatorViewStylePicker.pickerWithStringStyles(["whiteLarge", "white", "gray"])
②
// name the key you like, but the available values are "whiteLarge", "white" and "gray"
ThemeActivityIndicatorViewStylePicker(keyPath: "someStringKeyPath")
ThemeActivityIndicatorViewStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeVisualEffectPicker

ThemeVisualEffectPicker(effects: UIBlurEffect(style: .light), UIBlurEffect(style: .dark))
ThemeVisualEffectPicker.pickerWithEffects([UIBlurEffect(style: .light), UIBlurEffect(style: .dark)])
ThemeVisualEffectPicker.pickerWithStringEffects(["light", "dark", "extralight", "prominent", "regular"])
②
// name the key you like, but the available values are "light", "dark", "extralight", "prominent" and "regular"
ThemeVisualEffectPicker(keyPath: "someStringKeyPath")
ThemeVisualEffectPicker.pickerWithKeyPath("someStringKeyPath")

ThemeAnyPicker

ThemeAnyPicker(anys: 0, "123", UIColor.red)
ThemeAnyPicker.pickerWithAnys([0, "123", UIColor.red])
②
ThemeAnyPicker(keyPath: "someStringKeyPath")
ThemeAnyPicker.pickerWithKeyPath("someStringKeyPath")

More

Download this project and find more. There are four demo targets:

  • Demo shows how to use index mode and how to save the last selection of themes and other general usages.
  • PlistDemo shows how to use plist mode and how to download themes that packaged in zip files.
  • JsonDemo is like PlistDemo, but use json.
  • OCDemo is Demo's Objective-C version.
  • TVOSDemo is used to test tvos compatibility.

FAQ

  1. Why doesn't theme_setStatusBarStyle work as expected?

    In your app's Info.plist you will need to set View Controller-based status bar appearence to NO.

  2. Can I manually cancel the theme of a property?

    Sure, just make it nil—example: view.theme_backgroundColor = nil.

Contribution

Issue

If you find a bug or need a help, you can create a issue

Pull Request

We are happy to accept pull requests :D. But please make sure it's needed by most developers and make it simple to use. If you are not sure, create an issue and we can discuss it before you get to coding.

Contributors

Gesen, Zhoujun, Kevin Cramer

Lisence

The MIT License (MIT)

Comments
  • Plist mode can't convert value of type 'String' to 'ThemeStatusbarStylePicker'

    Plist mode can't convert value of type 'String' to 'ThemeStatusbarStylePicker'

    I'm trying to implement plist mode to my app, but I'm getting exceptions that can't convert / assign string to 'ThemeStatusBarStylePicker' / 'ThemeColorPicker'. I have almost did same with your plist demo project, but I think I missed something. Please help me.

    opened by devAstro81 12
  • 如何设置纯透明

    如何设置纯透明

    作者好,

    我有如下场景:

    基类VC中默认设置一个控件的主题色组,两个色值,都是十六进制RGB格式的,有一个继承基类VC的子VC,对于该控件,不论哪个主题,都是要透明的,也就是UIColor.clear;

    我看到readme文件中有RGBA格式传入的方法,就将"#ffffff00", "##ffffff00"传入,但是xcode日志处会输出: SwiftTheme WARNING: Not convert rgba ##ffffff00 in array: ["#ffffff00", "##ffffff00"][1]

    当我xcode直接运行app到手机的时候,主题切换时,显示正常,当关掉app,重新打开的时候,就有机率,显示的还是基类设置的色值组

    另外我这边更加适合直接传入colors给theme_xxx,一般对于color都封装好了hexColor的方法,甚至起了便于识别的颜色名字,在readme中看到可以用类似:UIColor.yellow.cgcolor的形式传入,尝试过,会提示,无法将ThemeCGColorPicker转为ThemeColorPicker

    盼回复,谢谢!

    opened by deepindo 11
  • ThemePicker keypath 方式初始化的一些疑问

    ThemePicker keypath 方式初始化的一些疑问

    看了下代码,发现 ThemeFontPicker 和 ThemeDictionaryPicker 没有以keyPath为参数的初始化方法,ThemeFontPicker 没有比较好好理解,字符串确实不太好表达 Font,ThemeDictionaryPicker 没有就比较奇怪了(plist中是可以表达dictionary的呀),而且 ThemeManager+Plist 中也定义了 dictionaryForKeyPath(_),可能是我还没太理解,希望能够解释以下,谢谢~。

    另外,上述两者如果没有 keypath初始化方法,那么使用的时候就会和其他picker不一致了,其他的picker只要指定 keypath,就可以自动完成根据theme切换属性值的功能,而如果是上述的两个picker的话,恐怕要外界自行根据theme去init?

    opened by cjsliuj 11
  • theme_setStatusBarStyle doesn't work as expected

    theme_setStatusBarStyle doesn't work as expected

    Hi, thanks for your awesome project, it helps me a lot. But I got a problem. theme colour and images works well but the status bar doesn't change respond to ThemeManager.setTheme

    I add code below in my didFinishLaunchingWithOptions

    UIApplication.sharedApplication().theme_setStatusBarStyle(ThemeStatusBarStylePicker(styles: .Default, .LightContent), animated: true)
    

    It doesn't work, anything else I need to do to change my status bar style?

    opened by futantan 7
  • Cocoapods not working

    Cocoapods not working

    I installed the cocoapods and them tried to set the theme (plist mode) in App Delegate using following code :

    ThemeManager.setTheme(plistName: "Red", path: .mainBundle)

    I was not able to get autocomplete predictions, as well as, on building the project, I was getting error on this line

    Please help!!!

    opened by vaibhav-varshaaweblabs 6
  • add ThemeTabBarAppearancePicker + theme_standart/compact/scrollEdgeAppearance

    add ThemeTabBarAppearancePicker + theme_standart/compact/scrollEdgeAppearance

    Required changes for setting appearance at iOS 15 for UITabBar. Here is a trouble, caused be new iOS 15 transparent appearance: https://stackoverflow.com/questions/68688270/ios-15-uitabbarcontrollers-tabbar-background-color-turns-black

    It were not possible to use proposed decisions from stackoverflow while using SwiftTheme. That is why I've decided to implement missing scrollEdgeAppearance behaviour here.

    opened by rusel95 5
  • Change alpha for ighlighting  rows with theme_backgroundColor

    Change alpha for ighlighting rows with theme_backgroundColor

    Hi,

    Thanks for your awesome repo. 👌🏼

    Before using SwiftTheme I set highlight row as follow:

    `override func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {

            let cell = tableView.cellForRow(at: indexPath)
            
            cell?.contentView.backgroundColor = UIColor(red: 0, green: 169/255, blue: 168/255, alpha: 0.25)
    }`
    

    So as you can see I need alpha = 0.25, alpha just for the backgroundColor not for the contentView.

    Is there a way to set alpha using theme_backgroundColor ??

    cell?.contentView.theme_backgroundColor = ["#00a9a8", "#292b38"]

    Thanks.

    opened by Maryom 5
  • OC 调用Bug

    OC 调用Bug

    下载到Documents里的plist文件,在调用setThemeWithPlistInSandbox方法的时候,会自动在plist文件名参数后拼接一个.plist后缀,导致原本的文件名由xxx.plist变成xxx.plist.plist,然后识别失败。

    SwiftTheme WARNING: Not read plist 'momentsBear_theme.plist' with: /Users/fiber/Library/Developer/CoreSimulator/Devices/1FEF7344-AA28-494C-9B96-B4DF9D6F285F/data/Containers/Data/Application/D9F52344-3E99-42A8-819B-2C471D349709/Documents/Theme/1/theme3x/momentsBear_theme.plist.plist

    opened by vergilw 5
  • Navigation Bar themable title

    Navigation Bar themable title

    I'm trying to set the navigation bar title a themable value, so I have in AppDelegate

            private func setupTheming() {
            let _ = UITextField.appearance().backgroundColor?.toHexString() ?? "000000"
            let attributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.red.toHexString()] as [String: AnyObject]
            UINavigationBar.appearance().theme_barTintColor = [UIColor.blue.toHexString(), UIColor.nightDarkGray.toHexString()]
            UINavigationBar.appearance().theme_tintColor = [UIColor.cream.toHexString(), UIColor.nightOrange.toHexString()]
            UINavigationBar.appearance().theme_titleTextAttributes = ThemeDictionaryPicker.pickerWithDicts([attributes])
    

    So it should be set to red, but nothing happens. If I set the value to a a UILabel.appearance it works

    UILabel.appearance().theme_textColor = [UIColor.blueGray.toHexString(), UIColor.orange.toHexString()]

    Any idea on how to proceed?

    opened by alexbartisro 4
  • tabBar.barStyle and navigationBar.barStyle stopped working with Swift 4

    tabBar.barStyle and navigationBar.barStyle stopped working with Swift 4

    Hello, I recently updated to Swift 4 and noticed that this stopped working:

    let navigationBar = UINavigationBar.appearance()
    navigationBar.theme_barStyle = [.default, .black]
    
    let tabBar = UITabBar.appearance()
    tabBar.theme_barStyle = [.default, .black]
    

    All I see is the default style that doesn't change when switching theme. Tested on both real device and simulator. However setting tabBar.barStyle = .black manually seems to work just fine. Any help?

    bug 
    opened by n3d1117 4
  • Named colors in plist

    Named colors in plist

    Thanks for this wonderful library! I am missing just one feature at the moment and that is to name colors in the plist file so we can reference them via their name within the plist file. This way we can change just the hex value of one named color to change many elements at once. It will be convenient and will lead to less errors.

    Like the color #ECF0F1 in the PlistDemo used in several places https://github.com/jiecao-fm/SwiftTheme/blob/master/PlistDemo/Night.plist

    EDIT: Maybe even shared named colors palette between multiple themes/plists? I am adding a night mode to an app and they both use the same palette.

    opened by martinflorek 4
  • Issues with UILabel and UIView with shadow (Swift)

    Issues with UILabel and UIView with shadow (Swift)

    When the view containing some labels has shadow and the view background color is clear color...the shadow gets applied on the labels inside the view when i enable theme in that specific view. Simulator Screen Shot - iPhone 12 - 2022-03-09 at 15 11 52 Simulator Screen Shot - iPhone 12 - 2022-03-09 at 15 12 04

    opened by jaseelop 0
  • Error compilation via Carthage

    Error compilation via Carthage

    Hi,

    I try with last version of Carthage (0.38.0) (cache clean)... github "wxxsw/SwiftTheme" ~> 0.6.3 : "ThemeTabBarAppearancePicker"

    ld+PlaceholderAttributes.bc -o /Users/robertjuzyna/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/SwiftTheme/0.6.3/Build/Intermediates.noindex/ArchiveIntermediates/SwiftTheme/IntermediateBuildFilesPath/SwiftTheme.build/Release-iphoneos/SwiftTheme.build/Objects-normal/arm64/ThemeColorPicker.bc
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:134:35: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_standardAppearance: ThemeTabBarAppearancePicker? {
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:139:34: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_compactAppearance: ThemeTabBarAppearancePicker? {
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:144:37: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_scrollEdgeAppearance: ThemeTabBarAppearancePicker? {
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ** ARCHIVE FAILED **
    
    
    The following build commands failed:
    	CompileSwift normal armv7 (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwift normal arm64 (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'SwiftTheme' from project 'SwiftTheme')
    (4 failures)
    
    opened by Droppix 2
  • swift 5,创建一个新控制器,导航栏右边的文字颜色没改变,还有tabbar会跳动,什么原因呢?

    swift 5,创建一个新控制器,导航栏右边的文字颜色没改变,还有tabbar会跳动,什么原因呢?

    https://user-images.githubusercontent.com/81165987/118320502-6514db00-b50d-11eb-9ded-918d818b23c2.mov

    这是APPDelegate代码 image

    image 这是自定义UITabBarController image

    image 这是新控制器代码

    opened by nikeios 0
Owner
Gesen
———————————————
Gesen
Powerful and easy-to-use vector graphics Swift library with SVG support

Macaw Powerful and easy-to-use vector graphics Swift library with SVG support We are a development agency building phenomenal apps. What is Macaw? Mac

Exyte 5.9k Jan 1, 2023
Stencil is a simple and powerful template language for Swift.

Stencil Stencil is a simple and powerful template language for Swift. It provides a syntax similar to Django and Mustache. If you're familiar with the

Stencil Project 2.2k Jan 4, 2023
A Powerful , Extensible CSS Parser written in pure Swift.

A Powerful , Extensible CSS Parser written in pure Swift. Basic Usage From CSS: #View { "width" : 118; "height" : 120.5; "color1" : "#888888"; "co

null 273 Sep 9, 2022
React.js like Mixin. More powerful Protocol-Oriented Programming.

Mixin ?? Why? Swift is Protocol-Oriented Programming, and it's more powerful by default implementations of extensions of protocols. You can mixin meth

Wan-Huang Yang 45 Dec 28, 2021
UIStackView replica for iOS 7.x and iOS 8.x

TZStackView A wonderful layout component called the UIStackView was introduced with iOS 9. With this component it is really easy to layout components

Tom van Zummeren 1.2k Oct 10, 2022
Super awesome Swift minion for Core Data (iOS, macOS, tvOS)

⚠️ Since this repository is going to be archived soon, I suggest migrating to NSPersistentContainer instead (available since iOS 10). For other conven

Marko Tadić 306 Sep 23, 2022
A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView and iPhone X safe area support for content reloading. Built for iOS 10 and later.

Arale A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built f

Putra Z. 43 Feb 4, 2022
BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen

BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen. It is especially well

Alexis (Aubry) Akers 5.3k Jan 2, 2023
💾 A collection of classic-style UI components for iOS

A collection of classic-style UI components for UIKit, influenced by Windows 95 Introduction This is a little exploration into applying '90s-era desig

Blake Tsuzaki 2.2k Dec 22, 2022
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
A library to recreate the iOS Apple Music now playing transition

DeckTransition DeckTransition is an attempt to recreate the card-like transition found in the iOS 10 Apple Music and iMessage apps. Hereʼs a GIF showi

Harshil Shah 2.2k Dec 15, 2022
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

Evgenii Neumerzhitckii 874 Dec 13, 2022
Protocol oriented, type safe, scalable design system foundation swift framework for iOS.

Doric: Design System Foundation Design System foundation written in Swift. Protocol oriented, type safe, scalable framework for iOS. Features Requirem

Jay 93 Dec 6, 2022
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

AssistoLab 2.3k Dec 20, 2022
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

Mukesh Thawani 467 Dec 5, 2022
A custom reusable circular / progress slider control for iOS application.

HGCircularSlider Example To run the example project, clone the repo, and run pod install from the Example directory first. You also may like HGPlaceho

Hamza Ghazouani 2.4k Jan 6, 2023
A customizable color picker for iOS in Swift

IGColorPicker is a fantastic color picker ?? written in Swift. Table of Contents Documentation Colors Style Other features Installation Example Gettin

iGenius 272 Dec 17, 2022
⚡️ A library of widgets and helpers to build instant-search applications on iOS.

By Algolia. InstantSearch family: InstantSearch iOS | InstantSearch Android | React InstantSearch | InstantSearch.js | Angular InstantSearch | Vue Ins

Algolia 567 Dec 20, 2022
An iOS picker view to serve all your "picking" needs

Mandoline The PickerView is a UICollectionView that provides a smooth "picking" interface. In order to get the most out of it, a consuming view contro

Blue Apron 883 Nov 28, 2022