Latest 2.1.0
Homepage https://github.com/Wzxhaha/Viscosity
License MIT
Platforms ios 8.0, requires ARC
Authors

swift version
travis-ci
Platform
Cocoapods Compatible

Autolayout DSL for iOS
Simple and Powerful.

Usage

Normal

 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]`
 }

Update

 view.vis.updateConstraints { make in }

Remake

 view.vis.remakeConstraints { make in }

Operator

Operator Position Description
== mid equal
>= mid greaterThanOrEqual
<= mid lessThanOrEqual
+~ mid offset
*~ mid multiplier
~~ mid priority
~| mid isActive

Installation

Swift Package Manager

Package.swift

let package = Package(
    name: "XXX",
    dependencies: [
        .Package(url: "https://github.com/Wzxhaha/Viscosity", majorVersion: 2)
    ]
)

CocoaPods

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.1.0'

end

Then, run the following command:

$ pod install

Manually

Of course, you can manually integrate it into your project.

License

Viscosity is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "Viscosity",
    "version": "2.1.0",
    "license": "MIT",
    "summary": "Autolayout DSL for iOS",
    "homepage": "https://github.com/Wzxhaha/Viscosity",
    "authors": {
        "WzxJiang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Wzxhaha/Viscosity.git",
        "tag": "2.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This