Reusable and composable UI styles
MIT License
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
.
Defining the UI style in code is good because it gives
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!
Base class | UIAppearance | StyleSheet | Notes |
---|---|---|---|
NSView | |||
UIView | |||
UIBarItem | See the issue #1 |
github "werediver/StyleSheet" ~> 5.0
pod 'StyleSheet', :git => 'https://github.com/werediver/StyleSheet.git', :tag => 'v5.0.0'
Note: check the latest available version!