Post

Replies

Boosts

Views

Activity

SwiftUI iOS 16 RC NavigationBar shadowImage not working
SwiftUI iOS 16 RC NavigationBar shadowImage not working. struct NavigationBarViewModifier: ViewModifier { let backgroundColor: Color let textColor: Color let appearance = UINavigationBar.appearance()     init(backgroundColor: Color, textColor: Color) { self.backgroundColor = backgroundColor self.textColor = textColor         let coloredAppearance = UINavigationBarAppearance()     coloredAppearance.configureWithOpaqueBackground()     coloredAppearance.backgroundColor = UIColor(self.backgroundColor)      coloredAppearance.titleTextAttributes = [.foregroundColor: UIColor(self.backgroundColor)]      coloredAppearance.largeTitleTextAttributes = [ .foregroundColor: UIColor(self.backgroundColor),             .font: UIFont.systemFont(ofSize: 26) ]     coloredAppearance.shadowColor = .clear      coloredAppearance.shadowImage = UIImage()      appearance.standardAppearance = coloredAppearance     appearance.compactAppearance = coloredAppearance      appearance.scrollEdgeAppearance = coloredAppearance appearance.tintColor = UIColor(tintColor)     } func body(content: Content) -> some View { content .toolbarBackground(backgroundColor, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) } } extension View { func navigationBar(backgroundColor: Color, textColor: Color) -> some View {      modifier(NavigationBarViewModifier(backgroundColor: backgroundColor, tintColor: textColor)) } } Based on documentation: https://developer.apple.com/documentation/uikit/uibarappearance/3198008-shadowcolor and https://developer.apple.com/documentation/uikit/uibarappearance/3198009-shadowimage This should be the way to control NavigationBar bottom border visibility and style, unfortunately it is not working. p.s. Hope this will be fixed for actual public release, or else there is even more breaking changes in iOS 16 from what I noticed. Any other observing same/similar issues?
1
1
2.1k
Sep ’22