Giter VIP home page Giter VIP logo

superpuperduperlayout's Introduction

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.

superpuperduperlayout's People

Contributors

sashazolotarev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

valiok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.