This is just a quick blog post about my recent experiences with SwiftUI 2, the new version of SwiftUI for iOS 14 and related operating systems. This is going to be both small and highly technical, so I apologize in advance.
While making a simple app for watchOS (the timepiece of this post!), I noticed that the chevron to go back between views (the navigation!) would never appear.
For comparision, this is the expected result in an app like Settings:
As it turns out… if you embed a
NavigationView inside another
NavigationView, that chevron will never appear. A
NavigationView is automatically created for you when you create a new watchOS app, so that’s something to keep in mind. Removing the outer
NavigationView will fix the issue.
Aaand, that’s everything. Just a quick note so no one else has to waste an Apple technical request like I did!
Oh, I almost forgot: Make sure to check out SeedTruck, the open-source SwiftUI 2 project where I had this problem. It’s a project with a single code base that works on iOS, macOS, tvOS and watchOS!