mirror of https://github.com/SnapKit/SnapKit
Add availability check for iOS 8 and OS X 10.10 methods.
- `NSLayoutConstraint.activateConstraints(_:)` - `NSLayoutConstraint.deactivateConstraints(_:)`
This commit is contained in:
parent
8e6219ef86
commit
ba03f22eb8
|
@ -138,24 +138,24 @@ internal class ConcreteConstraint: Constraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override func activate() -> Void {
|
internal override func activate() -> Void {
|
||||||
if NSLayoutConstraint.respondsToSelector("activateConstraints:") && self.installInfo != nil {
|
guard #available(iOS 8.0, OSX 10.10, *), self.installInfo != nil else {
|
||||||
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
|
||||||
if layoutConstraints.count > 0 {
|
|
||||||
NSLayoutConstraint.activateConstraints(layoutConstraints)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.install()
|
self.install()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
||||||
|
if layoutConstraints.count > 0 {
|
||||||
|
NSLayoutConstraint.activateConstraints(layoutConstraints)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override func deactivate() -> Void {
|
internal override func deactivate() -> Void {
|
||||||
if NSLayoutConstraint.respondsToSelector("deactivateConstraints:") && self.installInfo != nil {
|
guard #available(iOS 8.0, OSX 10.10, *), self.installInfo != nil else {
|
||||||
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
self.install()
|
||||||
if layoutConstraints.count > 0 {
|
return
|
||||||
NSLayoutConstraint.deactivateConstraints(layoutConstraints)
|
}
|
||||||
}
|
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
||||||
} else {
|
if layoutConstraints.count > 0 {
|
||||||
self.uninstall()
|
NSLayoutConstraint.deactivateConstraints(layoutConstraints)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue