Tweak priority API's for offseting

This commit is contained in:
Robert Payne 2017-02-11 23:08:01 +13:00
parent 681dfcbc3a
commit e17ecbfde8
2 changed files with 3 additions and 11 deletions

View File

@ -31,8 +31,8 @@
public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
@discardableResult
public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {
self.description.priority = amount.value
public func priority(_ amount: ConstraintPriority, offset: Float = 0) -> ConstraintMakerFinalizable {
self.description.priority = amount.value + offset
return self
}

View File

@ -28,7 +28,7 @@
#endif
public struct ConstraintPriority : ExpressibleByFloatLiteral, Strideable, Equatable {
public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable {
public typealias FloatLiteralType = Float
public let value: Float
@ -62,14 +62,6 @@ public struct ConstraintPriority : ExpressibleByFloatLiteral, Strideable, Equata
return 250.0
}
public func advanced(by n: Float) -> ConstraintPriority {
return ConstraintPriority(self.value + n)
}
public func distance(to other: ConstraintPriority) -> Float {
return other.value - self.value
}
public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {
return lhs.value == rhs.value
}