[ad_1]
I run into some problem with a new way to restrict users larger text size choice in accessibility settings (through .dynamicTypeSize = .medium … .xLarge). When i set DynamicTypeSize to medium or xLarge to all views in application (in fact to my general View called startPage(), which contained some other Subview, for example foodIntakePage()) there is still some Views (Alert and ShareSheet) which doesn’t apply my configuration. So when user set .accessibilityExtraLarge in settings my Alerts and ShareSheet views grows to unimaginable sizes. How could i fix this problem? At least set size to xxLarge, not .accessibilityExtraLarge.
import SwiftUI
@main
struct diaApp: App {
@State public var main_font = DynamicTypeSize.xLarge
var body: some Scene {
WindowGroup {
startPage()
.dynamicTypeSize(main_font)
.environment(\.defaultMinListRowHeight, 52.5)
.onAppear(perform: {
// some rules based on UIScreen width and height to change main_font from small to xxLarge
})
}
}
}
My Alert looks like this:
// some button on the startPage() child (starPage -> foodIntakesPage)
.alert(isPresented: $alertMessage) {
Alert(title: Text("Operation status"), message: Text("Please state weight and height before pregnancy"), dismissButton: .default(Text("ОК")))
}
[ad_2]