Further fix remake constraints crash in Swift 1.2

This commit is contained in:
Robert Payne 2015-02-16 13:09:18 +13:00
parent f97ec8d1d2
commit 4158cf0d99
1 changed files with 4 additions and 2 deletions

View File

@ -402,9 +402,11 @@ public class Constraint {
if let view = self.installedOnView { if let view = self.installedOnView {
// remove all installed layout constraints // remove all installed layout constraints
var layoutConstraintsToRemove = Array<LayoutConstraint>() var layoutConstraintsToRemove = Array<LayoutConstraint>()
if let installedLayoutConstraints = self.installedLayoutConstraints?.allObjects as? Array<LayoutConstraint> { if let allObjects = self.installedLayoutConstraints?.allObjects {
if let installedLayoutConstraints = allObjects as? Array<LayoutConstraint> {
layoutConstraintsToRemove += installedLayoutConstraints layoutConstraintsToRemove += installedLayoutConstraints
} }
}
if layoutConstraintsToRemove.count > 0 { if layoutConstraintsToRemove.count > 0 {
view.removeConstraints(layoutConstraintsToRemove) view.removeConstraints(layoutConstraintsToRemove)