SwiftTheme: theme_ properties bolted onto UIKit at runtime, and the array literal trap
Powerful theme/skin manager for iOS 9+.
At a glance
- What is it?
- SwiftTheme lets an iOS app swap every themed value on screen with one ThemeManager call instead of notification bookkeeping, and its two switching modes, index based and plist based, push errors to different places.
- Who is it for?
- SwiftTheme fits apps that already ship on UIKit and want a theme switch they can trigger from one place, and it fits less well if you need the system appearance to drive colors, since the two modes here are chosen by index or by plist name rather than by trait. Before adopting it, check two things.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 15 days ago.
- What is it written in?
- Mainly Swift, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- wxxsw/SwiftTheme2,518 ★ · -4
| Repository | 2026-09-30 | 2026-11-15 |
|---|---|---|
| wxxsw/SwiftTheme | 2.5k | 2.5k |
-4 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
theme_ properties are attached at runtime, not inherited from a subclass
The framework adds properties to views that already exist rather than asking you to swap in a subclass. Every property it adds carries a theme_ prefix and corresponds to a UIKit property that is already there, so theme_backgroundColor stands next to backgroundColor and theme_textColor next to textColor. The stated basis for that is runtime, and the consequence is practical: a view laid out in a storyboard or created by code does not have to be a special subclass to be themeable, and nothing in the interface builder XML needs to change. UIAppearance is supported, which is what lets a value apply across a class of views rather than only to instances you touched. The property names are chosen so that an editor completes them next to the originals. The type of each property is a picker rather than a raw value, and different properties take different picker types, so passing the wrong one is a compile error rather than a runtime surprise. From Objective-C the same property is reached through a picker class method:
lbl.theme_backgroundColor = [ThemeColorPicker pickerWithColors:@[@"#FAF9F9", @"#E2E2E2"]];The Feature list calls this simple integration and lists Objective-C compatibility as checked, which the demo targets back up.
The property takes a picker, so assigning an array variable does nothing useful
There is one trap in the API that the documentation goes out of its way to spell out, and it is worth reading before the first line of your own code. Assigning a plain array to a theme property is the wrong form, and it is wrong in a way a compiler will not catch at the call site:
// Wrong example:
let colors = ["#FFF", "#000"]
view.theme_backgroundColor = colorsThe argument the property expects is a ThemeColorPicker, not an Array. What makes the short form read naturally is that an array literal builds a picker and hands it over, so view.theme_backgroundColor = ["#FFF", "#000"] and an explicitly typed local both work:
let colorPickers: ThemeColorPicker = ["#FFF", "#000"]
view.theme_backgroundColor = colorPickersThe difference between those two forms is one character of type annotation, and the wrong one is the form most people write first. The same split applies to images, where the picker also accepts instances instead of asset names for callers who do not want to go through the resource names:
imageView.theme_image = ThemeImagePicker(images: image1, image2)Index mode numbers your values, plist mode names them in a file
The switching call comes in two shapes and they carry different costs. Index mode puts every possible value in the source, in order, and the index picks the position:
// 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)The index that is currently in force is readable through ThemeManager.currentThemeIndex, which is readonly. This is the fast integration path, and the documentation is explicit about its limit: it suits a few themes, not many, with no need to download more. Plist mode moves the values out of the source into a configuration file and refers to them by key:
view.theme_backgroundColor = "Global.backgroundColor"
imageView.theme_image = "SelectedThemeCell.iconImage"The file name is the first parameter of the switching call, and the second says where to look, either the application bundle or a sandbox location:
ThemeManager.setTheme(plistName: "Red", path: .mainBundle)That is the mode that lets a shipped app install new themes without logic code changes, since the plist file and its resource files together form a theme package. The trade is where mistakes surface: with keys as plain strings, a mapping is resolved when the theme is applied rather than when the line compiles, and the Feature list answers that with friendly error logs.
Four install routes, each asking something different of you
The Installation section gives four ways in, and the differences between them are the interesting part. CocoaPods is two lines, not one:
pod 'SwiftTheme'
use_frameworks!The second line is not optional decoration. use_frameworks! changes how the whole application links, so adopting this dependency has a scope wider than the theme code itself. Carthage is a single line naming the repository:
github "wxxsw/SwiftTheme"Swift Package Manager is described as menu steps rather than as code: open the Add Package Dependency dialog, enter https://github.com/wxxsw/SwiftTheme, click Next and choose a version. The last route copies every file in the Sources folder into your own project, which hands you the merge and the upkeep of those files from that point on. Neither the CocoaPods line nor the Carthage line carries a version constraint, and the package manager route defers the version choice to a dialog, so on all three paths the version in use is whatever your resolver picks. Nothing in these instructions describes a version to pin to.
The repository publishes no releases, so every route resolves through a tag
There are no GitHub releases attached to this repository, and that shapes the whole install story. There is no built framework archive to download and compare against, no release notes describing what changed between builds, and no way to check which version a bug report refers to other than by finding the tag. All four routes still work, because CocoaPods, Carthage and the package manager all resolve a version from repository tags, and the source copy route does not care. What is missing is a published artifact trail. The tree carries Package.swift at the root and a podspec beside it, so the two modern manifests are in place, and a Podfile.lock sits next to the Podfile, which pins the exact dependency versions the demo apps were last resolved against. That lock file is the most concrete version record the repository offers, and it is a snapshot of one machine rather than a statement of what is current. The last push recorded for the repository is dated 17 May 2026, with 2521 stars, 309 forks and 15 open issues on record.
Pods/ is committed, which is why the demos open a workspace
The top of the tree includes a Pods/ directory next to Podfile, Podfile.lock, SwiftTheme.xcodeproj and SwiftTheme.xcworkspace, so the third party dependencies are vendored into the repository rather than fetched at build time. That single fact explains the one piece of running instructions the documentation gives, which appears as the line for producing a screenshot: open SwiftTheme.xcworkspace and run the target named PlistDemo. It is a workspace and not the project file, because a workspace is what knows about the Pods project. For anyone using this as a reference the committed Pods directory has a second effect: the demo will open and build without running a package manager first, which also means the tree carries a copy of dependency code that is not the framework's own. A Travis configuration file sits at the root as the recorded continuous integration setup, which dates from the era when that service was the common choice and predates the package manager routes the Installation section documents. None of the four integration routes depend on it.
Five demo apps, one per documented mode, plus a tvOS variant
The repository carries five demo applications and a second framework directory. Demo/, JsonDemo/, OCDemo/, PlistDemo/ and TVOSDemo/ sit alongside SwiftTheme/ for the framework itself and SwiftTheme-tvOS/ for the tvOS variant. The naming maps onto the documentation one for one: a demo per mode, with the Objective-C one proving the picker class methods and the tvOS one paired with the separate framework directory. The file list inside Demo/ shows how a consuming app is laid out rather than how the framework is: AppDelegate.swift, a list controller, an AboutCell, BaseCell, ChangeThemeCell, SelectThemeCell and SelectThemeViewController, a GlobalPicker, MyThemes, SwitchNightCell, an Info.plist and an Assets.xcassets catalog. Two of those names describe the mechanism in the framework's own terms, GlobalPicker for values shared across the app and MyThemes for the theme definitions. Base.lproj points at localization, so a themed app is expected to carry more than one language's resources, and the asset catalog is where the day and night image cuts in the demos come from. The project describes itself as a theme and skin manager for iOS 9 and later with dark mode among its goals, while the tree carries a tvOS target that the prose does not discuss.
The framework is built to replace notification bookkeeping, and the text stops mid example
The Introduction argues for the design rather than describing the API, and the argument is specific. Adding night mode to an app is presented as more than dimming the top level view, since it needs different colors, different alpha values and different image cuts. The naive approaches named are a global variable read during controller initialization, which does nothing for views that were already created, and notifications, which leave every controller full of register and unregister calls, branching code and view updates, with a crash waiting for whoever forgets to unregister. A single global variable with notification support, no global variable with notification support, global variable with notification support and no forget to unregister mechanism is the stated goal: one switch that updates every theme_ property already set, with animation. That is the promise the switching calls deliver. The text then ends inside the Switch Themes section, in a comment that has begun explaining where SwiftTheme looks for resource files when the plist comes from the sandbox, and the sentence stops there. The FAQ and Contribution sections that the navigation bar links to come after that point, so the answers they hold are not part of this text.
Editorial conclusion
SwiftTheme fits apps that already ship on UIKit and want a theme switch they can trigger from one place, and it fits less well if you need the system appearance to drive colors, since the two modes here are chosen by index or by plist name rather than by trait. Before adopting it, check two things. The repository publishes no GitHub releases, so every install route resolves through tags and there is no built artifact to compare against. And the visible documentation ends in the middle of the plist switching example, so the sandbox case and the FAQ that the navigation links to are not written down in the text you can read.
Frequently asked questions
What does SwiftTheme add to a UIView?
It adds properties prefixed with theme_ that correspond to properties the view already has, so theme_backgroundColor goes with backgroundColor. They are attached at runtime rather than through a subclass, they support UIAppearance, and each one takes a typed picker so a wrong value is a compile error.
How do I switch themes in SwiftTheme?
With a single ThemeManager call. Index mode takes the position of the value each picker should use, for example ThemeManager.setTheme(index: isNight ? 1 : 0), and the value in force is readable through the readonly ThemeManager.currentThemeIndex. Plist mode takes the configuration file name and where to look for it, such as ThemeManager.setTheme(plistName: "Red", path: .mainBundle).
Why does assigning an array to a theme property not work in SwiftTheme?
The property expects a picker such as ThemeColorPicker, not an Array, so a variable typed as an array is the wrong argument. Writing the array literal directly works, because the literal builds a picker, and so does declaring the local with the picker type. An image picker also accepts instances instead of asset names.
How is SwiftTheme installed?
Four routes are given. CocoaPods needs pod 'SwiftTheme' together with use_frameworks!, Carthage needs github "wxxsw/SwiftTheme", Swift Package Manager is added through the Add Package Dependency dialog in Xcode using the repository URL, and the last route copies every file in the Sources folder into the project.
Does SwiftTheme work with SwiftUI or the Swift language itself?
It is a UIKit theme and skinning framework, written in Swift, for apps on iOS 9 and later, with Objective-C compatibility built in. Its documented API works through UIKit classes such as UIView, UILabel, UIButton and UIImageView, and its switch is driven by an index or a plist name rather than by anything in the language toolchain.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/wxxsw-swifttheme)Star history chart for your README
[](https://hysenlabs.com/projects/wxxsw-swifttheme)Was this useful?