EasyStyle is a Swift functional framework that lets you create UI styles programmatically inspired by Composable, type-safe UIView styling with Swift functions and UIKit Styling with Functions
The example below is quite simple but shows how compose styles
Result | Code |
---|---|
- Lightweight and easy to use
- Styles composition
- Autocomplete support
- Short and readable code
EasyStyle is available through CocoaPods. To install
it, simply add the following line to your Podfile
:
pod "EasyStyle"
And Carthage users can simply add Mantle to their Cartfile
:
github "0ber/EasyStyle"
At first crate a style for UILabel
// MARK: Label Style
extension LabelStyle {
private static let h1 = font(.systemFont(ofSize: 28))
private static let title = h1 + textColor(.red)) + aligment(.center)
static let easyStyle = title + text("Easy Style")
}
when just set style to label
let titleLabel = UILabel()
titleLabel.setStyle(.easyStyle) // set style
Alex Kalinkin - @KalinkinAleksey
EasyStyle is available under the MIT license. See the LICENSE file for more info.