SwiftCassowary 0.1-beta

SwiftCassowary 0.1-beta

Maintained by nange.



  • By
  • TangNan

Cassowary

Carthage compatible Swift 4.0

Cassowary is a swift implement of constraint solving algorithm Cassowary which forms the core of the OS X and iOS Autolayout . This project is start from a direct port of rhea,but after that ,a lot of optimization has been added to make it performent better.

Requirements

  • iOS 8.0+
  • Swift 4.2
  • Xcode 10

Installation

  • Carthage github "https://github.com/nangege/Cassowary" "master"
  • Manually - just drag this project file to your workspace

Then add Cassowary to Linked Frameworks and Libraries

import Cassowary

Usage

let v1 = Variable(),v2 = Variable, v3 = Variable()
let solver = SimplexSolver()
try? solver.add(v1 + v2 == 10)
try? solver.add(v1 - v2 == 2)
solver.solve()
print(solver.valueFor(v1)).  // 6
print(solver.valueFor(v2)).  // 4

Lisence

The MIT License (MIT)