Swiftpack.co -  dankinsoid/ConstraintsOperators as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
dankinsoid/ConstraintsOperators
Convenient operators for creating constraints
.package(url: "https://github.com/dankinsoid/ConstraintsOperators.git", from: "2.27.0")

ConstraintsOperators

CI Status Version License Platform

Usage

Сreate constraints with simple expressions:

view1.ignoreAutoresizingMask()
view1.centerX =| view2.centerX + 10
view1.centerY =| 15

view1.width <=| 200
view1.width >=| 100
//or
view1.width =| 100...200

view1.height =| view2.height / 2 + 20
...
view.width =| 100
view.width =| 200 //automatically replaces previuos width constraint
...
view1.height.priority(.defaultLow) =| 0
...
view1.height.priority(900) =| 10
...
let constraint: NSLayoutConstraint = view1.height.deactivated =| 200
...
view1.height =| view1.superview
view1.centerX =| view2
...
[view1, view2].ignoreAutoresizingMask()
[view1, view2].height =| 200
view1[.centerX, .centerY] =| 0
view1.edges(.vertical) =| 0
...
Axis.vertical =| [10, view1, 0..., view2.fixed(200), 0...5, view3.centerY, 10]
...
view1.top =| view1.leading //compile error, you cannot combine incompatible attributes

Supported operators: =|, <=|, >=|

Every operator returns a NSLayoutConstraint instance with the isActive property set to true.

Installation

ConstraintsOperators is available through CocoaPods. To install

it, simply add the following line to your Podfile:

pod 'ConstraintsOperators'

Author

Voidilov, voidilov@gmail.com

License

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

GitHub

link
Stars: 0
Last commit: 5 days 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.

Dependencies

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