Make UnmaskSecureField respond to dynamic type (#1424)
* Make UnmaskSecureField respond to dynamic type * use environment font --------- Co-authored-by: Ethan Pippin <ethanpippin2343@gmail.com>
This commit is contained in:
parent
0235793bc6
commit
6ee2b71cab
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
|
||||
extension Font {
|
||||
|
||||
var uiFont: UIFont {
|
||||
var uiFont: UIFont? {
|
||||
switch self {
|
||||
#if os(iOS)
|
||||
case .largeTitle:
|
||||
|
@ -37,7 +37,7 @@ extension Font {
|
|||
case .body:
|
||||
return UIFont.preferredFont(forTextStyle: .body)
|
||||
default:
|
||||
return UIFont.preferredFont(forTextStyle: .body)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue