swiftui – Not able change color of back button in iOS 16

0
144


simulator output

I am not able to change default accent color of back button in NavigationStack(iOS 16)

Solutions that I’ve tried –

  1. Adding tint color NavigationStack
import SwiftUI

struct ReceiveMoneyView: View {
    var body: some View {
        NavigationStack {
            Text("ReceiveMoneyView")
        }
        .accentColor(Color.theme.accent)
    }
}

struct ReceiveMoneyView_Previews: PreviewProvider {
    static var previews: some View {
        ReceiveMoneyView()
            .preferredColorScheme(.dark)
    }
}

  1. Setting tint color of All navbar (this used to work in prev ios versions)
import SwiftUI

@main
struct FrontendApp: App {
    init() {
        UINavigationBar.appearance().tintColor = UIColor(Color.theme.accent)
    }
    var body: some Scene {
        LoginView()
    }
}