Swiftpack.co - akaashdev/Accio as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by akaashdev.
akaashdev/Accio 0.1.0
A collection of util methods to make building programmatic UI simple, easy and enjoyable.
⭐️ 0
🕓 1 year ago
iOS
.package(url: "https://github.com/akaashdev/Accio.git", from: "0.1.0")

Accio

CI Status Version License Platform codecov HitCount

Accio is a Collection of Layout Util methods to help developers build Programmatic UI very fast and easy. It completely follows AutoLayout under the hood. It uses declarative approach to do stuff. The main goal of Accio is to remove huge chunks of redundant constraints methods and have a more readable and simple code.

Usage

The general code to anchor a subview to fill its superview be like,

var redView: UIView = {
    let view = UIView()
    view.translatesAutoresizingMaskIntoConstraints = false
    view.backgroundColor = .red
    return view
}()

view.addSubview(redView)

redView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
redView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
redView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
redView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true

The same code to do with Accio be like,

var redView: UIView = create {
    $0.translatesAutoresizingMaskIntoConstraints = false
    $0.backgroundColor = .red
}

view.addSubview(redView)

redView.fill()

Yea, adding layout guides is even simpler,

redView.fill(following: .safeArea)

Example

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

Requirements

Installation

Accio is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Accio'

License

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

Author

Akaash Dev
[email protected]

 

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics