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 [] + } } }