From 9b1a0519eedf20526798cde6cd088b61496904e9 Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Sat, 10 Sep 2016 16:31:28 +1200 Subject: [PATCH] Add back in equalToSuperview API --- Source/ConstraintMakerRelatable.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/ConstraintMakerRelatable.swift b/Source/ConstraintMakerRelatable.swift index 7a2968d..40a46fa 100644 --- a/Source/ConstraintMakerRelatable.swift +++ b/Source/ConstraintMakerRelatable.swift @@ -74,6 +74,14 @@ public class ConstraintMakerRelatable { return self.relatedTo(other, relation: .equal, file: file, line: line) } + @discardableResult + public func equalToSuperview(_ 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 `equalToSuperview`.") + } + return self.relatedTo(other, relation: .equal, file: file, line: line) + } + @discardableResult public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable { return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)