Swiftpack.co - dorvk/Constren as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by dorvk.
dorvk/Constren 1.0.3
Make trains of constraints with a clean style!
⭐️ 4
🕓 2 years ago
.package(url: "https://github.com/dorvk/Constren.git", from: "1.0.3")

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 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"

Swift Package Manager

To add Constren into your project using Swift Package Manager, add following into your Package.swift file,

dependencies: [ .package(url: "https://github.com/dorvk/Constren.git", .branch("master")) ]

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
    
var constraint = imageView.constren
                    .width(50)
                    .asNSLayoutConstraint
                    
constraint?.constant = 100                   // supports constant updating 

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: 4
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Release
2 years ago

New Release for Swift Packages...

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