LessUI 0.1.4

LessUI 0.1.4

Maintained by Seru.



LessUI 0.1.4

  • By
  • ghks1353

LessUI

Version License Platform

Write super-simple code for UI building!

⚠ This framework is under alpha stage!!

Some of method's usage, parameters, usage can be changed in the future.

About

Without LessUI...

If you want to draw one label and align to center, originally you should write:

let label: UILabel = UILabel()

label.textColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)
label.font = UIFont.systemFont(ofSize: 15)
label.numberOfLines = 0
label.text = "Let's swift 😀\nwithout LessUI 😭"

view.addSubview(label)

label.frame = .zero
label.sizeToFit()
label.frame = CGRect(x: view.frame.width / 2 - label.frame.width / 2, y: view.frame.height / 2 - label.frame.height / 2, label.frame.width, label.frame.height)

With LessUI

But you can write 4 lines of UI code into just one line!

let label: UILabel = UILabel()

label.add(to: view)
    .style(size: 15, color: 0x000000.c, lines: 0)
    .text = "Let's swift 😀\nwith LessUI 🎉"
           
label.prefix().vhCenter()

Method chaining

Most of LessUI's method supports method chaining. You can chain with all of supported methods.

// Without chaining
container.add(to: view)
container.subCenter()
container.fit()
container.hCenter()
container.start(view, y: 12)

// With chaining
container.add(to: view)
    .subCenter().fit()
    .hCenter().start(view, y: 12)

Documentation

See LessUI Wiki.

Example

Go to Example directory, run pod install, and open LessUI.xcworkspace.

Requirements

  • iOS 9.0+
  • Xcode 10.2+
  • Swift 5.0+

Installation

Cocoapods

pod 'LessUI'

Networking utils with Alamofire

pod 'LessUI/Network'

Animation utils with pop

pod 'LessUI/Transition'

Manual

Create a group into your project, drag all source codes in LessUI/src/default into your new folder. If you want to install for /Network, /Transition or both, you have to install dependencies too.

Author

Seru, [email protected]

License

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