StyleSheet
An approach to define reusable and composable UI styles.
Having some base styles defined you can use them like so:
final class TitleLabel: UILabel, TitleFontStyle {}
final class BodyLabel: UILabel, BodyFontStyle, MultilineLabelStyle {}
final class CaptionLabel: UILabel, CaptionFontStyle, MultilineLabelStyle {}For a complete usage example see the Example project.
For the implementation details see Style.swift and RootStyle.swift.
Motivation
Why to define the UI style in code?
Defining the UI style in code is good because it gives
- reproducible,
- reusable,
- and composable results.
Why not to use UIAppearance?
Because we can do better. By avoiding the use of the appearance-proxy we can access all properties and methods (not only UI_APPEARANCE_SELECTOR and dynamic), and nested objects!
Supported base classes
| Base class | UIAppearance | StyleSheet | Notes |
|---|---|---|---|
| NSView | ✓ | ||
| UIView | ✓ | ✓ | |
| UIBarItem | ✓ | ✗ | See the issue #1 |
Installation
Carthage
github "werediver/StyleSheet" ~> 5.0
CacoaPods
pod 'StyleSheet', :git => 'https://github.com/werediver/StyleSheet.git', :tag => 'v5.0.0'Note: check the latest available version!

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

