Skip to content

Commit

Permalink
Make UnmaskSecureField respond to dynamic type (#1424)
Browse files Browse the repository at this point in the history
* Make UnmaskSecureField respond to dynamic type

* use environment font

---------

Co-authored-by: Ethan Pippin <ethanpippin2343@gmail.com>
  • Loading branch information
samglt and LePips authored Feb 15, 2025
1 parent 0235793 commit 6ee2b71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Shared/Extensions/Font.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI

extension Font {

var uiFont: UIFont {
var uiFont: UIFont? {
switch self {
#if os(iOS)
case .largeTitle:
Expand All @@ -37,7 +37,7 @@ extension Font {
case .body:
return UIFont.preferredFont(forTextStyle: .body)
default:
return UIFont.preferredFont(forTextStyle: .body)
return nil
}
}
}
2 changes: 2 additions & 0 deletions Swiftfin/Components/UnmaskSecureField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ struct UnmaskSecureField: UIViewRepresentable {
func makeUIView(context: Context) -> UITextField {

let textField = UITextField()
textField.font = context.environment.font?.uiFont ?? UIFont.preferredFont(forTextStyle: .body)
textField.adjustsFontForContentSizeCategory = true
textField.isSecureTextEntry = true
textField.keyboardType = .asciiCapable
textField.placeholder = title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension SeriesEpisodeSelector {
v.frame(
height: "A\nA\nA".height(
withConstrainedWidth: 10,
font: Font.caption.uiFont
font: Font.caption.uiFont ?? UIFont.preferredFont(forTextStyle: .body)
)
)
}
Expand Down

0 comments on commit 6ee2b71

Please sign in to comment.