mirror of https://github.com/SnapKit/SnapKit
Changed identifier to label/labeled
This commit is contained in:
parent
424b9f8160
commit
1cfd8424f1
|
@ -193,18 +193,18 @@ internal class ConcreteConstraint: Constraint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private let identifier: String?
|
private let label: String?
|
||||||
|
|
||||||
private var installInfo: ConcreteConstraintInstallInfo? = nil
|
private var installInfo: ConcreteConstraintInstallInfo? = nil
|
||||||
|
|
||||||
internal init(fromItem: ConstraintItem, toItem: ConstraintItem, relation: ConstraintRelation, constant: Any, multiplier: Float, priority: Float, identifier: String? = nil) {
|
internal init(fromItem: ConstraintItem, toItem: ConstraintItem, relation: ConstraintRelation, constant: Any, multiplier: Float, priority: Float, label: String? = nil) {
|
||||||
self.fromItem = fromItem
|
self.fromItem = fromItem
|
||||||
self.toItem = toItem
|
self.toItem = toItem
|
||||||
self.relation = relation
|
self.relation = relation
|
||||||
self.constant = constant
|
self.constant = constant
|
||||||
self.multiplier = multiplier
|
self.multiplier = multiplier
|
||||||
self.priority = priority
|
self.priority = priority
|
||||||
self.identifier = identifier
|
self.label = label
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func installOnView(updateExisting updateExisting: Bool = false, file: String? = nil, line: UInt? = nil) -> [LayoutConstraint] {
|
internal func installOnView(updateExisting updateExisting: Bool = false, file: String? = nil, line: UInt? = nil) -> [LayoutConstraint] {
|
||||||
|
@ -272,7 +272,7 @@ internal class ConcreteConstraint: Constraint {
|
||||||
attribute: layoutToAttribute,
|
attribute: layoutToAttribute,
|
||||||
multiplier: CGFloat(self.multiplier),
|
multiplier: CGFloat(self.multiplier),
|
||||||
constant: layoutConstant)
|
constant: layoutConstant)
|
||||||
layoutConstraint.identifier = self.identifier
|
layoutConstraint.identifier = self.label
|
||||||
|
|
||||||
// set priority
|
// set priority
|
||||||
layoutConstraint.priority = self.priority
|
layoutConstraint.priority = self.priority
|
||||||
|
|
|
@ -34,7 +34,7 @@ public protocol ConstraintDescriptionFinalizable: class {
|
||||||
|
|
||||||
var constraint: Constraint { get }
|
var constraint: Constraint { get }
|
||||||
|
|
||||||
func identifiedAs(identifier: String) -> ConstraintDescriptionFinalizable
|
func labeled(label: String) -> ConstraintDescriptionFinalizable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
internal var centerX: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.CenterX) }
|
internal var centerX: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.CenterX) }
|
||||||
internal var centerY: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.CenterY) }
|
internal var centerY: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.CenterY) }
|
||||||
internal var baseline: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.Baseline) }
|
internal var baseline: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.Baseline) }
|
||||||
internal var identifier: String?
|
internal var label: String?
|
||||||
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
internal var firstBaseline: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.FirstBaseline) }
|
internal var firstBaseline: ConstraintDescriptionExtendable { return self.addConstraint(ConstraintAttributes.FirstBaseline) }
|
||||||
|
@ -491,13 +491,13 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
|
||||||
constant: self.constant,
|
constant: self.constant,
|
||||||
multiplier: self.multiplier,
|
multiplier: self.multiplier,
|
||||||
priority: self.priority,
|
priority: self.priority,
|
||||||
identifier: self.identifier)
|
label: self.label)
|
||||||
}
|
}
|
||||||
return self.concreteConstraint!
|
return self.concreteConstraint!
|
||||||
}
|
}
|
||||||
|
|
||||||
func identifiedAs(identifier: String) -> ConstraintDescriptionFinalizable {
|
func labeled(label: String) -> ConstraintDescriptionFinalizable {
|
||||||
self.identifier = identifier
|
self.label = label
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ class SnapKitTests: XCTestCase {
|
||||||
self.container.addSubview(view)
|
self.container.addSubview(view)
|
||||||
|
|
||||||
view.snp_makeConstraints { (make) -> Void in
|
view.snp_makeConstraints { (make) -> Void in
|
||||||
make.top.equalTo(self.container.snp_top).identifiedAs(identifier)
|
make.top.equalTo(self.container.snp_top).labeled(identifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
let constraints = container.snp_constraints as! [NSLayoutConstraint]
|
let constraints = container.snp_constraints as! [NSLayoutConstraint]
|
||||||
|
|
Loading…
Reference in New Issue