mirror of https://github.com/SnapKit/SnapKit
Added sensible @discardableResult attributes for ConstraintMaker public functions
This commit is contained in:
parent
d00444d7d1
commit
b916d75956
|
@ -30,20 +30,24 @@
|
|||
|
||||
public class ConstraintMakerEditable: ConstraintMakerPriortizable {
|
||||
|
||||
@discardableResult
|
||||
public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||
self.description.multiplier = amount
|
||||
return self
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||
return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
|
||||
self.description.constant = amount
|
||||
return self
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
|
||||
let insets: ConstraintInsets
|
||||
|
||||
|
|
|
@ -30,19 +30,23 @@
|
|||
|
||||
public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
|
||||
|
||||
@discardableResult
|
||||
public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
|
||||
self.description.priority = amount
|
||||
return self
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func priorityRequired() -> ConstraintMakerFinalizable {
|
||||
return self.priority(1000)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func priorityHigh() -> ConstraintMakerFinalizable {
|
||||
return self.priority(750)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func priorityMedium() -> ConstraintMakerFinalizable {
|
||||
#if os(iOS) || os(tvOS)
|
||||
return self.priority(500)
|
||||
|
@ -51,6 +55,7 @@ public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
|
|||
#endif
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func priorityLow() -> ConstraintMakerFinalizable {
|
||||
return self.priority(250)
|
||||
}
|
||||
|
|
|
@ -67,14 +67,17 @@ public class ConstraintMakerRelatable {
|
|||
return editable
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||
return self.relatedTo(other, relation: .equal, file: file, line: line)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
|
||||
return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
|
||||
return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue