Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Form/ButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ private extension UIButton {
}

func updateMinimumSize(_ minimumSize: MinimumSize) {
updateConstraint(for: widthAnchor, with: minimumSize.width, constraintKey: &widthConstraintKey)
updateConstraint(for: heightAnchor, with: minimumSize.height, constraintKey: &heightConstraintKey)
updateConstraint(for: widthAnchor, with: minimumSize.width, priority: minimumSize.priority, constraintKey: &widthConstraintKey)
updateConstraint(for: heightAnchor, with: minimumSize.height, priority: minimumSize.priority, constraintKey: &heightConstraintKey)
}

func updateConstraint(for anchor: NSLayoutDimension, with value: CGFloat?, constraintKey key: UnsafeRawPointer) {
func updateConstraint(for anchor: NSLayoutDimension, with value: CGFloat?, priority: UILayoutPriority, constraintKey key: UnsafeRawPointer) {
let constant = value ?? 0
let constraint = associatedValue(forKey: key, initial: anchor >= constant)
constraint.priority = .defaultHigh
constraint.priority = priority
constraint.constant = constant
constraint.isActive = (value != nil)
}
Expand Down
4 changes: 3 additions & 1 deletion Form/MinimumSize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import Foundation
public struct MinimumSize: Style {
public var width: CGFloat?
public var height: CGFloat?
public var priority: UILayoutPriority

public init(width: CGFloat? = nil, height: CGFloat? = nil) {
public init(width: CGFloat? = nil, height: CGFloat? = nil, priority: UILayoutPriority = .defaultHigh) {
self.width = width
self.height = height
self.priority = priority
}
}

Expand Down