diff --git a/Sources/Epoxy/Row/ButtonRow/ButtonRow.swift b/Sources/Epoxy/Row/ButtonRow/ButtonRow.swift index 99b227a..25c8dc3 100644 --- a/Sources/Epoxy/Row/ButtonRow/ButtonRow.swift +++ b/Sources/Epoxy/Row/ButtonRow/ButtonRow.swift @@ -185,6 +185,14 @@ extension ButtonRow: ContentConfigurableView { self.title = title self.titleColor = titleColor.color } + + public init( + image: (some ButtonImageContentProviding)? = nil, + title: TextRow.Content? = nil, + titleColor: ConvertibleToColor = UIColor.label + ) { + self.init(image: .init(image), title: title, titleColor: titleColor) + } } case normal(StateContent) @@ -200,6 +208,15 @@ extension ButtonRow: ContentConfigurableView { ) { self = .normal(.init(image: image, title: title, titleColor: titleColor)) } + + /// Conveniently set styles in `.normal` state + public init( + image: (some ButtonImageContentProviding)? = nil, + title: TextRow.Content? = nil, + titleColor: ConvertibleToColor = UIColor.label + ) { + self.init(image: .init(image), title: title, titleColor: titleColor) + } } public func setContent(_ content: Content, animated _: Bool) { diff --git a/Sources/Epoxy/Row/ButtonRow/ButtonRowStateContent.swift b/Sources/Epoxy/Row/ButtonRow/ButtonRowStateContent.swift index e7ede56..576302b 100644 --- a/Sources/Epoxy/Row/ButtonRow/ButtonRowStateContent.swift +++ b/Sources/Epoxy/Row/ButtonRow/ButtonRowStateContent.swift @@ -14,7 +14,7 @@ import RAKCore /// Used to indicate what data corresponds to each UIButton state. /// /// Used internally to simplify the creation of `ButtonRow.Content` in `.normal` state. -protocol ButtonRowStateContent { +public protocol ButtonRowStateContent { associatedtype ImageContent init( @@ -22,5 +22,11 @@ protocol ButtonRowStateContent { title: TextRow.Content?, titleColor: ConvertibleToColor ) + + init( + image: (some ButtonImageContentProviding)?, + title: TextRow.Content?, + titleColor: ConvertibleToColor + ) } #endif