mirror of https://github.com/SnapKit/SnapKit
Beta 4 Updates
This commit is contained in:
parent
9f8ad44677
commit
4715badfa0
|
@ -201,7 +201,7 @@ public class Constraint {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set install info
|
// set install info
|
||||||
self.installInfo = ConstraintInstallInfo(view: installOnView, layoutConstraints: HashTable.weakObjects())
|
self.installInfo = ConstraintInstallInfo(view: installOnView, layoutConstraints: NSHashTable.weakObjects())
|
||||||
|
|
||||||
// store which layout constraints are installed for this constraint
|
// store which layout constraints are installed for this constraint
|
||||||
for layoutConstraint in newLayoutConstraints {
|
for layoutConstraint in newLayoutConstraints {
|
||||||
|
@ -219,8 +219,8 @@ public class Constraint {
|
||||||
self.installInfo = nil
|
self.installInfo = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let installedLayoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
guard let installedLayoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint],
|
||||||
where installedLayoutConstraints.count > 0 else {
|
installedLayoutConstraints.count > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,9 +250,9 @@ public class Constraint {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint],
|
||||||
where layoutConstraints.count > 0 else {
|
layoutConstraints.count > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLayoutConstraint.activate(layoutConstraints)
|
NSLayoutConstraint.activate(layoutConstraints)
|
||||||
|
@ -265,9 +265,9 @@ public class Constraint {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint],
|
||||||
where layoutConstraints.count > 0 else {
|
layoutConstraints.count > 0 else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLayoutConstraint.deactivate(layoutConstraints)
|
NSLayoutConstraint.deactivate(layoutConstraints)
|
||||||
|
@ -278,9 +278,9 @@ public class Constraint {
|
||||||
private final class ConstraintInstallInfo {
|
private final class ConstraintInstallInfo {
|
||||||
|
|
||||||
private weak var view: ConstraintView? = nil
|
private weak var view: ConstraintView? = nil
|
||||||
private let layoutConstraints: HashTable<AnyObject>
|
private let layoutConstraints: NSHashTable<AnyObject>
|
||||||
|
|
||||||
private init(view: ConstraintView?, layoutConstraints: HashTable<AnyObject>) {
|
private init(view: ConstraintView?, layoutConstraints: NSHashTable<AnyObject>) {
|
||||||
self.view = view
|
self.view = view
|
||||||
self.layoutConstraints = layoutConstraints
|
self.layoutConstraints = layoutConstraints
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
internal struct ConstraintAttributes: OptionSet, Boolean {
|
internal struct ConstraintAttributes: OptionSet {
|
||||||
|
|
||||||
internal init(rawValue: UInt) {
|
internal init(rawValue: UInt) {
|
||||||
self.rawValue = rawValue
|
self.rawValue = rawValue
|
||||||
|
|
|
@ -56,8 +56,8 @@ public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
|
||||||
|
|
||||||
// must both have valid targets and identical attributes
|
// must both have valid targets and identical attributes
|
||||||
guard let target1 = lhs.target,
|
guard let target1 = lhs.target,
|
||||||
let target2 = rhs.target
|
let target2 = rhs.target,
|
||||||
where target1 === target2 && lhs.attributes == rhs.attributes else {
|
target1 === target2 && lhs.attributes == rhs.attributes else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public extension LayoutConstraint {
|
||||||
if self.constant > 0.0 {
|
if self.constant > 0.0 {
|
||||||
description += " + \(self.constant)"
|
description += " + \(self.constant)"
|
||||||
} else if self.constant < 0.0 {
|
} else if self.constant < 0.0 {
|
||||||
description += " - \(CGFloat.abs(self.constant))"
|
description += " - \(abs(self.constant))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue