Make trains of constraints with a clean style!

Related tags

Utility Constren
Overview

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)
You might also like...
Concise Auto Layout API to chain programmatic constraints while easily updating existing constraints.
Concise Auto Layout API to chain programmatic constraints while easily updating existing constraints.

Concise API for Auto Layout. SnapLayout extends UIView and NSView to deliver a list of APIs to improve readability while also shortening constraint co

This app is a sample app that recognizes specific voice commands such as
This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "make it black" and change the background color of the view in the frame.

VoiceOperationSample This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "mak

UIView category which makes it easy to create layout constraints in code

FLKAutoLayout FLKAutoLayout is a collection of categories on UIView which makes it easy to setup layout constraints in code. FLKAutoLayout creates sim

Swift microframework for declaring Auto Layout constraints functionally
Swift microframework for declaring Auto Layout constraints functionally

Relayout Relayout is a Swift microframework to make using Auto Layout easier with static and dynamic layouts. Why? If you want to build a UI using App

Minimal AutoLayout convenience layer. Program constraints succinctly.

MiniLayout Minimal AutoLayout convenience layer. Program constraints succinctly. Usage Put label over textField // using MiniLayout: view.constrain(la

In this repository I've learned how to use the layout as well as alignment and constraints.
In this repository I've learned how to use the layout as well as alignment and constraints.

Auto Layout Our Goal At the moment, our app only looks good on the canvas dimension that we’ve selected. If you run the app on screens with different

iOS constraint maker you always wanted. Write constraints like sentences in English. Simple

YeahLayout iOS constraint maker you always wanted. Write constraints like sentences in English. Simple. Intuitive. No frightening abstractions. One fi

Xylophone-iOS13 - Training project / sound, buttons, constraints

Xylophone-iOS13 Training project / sound, buttons, constraints Simulator.Screen.

Build 1 scene, let AutoLayoutMagic generate the constraints for you!

Auto Layout Magic Create 1 scene, let Auto Layout Magic generate the constraints for you Hello friends, We've all been there. You have an app supporti

Implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top of Swift's Codable implementations.

DynamicCodableKit DynamicCodableKit helps you to implement dynamic JSON decoding within the constraints of Swift's sound type system by working on top

KeyPathKit is a library that provides the standard functions to manipulate data along with a call-syntax that relies on typed keypaths to make the call sites as short and clean as possible.

KeyPathKit Context Swift 4 has introduced a new type called KeyPath, with allows to access the properties of an object with a very nice syntax. For in

Make your logic flow and data flow clean and human readable

Flow What's Flow Flow is an utility/ design pattern that help developers to write simple and readable code. There are two main concerns: Flow of opera

KeyPathKit is a library that provides the standard functions to manipulate data along with a call-syntax that relies on typed keypaths to make the call sites as short and clean as possible.

KeyPathKit Context Swift 4 has introduced a new type called KeyPath, with allows to access the properties of an object with a very nice syntax. For in

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.
SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

SwiftLint - A tool to enforce Swift style and conventions, loosely based on Swift Style Guide.

Style Art library process images using COREML with a set of pre trained machine learning models and convert them to Art style.
Style Art library process images using COREML with a set of pre trained machine learning models and convert them to Art style.

StyleArt Style Art is a library that process images using COREML with a set of pre trained machine learning models and convert them to Art style. Prev

Example of Clean Architecture of iOS app using RxSwift
Example of Clean Architecture of iOS app using RxSwift

Clean architecture with RxSwift Contributions are welcome and highly appreciated!! You can do this by: opening an issue to discuss the current solutio

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way
GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way

GroupWork is an easy to use Swift framework that helps you orchestrate your concurrent, asynchronous functions in a clean and organized way. This help

AREK is a clean and easy way to request any kind of iOS permission (with some nifty features 🤖)
AREK is a clean and easy way to request any kind of iOS permission (with some nifty features 🤖)

AREK is a clean and easy to use wrapper over any kind of iOS permission written in Swift. Why AREK could help you building a better app is well descri

SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.

Articles related to this project Clean Architecture for SwiftUI Programmatic navigation in SwiftUI project Separation of Concerns in Software Design C

Releases(1.0.1)
Owner
Doruk Çoban
iOS Developer
Doruk Çoban
Basic Style Dictionary With Swift

Basic Style Dictionary This example code is bare-bones to show you what this framework can do. If you have the style-dictionary module installed globa

Tiago Oliveira 1 Nov 24, 2021
A danger-swift plug-in to manage/post danger checking results with markdown style

DangerSwiftShoki A danger-swift plug-in to manage/post danger checking results with markdown style Install DangerSwiftShoki SwiftPM (Recommended) Add

YUMEMI Inc. 4 Dec 17, 2021
Generates Heroku-style random project names in Swift

RandomProjectName.swift Generates Heroku-style random project names in Swift. Usage Just call String.randomProjectName(), and specify the optional suf

NLUDB 0 Dec 6, 2021
ObjectiveC additions for humans. Ruby style.

Write Objective C like a boss. A set of functional additions for Foundation you wish you'd had in the first place. Usage Install via CocoaPods pod 'Ob

Marin 2.2k Dec 28, 2022
Extensions which helps to convert objc-style target/action to swifty closures

ActionClosurable Usage ActionClosurable extends UIControl, UIButton, UIRefreshControl, UIGestureRecognizer and UIBarButtonItem. It helps writing swift

takasek 121 Aug 11, 2022
Vaccine is a framework that aims to make your apps immune to recompile-disease.

Vaccine Description Vaccine is a framework that aims to make your apps immune to recompile-disease. Vaccine provides a straightforward way to make you

Christoffer Winterkvist 298 Dec 23, 2022
Tools and helpers to make building apps faster and safer.

The UBFoundation framework provides a set of useful tools and helpers to make building apps faster and safer.

Ubique 7 Dec 19, 2022
Enzyme is a spm package for the make easier development on iOS

Enzyme Enzyme is a spm package for the make easier development on iOS. Installation For the installation you just need to add the url of the project t

Ebubekir 2 Jan 20, 2022
A Collection of useful Swift property wrappers to make coding easier

Swift Property Wrappers A Collection of useful Swift property wrappers to make c

Gordan Glavaš 2 Jan 28, 2022
DGPreview - Make UIKit project enable preview feature of SwiftUI

DGPreview Make UIKit project enable preview feature of SwiftUI Requirements iOS

donggyu 5 Feb 14, 2022