SugarAndCandy / SuperPuperDuperLayout

Super puper duper mega easy awesome wrapper over auto layout!!111!!1!!!1!!!11111!!!1!!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SuperPuperDuperLayout

Lightweight, elegant and safe wrapper over auto layout.

Inspired by Layout Anchors and SnapKit.

Without overheads such as «extension UIView», «extension UILayoutGuide», «objc_setAssociatedObjectAssociatedObject», «objc_getAssociatedObject» etc.

CocoaPods CocoaPods CocoaPods

Contents

For example

Layout Anchors

By using Layout Anchors it would be as below

class ViewController: UIViewController {
    private lazy var someView = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(someView)
        someView.translatesAutoresizingMaskIntoConstraints = false
        someView.heightAnchor.constraint(equalToConstant: 30).isActive = true
        someView.widthAnchor.constraint(equalToConstant: 30).isActive = true
        someView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
        someView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
    }
}

But if you support iOS 8 everything becomes worse, because of NSLayoutConstraint(item:attribute:relatedBy:blah:blah:blah:blah)

SuperPuperDuperLayout

You may use "SuperPuperDuperLayout" like this

import SuperPuperDuperLayout

class ViewController: UIViewController {
    private lazy var someView = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(someView)
        Layout.to(someView) {
            $0.size.equal.value(.init(width: 30, height: 30))
            $0.center.equalToSuperview.value(.zero)
        }
    }
}

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.4.0+ is required to build SuperPuperDuperLayout 1.0.0.

To integrate SuperPuperDuperLayout into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'TargetName' do
    pod 'SuperPuperDuperLayout'
end

Then, run the following command:

$ pod install

Requirements

  • iOS 8.0+
  • Xcode 9.0+
  • Swift 4.1+

Credits

License

SuperPuperDuperLayout is released under the MIT license. See LICENSE for details.

About

Super puper duper mega easy awesome wrapper over auto layout!!111!!1!!!1!!!11111!!!1!!

License:MIT License


Languages

Language:Swift 96.6%Language:Objective-C 2.0%Language:Ruby 1.4%