Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specifying max width #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions PopMenu/Classes/PopMenuAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public typealias Color = UIColor
/// Appearance for PopMenu.
/// Use for configuring custom styles and looks.
final public class PopMenuAppearance: NSObject {
/// The minimum width for the menu; Default: auto-sizing
public var popMenuMinimumWidth: CGFloat? = .none

/// Background and tint colors.
public var popMenuColor: PopMenuColor = .default()
Expand Down
7 changes: 6 additions & 1 deletion PopMenu/View Controller & Views/PopMenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,12 @@ extension PopMenuViewController {
contentFitWidth += action.iconWidthHeight
}

return min(contentFitWidth,maxContentWidth)

if let minimumWidth = self.appearance.popMenuMinimumWidth {
return max(minimumWidth, min(contentFitWidth,maxContentWidth))
} else {
return min(contentFitWidth,maxContentWidth)
}
}

/// Setup actions view.
Expand Down