mirror of https://github.com/SnapKit/SnapKit
Rescope a public install/uninstall
This commit is contained in:
parent
b3740ffb0d
commit
cf977c5a1a
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue