mirror of https://github.com/SnapKit/SnapKit
Merge pull request #151 from aleffert/aleffert/layout-anchors
Add support for the iOS 9 Layout Anchor API.
This commit is contained in:
commit
99d503af97
|
@ -95,6 +95,8 @@ public protocol ConstraintDescriptionRelatable: class {
|
||||||
func equalTo(other: View) -> ConstraintDescriptionEditable
|
func equalTo(other: View) -> ConstraintDescriptionEditable
|
||||||
@available(iOS 7.0, *)
|
@available(iOS 7.0, *)
|
||||||
func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
func equalTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
|
||||||
func equalTo(other: Float) -> ConstraintDescriptionEditable
|
func equalTo(other: Float) -> ConstraintDescriptionEditable
|
||||||
func equalTo(other: Double) -> ConstraintDescriptionEditable
|
func equalTo(other: Double) -> ConstraintDescriptionEditable
|
||||||
func equalTo(other: CGFloat) -> ConstraintDescriptionEditable
|
func equalTo(other: CGFloat) -> ConstraintDescriptionEditable
|
||||||
|
@ -108,6 +110,8 @@ public protocol ConstraintDescriptionRelatable: class {
|
||||||
func lessThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
|
func lessThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
|
||||||
@available(iOS 7.0, *)
|
@available(iOS 7.0, *)
|
||||||
func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
func lessThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
|
||||||
func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
|
func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
|
||||||
func lessThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
|
func lessThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
|
||||||
func lessThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
|
func lessThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
|
||||||
|
@ -121,6 +125,8 @@ public protocol ConstraintDescriptionRelatable: class {
|
||||||
func greaterThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
|
func greaterThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
|
||||||
@available(iOS 7.0, *)
|
@available(iOS 7.0, *)
|
||||||
func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
func greaterThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
|
||||||
func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
|
func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
|
||||||
func greaterThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
|
func greaterThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
|
||||||
func greaterThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
|
func greaterThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
|
||||||
|
@ -224,6 +230,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
internal func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
internal func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .Equal)
|
return self.constrainTo(other, relation: .Equal)
|
||||||
}
|
}
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
internal func equalTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
|
||||||
|
return self.constrainTo(other, relation: .Equal)
|
||||||
|
}
|
||||||
internal func equalTo(other: Float) -> ConstraintDescriptionEditable {
|
internal func equalTo(other: Float) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .Equal)
|
return self.constrainTo(other, relation: .Equal)
|
||||||
}
|
}
|
||||||
|
@ -261,6 +271,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
internal func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
internal func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
||||||
}
|
}
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
internal func lessThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
|
||||||
|
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
||||||
|
}
|
||||||
internal func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
|
internal func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
||||||
}
|
}
|
||||||
|
@ -298,6 +312,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
internal func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
internal func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
|
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
|
||||||
}
|
}
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
internal func greaterThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
|
||||||
|
return self.constrainTo(other, relation: .LessThanOrEqualTo)
|
||||||
|
}
|
||||||
internal func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
|
internal func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
|
||||||
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
|
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
|
||||||
}
|
}
|
||||||
|
@ -547,6 +565,11 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation)
|
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(iOS 9.0, *)
|
||||||
|
private func constrainTo(other: NSLayoutAnchor, relation: ConstraintRelation) -> ConstraintDescription {
|
||||||
|
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation)
|
||||||
|
}
|
||||||
|
|
||||||
private func constrainTo(other: Float, relation: ConstraintRelation) -> ConstraintDescription {
|
private func constrainTo(other: Float, relation: ConstraintRelation) -> ConstraintDescription {
|
||||||
self.constant = other
|
self.constant = other
|
||||||
return constrainTo(ConstraintItem(object: nil, attributes: ConstraintAttributes.None), relation: relation)
|
return constrainTo(ConstraintItem(object: nil, attributes: ConstraintAttributes.None), relation: relation)
|
||||||
|
|
Loading…
Reference in New Issue