Skip to content

Commit 0525444

Browse files
authored
Silence font registration warning (#308)
1 parent 60f2f95 commit 0525444

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: Sources/PaymentButtons/PaymentButton.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class PaymentButton: UIButton {
4848
self.label = label
4949
self.analyticsService.sendEvent("payment-button:initialized", buttonType: fundingSource.rawValue)
5050
super.init(frame: .zero)
51+
UIFont.registerFont()
5152
customizeAppearance()
5253
self.addTarget(self, action: #selector(onTap), for: .touchUpInside)
5354
}
@@ -180,7 +181,6 @@ public class PaymentButton: UIButton {
180181

181182
private func configure() {
182183
translatesAutoresizingMaskIntoConstraints = false
183-
UIFont.registerFont()
184184
configureStackView()
185185
configureBackgroundColor()
186186
configurePrefix()

Diff for: Sources/PaymentButtons/PaymentButtonFont.swift

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ extension UIFont {
1212
var errorRef: Unmanaged<CFError>?
1313
let frameworkBundle = Bundle(for: PaymentButton.self)
1414

15+
guard UIFont(name: name, size: 10.0) == nil else {
16+
return
17+
}
18+
1519
guard
1620
let pathForResourceString = frameworkBundle.path(forResource: name, ofType: fileExtension),
1721
let fontData = NSData(contentsOfFile: pathForResourceString),

0 commit comments

Comments
 (0)