In the image above id like to change -02:49
to a color such as Color.blue
I've tried:
struct ContentView: View {
var body: some View {
PlayerView().accentColor(Color.blue)
}
}
and I've also tried adding it in the actual PlayerView as follows:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”))
.accentColor(.blue)
}
}
I've also tried:
struct PlayerView: View {
var body: some View {
VStack{
....
}.navigationBarTitle(Text(“-2:49”).foregroundColor(.blue))
}
}
To change a navigation bar color in SwiftUI, you apply toolbarBackground modifier to the content view of NavigationStack . NavigationView is deprecated in iOS 16. toolbarBackground accepts two parameters. ShapeStyle : The style to display as the background of the bar.
titleview in UIKit. To customize a navigation bar title view in SwiftUI, we simply set ToolbarItem of placement type . principal to a new . toolbar modifier.
To show a Navigation Bar using SwiftUI, we should use the NavigationView component that is responsible for this purpose. It requires that we provide the Content that is a View type. The Content can be anything from a text field to scrollable content. In short, it can be any SwiftUI view.
With WatchOS7/Xcode12 using the SwiftUI App Lifecycle you won't have a storyboard.
There is now an AccentColor within the App assets which is how you can change it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With