Skip to content

Commit 39b7237

Browse files
committed
Improve button autolayout
1 parent ee322a3 commit 39b7237

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Demo/Pins/Components/PinButton.swift

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import Pinwheel
22

3-
public extension CGFloat {
4-
static let buttonHeight: CGFloat = 50
5-
}
6-
73
class PinButton: View {
84
var primary: Button!
95
var primaryDisabled: Button!

Pinwheel/Sources/Pinwheel/Components/Button.swift

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public class Button: UIButton {
7676
if let superview = superview, let _ = title {
7777
widthAnchor.constraint(greaterThanOrEqualToConstant: Button.buttonWidth).isActive = true
7878
widthAnchor.constraint(lessThanOrEqualTo: superview.widthAnchor, constant: -.spacingXL).isActive = true
79+
80+
setContentHuggingPriority(.defaultHigh, for: .horizontal)
81+
setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
7982
}
8083
}
8184

0 commit comments

Comments
 (0)