From c75495cf4c8788178f9fd7fd20d5c17fc47084c8 Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Tue, 27 Jan 2015 00:31:17 +1300 Subject: [PATCH] Allow size attributes to be installed on a view itself --- Snap/Constraint.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Snap/Constraint.swift b/Snap/Constraint.swift index f034053..b8f09ed 100644 --- a/Snap/Constraint.swift +++ b/Snap/Constraint.swift @@ -297,8 +297,14 @@ public class Constraint { } else { installOnView = self.fromItem.view?.superview if installOnView == nil { + if self.fromItem.attributes == ConstraintAttributes.Width || self.fromItem.attributes == ConstraintAttributes.Height { + installOnView = self.fromItem.view + } + + if installedOnView == nil { NSException(name: "Cannot Install Constraint", reason: "Missing superview", userInfo: nil).raise() return [] + } } }