Skip to content

A DSL library of working with auto layout in swift in a simpler and safer way

Notifications You must be signed in to change notification settings

DavidKmn/AnchorKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Usage


        redView.layout { (layoutProxy) in
            layoutProxy.height.equal(toConstant: 100).priority = .required
            layoutProxy.top == view.safeTopAnchor
            layoutProxy.leading == view.safeLeadingAnchor
            layoutProxy.trailing == view.safeTrailingAnchor
        }
        
        blueView.layout {
            $0.height == view.heightAnchor * 0.2
            $0.top == redView.topAnchor
            $0.leading == redView.leadingAnchor
            $0.width == redView.widthAnchor * 0.5
        }
        
        greenView.layout {
            $0.top == redView.bottomAnchor
            $0.trailing == view.safeTrailingAnchor
            $0.leading == blueView.trailingAnchor
            $0.bottom == view.safeBottomAnchor
        }

        yellowView.layout { (layoutProxy) in
            layoutProxy.height == greenView.heightAnchor * 0.3
            layoutProxy.width == greenView.widthAnchor * 0.4
            layoutProxy.centerX == view.centerXAnchor
            layoutProxy.centerY == view.centerYAnchor
        }

Installation

Cocoa Pods

Add the following entry to your Podfile:

pod 'AnchorKit', :git => 'https://github.com/DavidKmn/AnchorKit.git', :tag => '0.0.6'

Then run pod install.

Enjoy !

About

A DSL library of working with auto layout in swift in a simpler and safer way

Resources

Stars

Watchers

Forks

Packages

No packages published