In SwiftUI, I understand that modifiers are used to modify a view. When modifying a view, the modifier returns the view wrapped in _ModifiedContent
.
When embedding my view inside a NavigationView
and assigning a navigation bar title like this: (as seen in Apple's official tutorials)
NavigationView {
Text("Hello, World!")
.navigationBarTitle(Text("My first SwiftUI App"))
}
...why is the modifier for the navigation bar title applied to Text
, not to NavigationView
?
Text
object. – LinusGeffarth