Skip to content

Commit

Permalink
Silence font registration warning (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
KunJeongPark authored Dec 2, 2024
1 parent 60f2f95 commit 0525444
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
@@ -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()
4 changes: 4 additions & 0 deletions Sources/PaymentButtons/PaymentButtonFont.swift
Original file line number Diff line number Diff line change
@@ -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),

0 comments on commit 0525444

Please sign in to comment.