Rescope a public install/uninstall

This commit is contained in:
Robert Payne 2015-01-14 14:07:28 +13:00
parent b3740ffb0d
commit cf977c5a1a
1 changed files with 12 additions and 2 deletions

View File

@ -269,9 +269,19 @@ public class Constraint {
return self return self
} }
// MARK: install / uninstall
public func install() -> Array<LayoutConstraint> {
return self.installOnView(updateExisting: false)
}
public func uninstall() {
self.uninstallFromView()
}
// MARK: internal // MARK: internal
internal func install(updateExisting: Bool = false) -> Array<LayoutConstraint> { internal func installOnView(updateExisting: Bool = false) -> Array<LayoutConstraint> {
if self.installedOnView != nil { if self.installedOnView != nil {
NSException(name: "Cannot Install Constraint", reason: "Already installed", userInfo: nil).raise() NSException(name: "Cannot Install Constraint", reason: "Already installed", userInfo: nil).raise()
return [] return []
@ -377,7 +387,7 @@ public class Constraint {
return layoutConstraints return layoutConstraints
} }
internal func uninstall() { internal func uninstallFromView() {
if let view = self.installedOnView { if let view = self.installedOnView {
#if os(iOS) #if os(iOS)
var installedConstraints = view.constraints() var installedConstraints = view.constraints()