2014-07-25 12:24:17 +08:00
|
|
|
//
|
|
|
|
// Constraint.swift
|
|
|
|
// Snappy
|
|
|
|
//
|
|
|
|
// Created by Jonas Budelmann on 25/07/14.
|
|
|
|
// Copyright (c) 2014 Jonas Budelmann. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
@class_protocol protocol ConstraintDelegate {
|
|
|
|
func constraint(constraint: Constraint, shouldBeReplacedWithConstraint replacementConstraint: Constraint)
|
|
|
|
func constraint(constraint: Constraint?, addConstraintWithLayoutAttribute layoutAttribute: NSLayoutAttribute) -> Constraint
|
|
|
|
}
|
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
typealias Delegate = ConstraintDelegate?
|
|
|
|
|
|
|
|
@class_protocol protocol Constraint {
|
|
|
|
weak var delegate: Delegate { get set }
|
|
|
|
|
|
|
|
var left: Constraint { get }
|
|
|
|
var top: Constraint { get }
|
|
|
|
var right: Constraint { get }
|
|
|
|
var bottom: Constraint { get }
|
|
|
|
var leading: Constraint { get }
|
|
|
|
var trailing: Constraint { get }
|
|
|
|
var width: Constraint { get }
|
|
|
|
var height: Constraint { get }
|
|
|
|
var centerX: Constraint { get }
|
|
|
|
var centerY: Constraint { get }
|
|
|
|
var baseline: Constraint { get }
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
var and: Constraint { get }
|
|
|
|
var with: Constraint { get }
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func addConstraint(NSLayoutAttribute) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func equalTo(attr: Any) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func greaterThanOrEqualTo(attr: Any) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func lessThanOrEqualTo(attr: Any) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-27 12:09:38 +08:00
|
|
|
func insets(insets: UIEdgeInsets) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func offset(offset: Any) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func multipliedBy(multiplier: Float) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func dividedBy(divider: Float) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func priority(priority: UILayoutPriority) -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func priorityLow() -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func priorityMedium() -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func priorityHigh() -> Constraint
|
2014-07-25 12:24:17 +08:00
|
|
|
|
2014-07-25 15:48:04 +08:00
|
|
|
func install()
|
2014-07-25 12:24:17 +08:00
|
|
|
}
|