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 {
|
extension Font {
|
||||||
|
|
||||||
var uiFont: UIFont {
|
var uiFont: UIFont? {
|
||||||
switch self {
|
switch self {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
case .largeTitle:
|
case .largeTitle:
|
||||||
|
@ -37,7 +37,7 @@ extension Font {
|
||||||
case .body:
|
case .body:
|
||||||
return UIFont.preferredFont(forTextStyle: .body)
|
return UIFont.preferredFont(forTextStyle: .body)
|
||||||
default:
|
default:
|
||||||
return UIFont.preferredFont(forTextStyle: .body)
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ struct UnmaskSecureField: UIViewRepresentable {
|
||||||
func makeUIView(context: Context) -> UITextField {
|
func makeUIView(context: Context) -> UITextField {
|
||||||
|
|
||||||
let textField = UITextField()
|
let textField = UITextField()
|
||||||
|
textField.font = context.environment.font?.uiFont ?? UIFont.preferredFont(forTextStyle: .body)
|
||||||
|
textField.adjustsFontForContentSizeCategory = true
|
||||||
textField.isSecureTextEntry = true
|
textField.isSecureTextEntry = true
|
||||||
textField.keyboardType = .asciiCapable
|
textField.keyboardType = .asciiCapable
|
||||||
textField.placeholder = title
|
textField.placeholder = title
|
||||||
|
|
|
@ -66,7 +66,7 @@ extension SeriesEpisodeSelector {
|
||||||
v.frame(
|
v.frame(
|
||||||
height: "A\nA\nA".height(
|
height: "A\nA\nA".height(
|
||||||
withConstrainedWidth: 10,
|
withConstrainedWidth: 10,
|
||||||
font: Font.caption.uiFont
|
font: Font.caption.uiFont ?? UIFont.preferredFont(forTextStyle: .body)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue