Merged in 0.13.0 changes

This commit is contained in:
Robert Payne 2015-07-30 19:35:48 +12:00
parent 88021b8280
commit 446e5c5758
2 changed files with 8 additions and 12 deletions

View File

@ -130,7 +130,7 @@ internal class ConcreteConstraint: Constraint {
} }
internal override func install() -> [LayoutConstraint] { internal override func install() -> [LayoutConstraint] {
return self.installOnViewUpdatingExisting(false) return self.installOnView(updateExisting: false, file: self.makerFile, line: self.makerLine)
} }
internal override func uninstall() -> Void { internal override func uninstall() -> Void {
@ -194,7 +194,7 @@ internal class ConcreteConstraint: Constraint {
self.priority = priority self.priority = priority
} }
internal func installOnView(updateExisting: Bool = false, file: String? = nil, line: UInt? = nil) -> [LayoutConstraint] { internal func installOnView(updateExisting updateExisting: Bool = false, file: String? = nil, line: UInt? = nil) -> [LayoutConstraint] {
var installOnView: View? = nil var installOnView: View? = nil
if self.toItem.view != nil { if self.toItem.view != nil {
installOnView = closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view) installOnView = closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view)
@ -204,11 +204,7 @@ internal class ConcreteConstraint: Constraint {
} }
} else { } else {
let widthAttr = ConstraintAttributes.Width if self.fromItem.attributes.isSubsetOf(ConstraintAttributes.Width.union(.Height)) {
let heightAttr = ConstraintAttributes.Height
let sizeAttrs = widthAttr | heightAttr
if self.fromItem.attributes == widthAttr || self.fromItem.attributes == heightAttr || self.fromItem.attributes == sizeAttrs {
installOnView = self.fromItem.view installOnView = self.fromItem.view
} else { } else {
installOnView = self.fromItem.view?.superview installOnView = self.fromItem.view?.superview

View File

@ -133,7 +133,7 @@ public class ConstraintMaker {
return constraintDescription return constraintDescription
} }
internal class func prepareConstraints(#view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) -> [Constraint] { internal class func prepareConstraints(view view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
let maker = ConstraintMaker(view: view, file: file, line: line) let maker = ConstraintMaker(view: view, file: file, line: line)
closure(make: maker) closure(make: maker)
@ -145,7 +145,7 @@ public class ConstraintMaker {
return constraints return constraints
} }
internal class func makeConstraints(#view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) { internal class func makeConstraints(view view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) {
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
let maker = ConstraintMaker(view: view, file: file, line: line) let maker = ConstraintMaker(view: view, file: file, line: line)
closure(make: maker) closure(make: maker)
@ -158,7 +158,7 @@ public class ConstraintMaker {
} }
} }
internal class func remakeConstraints(#view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) { internal class func remakeConstraints(view view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) {
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
let maker = ConstraintMaker(view: view, file: file, line: line) let maker = ConstraintMaker(view: view, file: file, line: line)
closure(make: maker) closure(make: maker)
@ -172,7 +172,7 @@ public class ConstraintMaker {
} }
} }
internal class func updateConstraints(#view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) { internal class func updateConstraints(view view: View, file: String = "Unknown", line: UInt = 0, @noescape closure: (make: ConstraintMaker) -> Void) {
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
let maker = ConstraintMaker(view: view, file: file, line: line) let maker = ConstraintMaker(view: view, file: file, line: line)
closure(make: maker) closure(make: maker)
@ -185,7 +185,7 @@ public class ConstraintMaker {
} }
} }
internal class func removeConstraints(#view: View) { internal class func removeConstraints(view view: View) {
for existingLayoutConstraint in view.snp_installedLayoutConstraints { for existingLayoutConstraint in view.snp_installedLayoutConstraints {
existingLayoutConstraint.snp_constraint?.uninstall() existingLayoutConstraint.snp_constraint?.uninstall()
} }