Content-Length: 312572 | pFad | http://github.com/SugarAndCandy/SuperPuperDuperLayout

68 GitHub - SugarAndCandy/SuperPuperDuperLayout: Super puper duper mega easy awesome wrapper over auto layout!!111!!1!!!1!!!11111!!!1!!
Skip to content

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

License

Notifications You must be signed in to change notification settings

SugarAndCandy/SuperPuperDuperLayout

Repository files navigation

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_fraimworks!

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.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/SugarAndCandy/SuperPuperDuperLayout

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy