Skip to content

📎 Set common views' properties in a condensed way - single line.

License

Notifications You must be signed in to change notification settings

hoangta/Oneline

Repository files navigation

Oneline

Language License Platform Pod Version

How to use

Initialize UIView then chain setting its properties.

let label = UILabel("Hi, there!").font(.systemFont(ofSize: 12)).color(.blue).lines().bgColor(.green).align(.center)

Instead of

let label = UILabel()
label.text = "Hi, there!"
label.font = .systemFont(ofSize: 12)
label.textColor = .blue
label.numberOfLines = 0
label.backgroundColor = .green
label.textAlignment = .center

Supported Controls:

  • UIView ⬜️
  • UIControl 🔳
  • UIButton 🔵
  • UILabel ☗
  • UITextField ✒︎
  • UIStackView ❏

Cocoapods

Add the following entry in your Podfile

pod 'Oneline'

Then run pod install.

Contribution

Feel free to fork, pull to request for your commonly used UIView subclasses.

License

Oneline is released under an MIT license.