Beta 4 Updates

This commit is contained in:
Robert Payne 2016-08-02 19:56:16 +12:00
parent 9f8ad44677
commit 4715badfa0
4 changed files with 15 additions and 15 deletions

View File

@ -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
} }

View File

@ -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

View File

@ -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
} }

View File

@ -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))"
} }
} }