Skip to content

Commit e7c91e3

Browse files
authored
Merge pull request #22 from prolificinteractive/feature/button_state_style_support
Updated UIButtonExtension to take the button state as a parameter
2 parents 48ae7a9 + e85643a commit e7c91e3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Marker/Marker/Utility/Extensions/Button/UIButtonExtension.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ public extension UIButton {
1616
/// - text: The text to be displayed in the label.
1717
/// - textStyle: Text style object containing style information.
1818
/// - markups: Custom markup if there is any. Defaults to zero custom markup.
19-
func setTitleText(_ text: String, using textStyle: TextStyle, customMarkup markups: Markup = [:]) {
20-
setAttributedTitle(attributedMarkupString(from: text, using: textStyle, customMarkup: markups), for: .normal)
19+
/// - state: The button state to set.
20+
func setTitleText(_ text: String,
21+
using textStyle: TextStyle,
22+
customMarkup markups: Markup = [:],
23+
forState state: UIControlState = .normal) {
24+
setAttributedTitle(attributedMarkupString(from: text, using: textStyle, customMarkup: markups), for: state)
2125
}
2226

2327
/// Sets the button's title text to an attributed string created from the specified string and text style.
@@ -27,8 +31,11 @@ public extension UIButton {
2731
/// - Parameters:
2832
/// - markdownText: The Markdown text to be displayed in the label.
2933
/// - textStyle: Text style object containing style information.
30-
func setMarkdownTitleText(_ markdownText: String, using textStyle: TextStyle) {
31-
setAttributedTitle(attributedMarkdownString(from: markdownText, using: textStyle), for: .normal)
34+
/// - state: The button state to set.
35+
func setMarkdownTitleText(_ markdownText: String,
36+
using textStyle: TextStyle,
37+
forState state: UIControlState = .normal) {
38+
setAttributedTitle(attributedMarkdownString(from: markdownText, using: textStyle), for: state)
3239
}
3340

3441
}

0 commit comments

Comments
 (0)