Changing (just) the font size of a button
45 sec read
We have in the app a generic button, styled to look the same across the app - from shadows to title. Some places require a smaller font though, and I didn't really want to duplicate code, so something had to be done. Here's my little trick for it:
// titleLabel is nil only for system buttons, as per documentation
button.titleLabel!.font = UIFont(
name: button.titleLabel!.font.fontName,
size: button.titleLabel!.font.pointSize - 2
)