diff --git a/Sources/PaymentButtons/PaymentButton.swift b/Sources/PaymentButtons/PaymentButton.swift index b800b8f6..9b0d27c3 100644 --- a/Sources/PaymentButtons/PaymentButton.swift +++ b/Sources/PaymentButtons/PaymentButton.swift @@ -48,6 +48,7 @@ public class PaymentButton: UIButton { self.label = label self.analyticsService.sendEvent("payment-button:initialized", buttonType: fundingSource.rawValue) super.init(frame: .zero) + UIFont.registerFont() customizeAppearance() self.addTarget(self, action: #selector(onTap), for: .touchUpInside) } @@ -180,7 +181,6 @@ public class PaymentButton: UIButton { private func configure() { translatesAutoresizingMaskIntoConstraints = false - UIFont.registerFont() configureStackView() configureBackgroundColor() configurePrefix() diff --git a/Sources/PaymentButtons/PaymentButtonFont.swift b/Sources/PaymentButtons/PaymentButtonFont.swift index 0156bfbb..2337f9be 100644 --- a/Sources/PaymentButtons/PaymentButtonFont.swift +++ b/Sources/PaymentButtons/PaymentButtonFont.swift @@ -12,6 +12,10 @@ extension UIFont { var errorRef: Unmanaged? let frameworkBundle = Bundle(for: PaymentButton.self) + guard UIFont(name: name, size: 10.0) == nil else { + return + } + guard let pathForResourceString = frameworkBundle.path(forResource: name, ofType: fileExtension), let fontData = NSData(contentsOfFile: pathForResourceString),