2121// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222// THE SOFTWARE.
2323
24- #if os(iOS)
24+ #if os(iOS) || os(tvOS)
2525import UIKit
2626#else
2727import AppKit
@@ -95,6 +95,8 @@ public protocol ConstraintDescriptionRelatable: class {
9595 func equalTo( other: View ) -> ConstraintDescriptionEditable
9696 @available ( iOS 7 . 0 , * )
9797 func equalTo( other: LayoutSupport ) -> ConstraintDescriptionEditable
98+ @available ( iOS 9 . 0 , * )
99+ func equalTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable
98100 func equalTo( other: Float ) -> ConstraintDescriptionEditable
99101 func equalTo( other: Double ) -> ConstraintDescriptionEditable
100102 func equalTo( other: CGFloat ) -> ConstraintDescriptionEditable
@@ -108,6 +110,8 @@ public protocol ConstraintDescriptionRelatable: class {
108110 func lessThanOrEqualTo( other: View ) -> ConstraintDescriptionEditable
109111 @available ( iOS 7 . 0 , * )
110112 func lessThanOrEqualTo( other: LayoutSupport ) -> ConstraintDescriptionEditable
113+ @available ( iOS 9 . 0 , * )
114+ func lessThanOrEqualTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable
111115 func lessThanOrEqualTo( other: Float ) -> ConstraintDescriptionEditable
112116 func lessThanOrEqualTo( other: Double ) -> ConstraintDescriptionEditable
113117 func lessThanOrEqualTo( other: CGFloat ) -> ConstraintDescriptionEditable
@@ -121,6 +125,8 @@ public protocol ConstraintDescriptionRelatable: class {
121125 func greaterThanOrEqualTo( other: View ) -> ConstraintDescriptionEditable
122126 @available ( iOS 7 . 0 , * )
123127 func greaterThanOrEqualTo( other: LayoutSupport ) -> ConstraintDescriptionEditable
128+ @available ( iOS 9 . 0 , * )
129+ func greaterThanOrEqualTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable
124130 func greaterThanOrEqualTo( other: Float ) -> ConstraintDescriptionEditable
125131 func greaterThanOrEqualTo( other: Double ) -> ConstraintDescriptionEditable
126132 func greaterThanOrEqualTo( other: CGFloat ) -> ConstraintDescriptionEditable
@@ -224,6 +230,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
224230 internal func equalTo( other: LayoutSupport ) -> ConstraintDescriptionEditable {
225231 return self . constrainTo ( other, relation: . Equal)
226232 }
233+ @available ( iOS 9 . 0 , * )
234+ internal func equalTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable {
235+ return self . constrainTo ( other, relation: . Equal)
236+ }
227237 internal func equalTo( other: Float ) -> ConstraintDescriptionEditable {
228238 return self . constrainTo ( other, relation: . Equal)
229239 }
@@ -261,6 +271,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
261271 internal func lessThanOrEqualTo( other: LayoutSupport ) -> ConstraintDescriptionEditable {
262272 return self . constrainTo ( other, relation: . LessThanOrEqualTo)
263273 }
274+ @available ( iOS 9 . 0 , * )
275+ internal func lessThanOrEqualTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable {
276+ return self . constrainTo ( other, relation: . LessThanOrEqualTo)
277+ }
264278 internal func lessThanOrEqualTo( other: Float ) -> ConstraintDescriptionEditable {
265279 return self . constrainTo ( other, relation: . LessThanOrEqualTo)
266280 }
@@ -298,6 +312,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
298312 internal func greaterThanOrEqualTo( other: LayoutSupport ) -> ConstraintDescriptionEditable {
299313 return self . constrainTo ( other, relation: . GreaterThanOrEqualTo)
300314 }
315+ @available ( iOS 9 . 0 , * )
316+ internal func greaterThanOrEqualTo( other: NSLayoutAnchor ) -> ConstraintDescriptionEditable {
317+ return self . constrainTo ( other, relation: . LessThanOrEqualTo)
318+ }
301319 internal func greaterThanOrEqualTo( other: Float ) -> ConstraintDescriptionEditable {
302320 return self . constrainTo ( other, relation: . GreaterThanOrEqualTo)
303321 }
@@ -446,7 +464,7 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
446464 return self . priority ( 750.0 )
447465 }
448466 internal func priorityMedium( ) -> ConstraintDescriptionFinalizable {
449- #if os(iOS)
467+ #if os(iOS) || os(tvOS)
450468 return self . priority ( 500.0 )
451469 #else
452470 return self . priority ( 501.0 )
@@ -547,6 +565,11 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
547565 return constrainTo ( ConstraintItem ( object: other, attributes: ConstraintAttributes . None) , relation: relation)
548566 }
549567
568+ @available ( iOS 9 . 0 , * )
569+ private func constrainTo( other: NSLayoutAnchor , relation: ConstraintRelation ) -> ConstraintDescription {
570+ return constrainTo ( ConstraintItem ( object: other, attributes: ConstraintAttributes . None) , relation: relation)
571+ }
572+
550573 private func constrainTo( other: Float , relation: ConstraintRelation ) -> ConstraintDescription {
551574 self . constant = other
552575 return constrainTo ( ConstraintItem ( object: nil , attributes: ConstraintAttributes . None) , relation: relation)
@@ -571,4 +594,4 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
571594 self . constant = other
572595 return constrainTo ( ConstraintItem ( object: nil , attributes: ConstraintAttributes . None) , relation: relation)
573596 }
574- }
597+ }
0 commit comments