Latest 0.1.1
Homepage https://github.com/ghks1353/LessUI
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

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.

Latest podspec

{
    "name": "LessUI",
    "version": "0.1.1",
    "summary": "Write super-simple UI code with LessUI",
    "description": "Super-simple shortcut UI extension codes for swift.",
    "homepage": "https://github.com/ghks1353/LessUI",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ghks1353": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ghks1353/LessUI.git",
        "tag": "0.1.1"
    },
    "swift_versions": "5.0",
    "source_files": "src/default/*",
    "platforms": {
        "ios": "9.0"
    },
    "default_subspecs": "Default",
    "frameworks": "UIKit",
    "subspecs": [
        {
            "name": "Default",
            "source_files": "src/default/*"
        },
        {
            "name": "Transition",
            "source_files": "src/transition/*",
            "dependencies": {
                "pop": [
                    "~> 1.0"
                ]
            }
        },
        {
            "name": "Network",
            "source_files": "src/network/*",
            "dependencies": {
                "Alamofire": [
                    "~> 4.7"
                ],
                "AlamofireImage": [
                    "~> 3.5"
                ]
            }
        }
    ]
}

Pin It on Pinterest

Share This