diff --git a/Snappy/ConstraintMaker.swift b/Snappy/ConstraintMaker.swift index 0eae823..f9ae7ad 100644 --- a/Snappy/ConstraintMaker.swift +++ b/Snappy/ConstraintMaker.swift @@ -97,4 +97,11 @@ public class ConstraintMaker { } LayoutConstraint.setLayoutConstraints(layoutConstraints, installedOnView: view) } + + internal class func removeConstraints(view: View) { + for existingLayoutConstraint in LayoutConstraint.layoutConstraintsInstalledOnView(view) { + existingLayoutConstraint.constraint?.uninstall() + } + LayoutConstraint.setLayoutConstraints([], installedOnView: view) + } } \ No newline at end of file diff --git a/Snappy/View+Snappy.swift b/Snappy/View+Snappy.swift index 922e1f5..2705549 100644 --- a/Snappy/View+Snappy.swift +++ b/Snappy/View+Snappy.swift @@ -67,4 +67,8 @@ public extension View { public func snp_remakeConstraints(block: (maker: ConstraintMaker) -> ()) { ConstraintMaker.remakeConstraints(self, block: block) } + + public func snp_removeConstraints() { + ConstraintMaker.removeConstraints(self) + } } \ No newline at end of file