Autolayout DSL for iOS
Simple and Powerful.
view.vis.makeConstraints { make in
make.left == view.vis.right *~ 2 +~ 100 ~~ .low ~| true
}
view.vis.makeConstraints { make in
make.size <= 100 ~~ .low
}
view.vis.makeConstraints { make in
make[.left, .right, .top] == view
make[.width, .height] == [100, 100]
// equal to `make[.width, .height] == 100`
// not equal to `make[.width, .height] == [100]`
}
view.vis.updateConstraints { make in }
view.vis.remakeConstraints { make in }
Operator | Position | Description |
---|---|---|
== | mid | equal |
>= | mid | greaterThanOrEqual |
<= | mid | lessThanOrEqual |
+~ | mid | offset |
*~ | mid | multiplier |
~~ | mid | priority |
~| | mid | isActive |
Package.swift
let package = Package(
name: "XXX",
dependencies: [
.Package(url: "https://github.com/Wzxhaha/Viscosity", majorVersion: 2)
]
)
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate Viscosity into your Xcode project using CocoaPods, specify it in your Podfile
:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '<Your Target Name>' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Viscosity', '~> 2.0'
end
Then, run the following command:
$ pod install
Of course, you can manually integrate it into your project.
Viscosity is released under the MIT license. See LICENSE for details.