From 200b34149263c90eb8b4bd2b44509c7060f882c0 Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Thu, 4 Aug 2016 10:27:26 +1200 Subject: [PATCH] Add content hugging / compression resistance shortcuts --- Source/ConstraintViewDSL.swift | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Source/ConstraintViewDSL.swift b/Source/ConstraintViewDSL.swift index 86f0bf9..35a4c39 100644 --- a/Source/ConstraintViewDSL.swift +++ b/Source/ConstraintViewDSL.swift @@ -176,6 +176,42 @@ public struct ConstraintViewDSL { } } + public var contentHuggingHorizontalPriority: Float { + get { + return self.view.contentHuggingPriority(for: .horizontal) + } + set { + self.view.setContentHuggingPriority(newValue, for: .horizontal) + } + } + + public var contentHuggingVerticalPriority: Float { + get { + return self.view.contentHuggingPriority(for: .vertical) + } + set { + self.view.setContentHuggingPriority(newValue, for: .vertical) + } + } + + public var contentCompressionResistanceHorizontalPriority: Float { + get { + return self.view.contentCompressionResistancePriority(for: .horizontal) + } + set { + self.view.setContentHuggingPriority(newValue, for: .horizontal) + } + } + + public var contentCompressionResistanceVerticalPriority: Float { + get { + return self.view.contentCompressionResistancePriority(for: .vertical) + } + set { + self.view.setContentCompressionResistancePriority(newValue, for: .vertical) + } + } + internal let view: ConstraintView internal init(view: ConstraintView) {