From the course: Apple watchOS 7 App Development Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Presenting views - watchOS Tutorial
From the course: Apple watchOS 7 App Development Essential Training
Presenting views
- [Instructor] You've looked at moving between views through navigation. There's also modal views, which are called sheets in SwiftUI. Let's change around the navigation view to present a sheet. So I'm going to close up the app that we have already, and we're going to go to detail view, which is right here. I'm going to hit command zero, give us a little more space, and then I want to make another button. I'm going to do it down here just past the navigation link. I don't need this navigation link anymore 'cause it's going to replace it. So I'm going to first of all comment that out, and then put my button in, and I'm going to use the same label here. So I'll copy it, paste it in there. And so everything I need to do here is in the action. And my action is actually very simple. I'm just going to use a flag, which I'm going to call isRatingPresented. And if it's false, I will hide my sheet. If it's true, I will show my…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.