[ios] Removing conditionals for unsupported iOS versions

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-08-28 18:22:58 +02:00
committed by x7z4w
parent 6b86fd0d2e
commit 0fccf66b27
25 changed files with 87 additions and 185 deletions

View File

@@ -15,23 +15,15 @@ class UINavigationBarRenderer: UIViewRenderer {
class func render(_ control: UINavigationBar, style: Style) {
super.render(control, style: style)
if let barTintColor = style.barTintColor {
if #available(iOS 13.0, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = barTintColor
control.standardAppearance = appearance
control.scrollEdgeAppearance = appearance
} else {
control.barTintColor = barTintColor
}
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = barTintColor
control.standardAppearance = appearance
control.scrollEdgeAppearance = appearance
}
if let shadowImage = style.shadowImage {
if #available(iOS 13.0, *) {
control.standardAppearance.shadowImage = shadowImage
control.scrollEdgeAppearance!.shadowImage = shadowImage
} else {
control.shadowImage = shadowImage
}
control.standardAppearance.shadowImage = shadowImage
control.scrollEdgeAppearance!.shadowImage = shadowImage
}
var attributes = [NSAttributedString.Key: Any]()
@@ -41,11 +33,7 @@ class UINavigationBarRenderer: UIViewRenderer {
if let fontColor = style.fontColor {
attributes[NSAttributedString.Key.foregroundColor] = fontColor
}
if #available(iOS 13.0, *) {
control.standardAppearance.titleTextAttributes = attributes
control.scrollEdgeAppearance!.titleTextAttributes = attributes
} else {
control.titleTextAttributes = attributes
}
control.standardAppearance.titleTextAttributes = attributes
control.scrollEdgeAppearance!.titleTextAttributes = attributes
}
}