added priority to extension
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
45cd013784
commit
57375576ac
@ -171,8 +171,8 @@ extension UIView {
|
|||||||
/// Adds a topAnchor.
|
/// Adds a topAnchor.
|
||||||
/// - Parameter constant: Constant size.
|
/// - Parameter constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTop(_ constant: CGFloat = 0.0) -> Self {
|
public func pinTop(_ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
return pinTop(nil, constant)
|
return pinTop(nil, constant, priority)
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -180,8 +180,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTop(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinTop(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTop(anchor: anchor, constant: constant)
|
pinTop(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,8 +190,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTopLessThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinTopLessThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTopLessThanOrEqualTo(anchor: anchor, constant: constant)
|
pinTopLessThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,8 +200,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTopGreaterThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinTopGreaterThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTopGreaterThanOrEqualTo(anchor: anchor, constant: constant)
|
pinTopGreaterThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,10 +210,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTop(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTop(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return topAnchor.constraint(equalTo: found, constant: constant).activate()
|
return topAnchor.constraint(equalTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -221,10 +221,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTopLessThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTopLessThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return topAnchor.constraint(lessThanOrEqualTo: found, constant: constant).activate()
|
return topAnchor.constraint(lessThanOrEqualTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -232,10 +232,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
/// - Parameter anchor:The anchor in which to attach the topAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTopGreaterThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTopGreaterThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.topAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return topAnchor.constraint(greaterThanOrEqualTo: found, constant: constant).activate()
|
return topAnchor.constraint(greaterThanOrEqualTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -248,8 +248,8 @@ extension UIView {
|
|||||||
/// Adds a bottomAnchor.
|
/// Adds a bottomAnchor.
|
||||||
/// - Parameter constant: Constant size.
|
/// - Parameter constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinBottom(_ constant: CGFloat = 0.0) -> Self {
|
public func pinBottom(_ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
return pinBottom(nil, constant)
|
return pinBottom(nil, constant, priority)
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -257,8 +257,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinBottom(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinBottom(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinBottom(anchor: anchor, constant: constant)
|
pinBottom(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,8 +267,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinBottomLessThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinBottomLessThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinBottomLessThanOrEqualTo(anchor: anchor, constant: constant)
|
pinBottomLessThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,8 +277,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinBottomGreaterThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinBottomGreaterThanOrEqualTo(_ anchor: NSLayoutYAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinBottomGreaterThanOrEqualTo(anchor: anchor, constant: constant)
|
pinBottomGreaterThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,10 +287,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinBottom(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinBottom(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return bottomAnchor.constraint(equalTo: found, constant: -constant).activate()
|
return bottomAnchor.constraint(equalTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -298,10 +298,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinBottomLessThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinBottomLessThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return bottomAnchor.constraint(lessThanOrEqualTo: found, constant: -constant).activate()
|
return bottomAnchor.constraint(lessThanOrEqualTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -309,10 +309,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
/// - Parameter anchor:The anchor in which to attach the bottomAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinBottomGreaterThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinBottomGreaterThanOrEqualTo(anchor: NSLayoutYAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
let found: NSLayoutYAxisAnchor? = anchor ?? superview?.bottomAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return bottomAnchor.constraint(greaterThanOrEqualTo: found, constant: -constant).activate()
|
return bottomAnchor.constraint(greaterThanOrEqualTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,8 +325,8 @@ extension UIView {
|
|||||||
/// Adds a leadingAnchor.
|
/// Adds a leadingAnchor.
|
||||||
/// - Parameter constant: Constant size.
|
/// - Parameter constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinLeading(_ constant: CGFloat = 0.0) -> Self {
|
public func pinLeading(_ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
return pinLeading(nil, constant)
|
return pinLeading(nil, constant, priority)
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -334,8 +334,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor.
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor.
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinLeading(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinLeading(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinLeading(anchor: anchor, constant: constant)
|
pinLeading(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,8 +344,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinLeadingLessThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinLeadingLessThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinLeadingLessThanOrEqualTo(anchor: anchor, constant: constant)
|
pinLeadingLessThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,8 +354,8 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinLeadingGreaterThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinLeadingGreaterThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinLeadingGreaterThanOrEqualTo(anchor: anchor, constant: constant)
|
pinLeadingGreaterThanOrEqualTo(anchor: anchor, constant: constant, priority: priority)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,10 +364,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinLeading(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinLeading(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return leadingAnchor.constraint(equalTo: found, constant: constant).activate()
|
return leadingAnchor.constraint(equalTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -375,10 +375,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinLeadingLessThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinLeadingLessThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return leadingAnchor.constraint(lessThanOrEqualTo: found, constant: constant).activate()
|
return leadingAnchor.constraint(lessThanOrEqualTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -386,10 +386,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
/// - Parameter anchor:The anchor in which to attach the leadingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinLeadingGreaterThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinLeadingGreaterThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.leadingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return leadingAnchor.constraint(greaterThanOrEqualTo: found, constant: constant).activate()
|
return leadingAnchor.constraint(greaterThanOrEqualTo: found, constant: constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ extension UIView {
|
|||||||
/// Adds a trailingAnchor.
|
/// Adds a trailingAnchor.
|
||||||
/// - Parameter constant: Constant size.
|
/// - Parameter constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTrailing(_ constant: CGFloat = 0.0) -> Self {
|
public func pinTrailing(_ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTrailing(nil, constant)
|
pinTrailing(nil, constant)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the trailingAnchor.
|
/// - Parameter anchor:The anchor in which to attach the trailingAnchor.
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTrailing(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinTrailing(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTrailing(anchor: anchor, constant: constant)
|
pinTrailing(anchor: anchor, constant: constant)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pinTrailingLessThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0) -> Self {
|
public func pinTrailingLessThanOrEqualTo(_ anchor: NSLayoutXAxisAnchor? = nil, _ constant: CGFloat = 0.0, _ priority: UILayoutPriority = .required) -> Self {
|
||||||
pinTrailingLessThanOrEqualTo(anchor: anchor, constant: constant)
|
pinTrailingLessThanOrEqualTo(anchor: anchor, constant: constant)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
@ -441,10 +441,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTrailing(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTrailing(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return trailingAnchor.constraint(equalTo: found, constant: -constant).activate()
|
return trailingAnchor.constraint(equalTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -452,10 +452,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTrailingLessThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTrailingLessThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return trailingAnchor.constraint(lessThanOrEqualTo: found, constant: -constant).activate()
|
return trailingAnchor.constraint(lessThanOrEqualTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
@ -463,10 +463,10 @@ extension UIView {
|
|||||||
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
/// - Parameter anchor:The anchor in which to attach the trailingAnchor
|
||||||
/// - constant: Constant size.
|
/// - constant: Constant size.
|
||||||
/// - Returns: The Constraint that was created.
|
/// - Returns: The Constraint that was created.
|
||||||
public func pinTrailingGreaterThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0) -> NSLayoutConstraint? {
|
public func pinTrailingGreaterThanOrEqualTo(anchor: NSLayoutXAxisAnchor?, constant: CGFloat = 0.0, priority: UILayoutPriority = .required) -> NSLayoutConstraint? {
|
||||||
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
let found: NSLayoutXAxisAnchor? = anchor ?? superview?.trailingAnchor
|
||||||
guard let found else { return nil }
|
guard let found else { return nil }
|
||||||
return trailingAnchor.constraint(greaterThanOrEqualTo: found, constant: -constant).activate()
|
return trailingAnchor.constraint(greaterThanOrEqualTo: found, constant: -constant).with { $0.priority = priority; $0.isActive = true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user