From a977dff806d8158c98bf4db5c9c3232cfd50a97f Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 17 Mar 2022 16:39:05 +0100 Subject: [PATCH] UIButton: Add convenient method to modify font. --- Riot/Categories/UIButton.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Riot/Categories/UIButton.swift b/Riot/Categories/UIButton.swift index 6f896bb58..195a2c244 100644 --- a/Riot/Categories/UIButton.swift +++ b/Riot/Categories/UIButton.swift @@ -14,7 +14,7 @@ limitations under the License. */ -import Foundation +import UIKit extension UIButton { @@ -51,4 +51,10 @@ extension UIButton { self.titleLabel?.adjustsFontForContentSizeCategory = newValue } } + + /// Set title font and enable Dynamic Type support + func vc_setTitleFont(_ font: UIFont) { + self.vc_adjustsFontForContentSizeCategory = true + self.titleLabel?.font = font + } }