Skip to content

nazmiyavuz/EdgeKit

Repository files navigation

EdgeKit

EdgeKit is a library to make Auto Layout easily on iOS.

apple swift

For the detailed information, please visit Wiki

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 12.0+
  • Swift 6.0

Quick Start

import UIKit
import EdgeKit

class ViewController: UIViewController {

    private let firstView: UIView = {
        $0.backgroundColor = .systemPurple
        $0.layer.cornerRadius = 5
        return $0
    }(UIView())

    private let secondView: UIView = {
        $0.backgroundColor = .systemOrange
        $0.layer.cornerRadius = 5
        return $0
    }(UIView())

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

        view.addSubview(firstView)
        firstView.top(to: .parentView(inSafeArea: true), padding: 16)
        firstView.left(to: .parentView(inSafeArea: true), padding: 16)
        firstView.setSize(width: 200, height: 200)

        view.addSubview(secondView)
        secondView.anchor(leftAnchor: .leftEdge(of: firstView),
                          topAnchor: .bottomEdge(of: firstView),
                          rightAnchor: .rightEdge(of: firstView),
                          topPadding: 20)
        secondView.setHeight(100)

    }

}

Installation

CocoaPods

Simply add the following line to your Podfile:

pod 'EdgeKit'

For the stable version

pod 'EdgeKit', :git => 'https://github.com/nazmiyavuz/EdgeKit.git', :branch => 'main'

For the exact version

pod 'EdgeKit', '~> 1.0.0'

Swift Package Manager

EdgeKit is available through Swift Package Manager. To install it, in Xcode select File > Add Package Dependencies... and add EdgeKit repository URL:

https://github.com/nazmiyavuz/EdgeKit.git

Note: Please update the latest version or main branch of the EdgeKit repository in order to get the latest features.

License

EdgeKit is available under the MIT license. See the LICENSE file for more info.

Feedback

Find a bug or have a feature request? Please file an issue!

It would be great if you could read our documentation first or search in the issues before you post, to avoid duplicates.

Contribute

You can improve the wiki or discuss with us in the issues.

Contact

Email Badge