This is how you set a custom title view in the navigation bar in SwiftUI. How would one ever guess that this is how it should be done?
ToolbarItemPlacement.principal
has a small paragraph about its effect. In my opinion, this API is not discoverable at all. (thanks
@sarunw for sharing this!)
Two learnings here: 1) SwiftUI is still cool and powerful, you can do so much with so little code 2) With great flexibility of API, the understandability can take a hit. Because it will behave differently in different contexts and different platforms, SwiftUI has to use overly generic terms such as ‘toolbar’ or ‘principal placement’. So users have to resort to documentation for understanding what it even means. This is a big tradeoff and something to keep in mind when designing our own API.