Skip to content

Instantly share code, notes, and snippets.

@ipedro
Created November 3, 2021 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipedro/a28f39d954553c8ab69c2594d977e225 to your computer and use it in GitHub Desktop.
Save ipedro/a28f39d954553c8ab69c2594d977e225 to your computer and use it in GitHub Desktop.
HxDButton interface proposal
protocol HxDButtonProtocol {
init(title: String?, image: UIImage?, configuration: HxDButtonConfigurationProtocol, actionHandler: (() -> Void)?)
init(title: String?, image: UIImage?, actionHandler: (() -> Void)?)
var image: UIImage? { get }
var imageView: UIImageView? { get }
var title: String? { get }
var titleLabel: UILabel? { get }
var contentAxis: NSLayoutConstraint.Axis { get set }
var contentSpacing: CGFloat { get set }
var actionHandler: () -> Void { get set }
func setTitle(_ title: String?, for: UIControl.State)
func setImage(_ title: UIImage?, for: UIControl.State)
func setOutline(_ width: OutlineWidth?, color: HxDColor?, for: UIControl.State)
func setCornerRadiusStyle(_ style: CornerRadiusStyle?, maskedCorners: CACornerMask, for: UIControl.State)
func setContentColor(_ color: HxDColor?, for state: UIControl.State)
func setBackgroundColor(_ color: HxDColor?, for state: UIControl.State)
func outlineColor(for: UIControl.State) -> HxDColor?
func outlineWidth(for: UIControl.State) -> OutlineWidth?
func cornerRadiusStyle(maskedCorners: CACornerMask, for: UIControl.State) -> CornerRadiusStyle?
func contentColor(for state: UIControl.State) -> HxDColor?
func backgroundColor(for state: UIControl.State) -> HxDColor?
var configuration: HxDButtonConfigurationProtocol { get set }
}
protocol HxDButtonConfigurationProtocol {
var isLoading: Bool { get set }
var size: SizeProtocol { get set }
var state: UIControl.State { get set }
var type: ButtonTypeProtocol { get set }
var style: ButtonStyleProtocol { get set }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment