By default the navigation title in the navigation view can’t be edited.
You can have this code to setup title:
NavigationView {
VStack {
Text(“Hello world!”)
}
.navigationTitle(“Title”)
}
But .navigationTitle accepts only string as parameter.
However, there is way to edit this text. It won’t work in all cases you might need it but at least in some.
You can use .toolbar view modifier and set placement as .principal:
NavigationView {
VStack {
Text(“Hello world!”)
}
.toolbar {
ToolbarItem(placement: .principal) {
Text(“Red title”)
.foregroundColor(.red)
}
}
}
Thanks to that you can play a little bit with title but it isn’t scrollable.