Skip to content

Commit

Permalink
Set priority for the spacerWidth view. (trustwallet#746)
Browse files Browse the repository at this point in the history
* Set priority for the spacerWidth view.

* Add priority property.
  • Loading branch information
OlegGordiichuk authored and vikmeup committed Jun 8, 2018
1 parent 1be9283 commit 27b7aac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Trust/Extensions/UIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ extension UIView {
return view
}

static func spacerWidth(_ width: CGFloat = 1, backgroundColor: UIColor = .clear, alpha: CGFloat = 1) -> UIView {
static func spacerWidth(_ width: CGFloat = 1, backgroundColor: UIColor = .clear, alpha: CGFloat = 1, priority: UILayoutPriority = UILayoutPriority(rawValue: 1000)) -> UIView {
let view = UIView(frame: .zero)
view.translatesAutoresizingMaskIntoConstraints = false
view.backgroundColor = backgroundColor
view.alpha = alpha

let width = view.widthAnchor.constraint(equalToConstant: width)
width.isActive = true
width.priority = UILayoutPriority(rawValue: 999)
width.priority = priority

return view
}
Expand Down
2 changes: 1 addition & 1 deletion Trust/Tokens/Views/TokenHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TokenHeaderView: UIView {
amountStack.translatesAutoresizingMaskIntoConstraints = false
amountStack.axis = .horizontal

let marketPriceStack = UIStackView(arrangedSubviews: [fiatAmountLabel, .spacerWidth(5, backgroundColor: UIColor.clear, alpha: 0), percentChange])
let marketPriceStack = UIStackView(arrangedSubviews: [fiatAmountLabel, .spacerWidth(5, backgroundColor: UIColor.clear, alpha: 0, priority: UILayoutPriority(rawValue: 999)), percentChange])
marketPriceStack.translatesAutoresizingMaskIntoConstraints = false
marketPriceStack.axis = .horizontal
marketPriceStack.distribution = .equalSpacing
Expand Down

0 comments on commit 27b7aac

Please sign in to comment.