Swiftpack.co -  dorvk/Constren as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
dorvk/Constren
Make trains of constraints with a clean style!
.package(url: "https://github.com/dorvk/Constren.git", from: "1.0.1")

License: MIT Constren Cocoapods

Constren 🚂.🚃.🚋

Make trains of constraints with style!

button.constren.centerY()
               .lead(spacing: 16)
               .trail(image.leadingAnchor, spacing: 64)
               .height(100, relation: .greaterThan)

Constren is an easy to use, easy to read layout tool for UIKit

Requirements

  • iOS 10.0+
  • Xcode 10.0+
  • Swift 4.0+

Installation

Cocoapods

To add Constren into your project using CocoaPods, add it in your Podfile:

pod 'Constren', :git => 'https://github.com/dorvk/Constren.git'

Carthage

To add Constren into your project using Carthage, specify it in your Cartfile:

github "dorvk/Constren"

Manually

Add the Sources folder into your project.

Example

import Constren

let imageView = UIImageView()

view.addSubview(imageView)

imageView.constren.top()                                   // default is equalToSuperview with 0 spacing
                  .lead(spacing: 16)                       // you can add spacing
                  .trail(label.leadingAnchor, spacing: 16) 
                  .height(100, relation: .greaterThan)     // supports lessThan or greaterThan, default is equalTo

tableView.constren.fill()                                  // shortcuts

collectionView.constren.fill(lead: 16, bot: 32)

titleLabel.constren.horizontalFill(lead: 16)
                   .centerY(spacing: 16)
                    
imageView.constren.centered(x: 16)
                  .squared(250)

GitHub

link
Stars: 3
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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