EasyStyle 0.0.6

EasyStyle 0.0.6

Maintained by Alex Kalinkin, ober01.



EasyStyle 0.0.6

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

Easy to use

The example below is quite simple but shows how compose styles

Result Code

Features

  • Lightweight and easy to use
  • Styles composition
  • Autocomplete support
  • Short and readable code

Installation

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"

Usage

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

Author

Alex Kalinkin - @KalinkinAleksey

License

EasyStyle is available under the MIT license. See the LICENSE file for more info.