Hi, I'm looking to add a Now Playing view to my new SwiftUI media app but I'm having trouble understanding how to navigate to this view. I've tried with NavigationLink but failed miserably.
If anyone could share a simple example of going from a starting ContentView to the NowPlayingView I'd really appreciate it!
The documentation for this new view is here: https://developer.apple.com/documentation/watchkit/nowplayingview
Thanks, and great WWDC20 so far!
If anyone could share a simple example of going from a starting ContentView to the NowPlayingView I'd really appreciate it!
The documentation for this new view is here: https://developer.apple.com/documentation/watchkit/nowplayingview
Thanks, and great WWDC20 so far!
Hello!
NowPlayingView is available when you import both SwiftUI and WatchKit. It works just like any other SwiftUI view.
You can push to it with a NavigationLink.
Or use a TabView to have it appear alongside other pages.
NowPlayingView is available when you import both SwiftUI and WatchKit. It works just like any other SwiftUI view.
Code Block swift import SwiftUI import WatchKit struct ContentView: View { var body: some View { NowPlayingView() } }
You can push to it with a NavigationLink.
Code Block swift import SwiftUI import WatchKit struct ContentView: View { var body: some View { NavigationView { NavigationLink("Show NowPlayingView", destination: NowPlayingView()) } } }
Or use a TabView to have it appear alongside other pages.
Code Block swift import SwiftUI import WatchKit struct ContentView: View { var body: some View { TabView { NowPlayingView() Text("Page 2") Text("Page 3") } } }