Last active
October 19, 2020 13:29
-
-
Save pogramos/5111b72612e79fb2dcc4fed10b0e20d0 to your computer and use it in GitHub Desktop.
CustomButton - Methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private func apply(style: ButtonStyle) { | |
| titleLabel?.font = style.font | |
| setTitleColor(style.enabledTextColor, for: .normal) | |
| setTitleColor(style.disabledTextColor, for: .disabled) | |
| layer.borderWidth = style.borderWidth | |
| layer.borderColor = style.borderColor.cgColor | |
| layer.cornerRadius = style.cornerRadius | |
| updateBackground() | |
| } | |
| private func updateBackground() { | |
| if isEnabled { | |
| backgroundColor = style.enabledBackgroundColor | |
| } else { | |
| backgroundColor = style.disabledBackgroundColor | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment