Skip to content

Instantly share code, notes, and snippets.

@pogramos
Last active October 19, 2020 13:31
Show Gist options
  • Select an option

  • Save pogramos/9e3bdb95aadccd233c55cd1474ecee23 to your computer and use it in GitHub Desktop.

Select an option

Save pogramos/9e3bdb95aadccd233c55cd1474ecee23 to your computer and use it in GitHub Desktop.
Custom Button - Button Configuration
enum ButtonStyle {
case primary
case secondary
var font: UIFont {
switch self {
case .primary:
return .systemFont(ofSize: 13, weight: .bold)
case .secondary:
return .systemFont(ofSize: 13)
}
}
var enabledTextColor: UIColor {
switch self {
case .primary:
return .white
case .secondary:
return .systemBlue
}
}
var enabledBackgroundColor: UIColor {
switch self {
case .primary:
return .systemBlue
case .secondary:
return .clear
}
}
var disabledBackgroundColor: UIColor {
switch self {
case .primary:
return .systemGray4
case .secondary:
return .clear
}
}
var disabledTextColor: UIColor {
switch self {
case .primary:
return .systemGray
case .secondary:
return .systemGray
}
}
var borderWidth: CGFloat {
switch self {
case .primary:
return 0
case .secondary:
return 1
}
}
var borderColor: UIColor {
switch self {
case .primary:
return .clear
case .secondary:
return .systemBlue
}
}
var cornerRadius: CGFloat {
return 12
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment