diff --git a/Source/ConstraintMakerRelatable.swift b/Source/ConstraintMakerRelatable.swift index 40a46fa..d50b423 100644 --- a/Source/ConstraintMakerRelatable.swift +++ b/Source/ConstraintMakerRelatable.swift @@ -87,9 +87,24 @@ public class ConstraintMakerRelatable { return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line) } + @discardableResult + public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { + guard let other = self.description.view.superview else { + fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.") + } + return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line) + } + @discardableResult public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line) } + @discardableResult + public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable { + guard let other = self.description.view.superview else { + fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.") + } + return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line) + } }