I'm trying out the new NavigationView in watchOS 7 and having some issues with the navigation bar not showing up in child views.
Example
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(
destination: DestinationView(),
label: {
Text("Destination")
})
.navigationTitle("Root")
}
}
}
struct DestinationView: View {
var body: some View {
NavigationView {
Text("I'm here!")
.navigationTitle("Destination")
}
}
}
Test setup
macOS 11.0 Beta 5
watchOS 7.0 Beta 6
Xcode 12.0 Beta 6
When running the app in the simulator or on the watch, the root view correctly displays the navigation bar, while the destination view does not.
Confusingly, the Xcode live preview does the opposite: The root view is missing the navigation bar, but the destination view is showing both the title and back button correctly.
The only mode in which the navigation bar is visible in both views is if I from Xcode select Preview on Device.
I'm new to SwiftUI and though I'm leaning toward this being a bug with the beta, I thought I'd check here to make sure I'm not just doing it wrong.
Post
Replies
Boosts
Views
Activity
I'm making my first watch app and have run into a bit of a weird problem.
While writing the app, I'm using it on my Apple Watch Series 6 on a regular basis. I'm installing builds on the watch by simply clicking Run in Xcode with my watch as the target device.
This works well for the most part, but lately I've run into a strange issue: While new builds install seemingly correctly when I click Run in Xcode, they do not persist for very long. Maybe for the next few hours. If I open the app on the Watch the next day, the app has reverted to a particular build I made several weeks ago. To get the newest build back on the watch I have to build and run from Xcode again.
This is the second time over the past few months where the watch has gotten stuck on a build like this. Last time I fiddled with the build and version numbers until it got unstuck. This time I haven't found a way of resolving it.
Things I have tried:
Delete the app from the watch and re-install from Xcode
The same as above, but reboot the device after deleting the app
**** away Xcode's derived data
I'm running the latest stable versions of Xcode and watchOS.
Has anyone else run into this? The app is written in SwiftUI 2 if that matters at all.