Skip to content

Commit

Permalink
Silence font registration warning
Browse files Browse the repository at this point in the history
  • Loading branch information
KunJeongPark committed Dec 2, 2024
1 parent 92fd820 commit 60e9d61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/PaymentButtons/PaymentButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -180,7 +181,6 @@ public class PaymentButton: UIButton {

private func configure() {
translatesAutoresizingMaskIntoConstraints = false
UIFont.registerFont()
configureStackView()
configureBackgroundColor()
configurePrefix()
Expand Down
4 changes: 4 additions & 0 deletions Sources/PaymentButtons/PaymentButtonFont.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ extension UIFont {
var errorRef: Unmanaged<CFError>?
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),
Expand Down

0 comments on commit 60e9d61

Please sign in to comment.