This question falls under View Building with SwiftUI , specifically the domain covering multi-view apps with navigation stacks, links, and sheets . The first blank must be NavigationLink because SwiftUI uses a navigation link inside a NavigationStack to push or present a destination view as part of the navigation hierarchy. Apple’s documentation states that people tap or click a NavigationLink to present a view inside a NavigationStack or NavigationSplitView. That matches the first code section, where tapping "Show Blue View" should navigate to BlueView().
The second blank must be .sheet because the code uses isPresented: $showRedView, which is the standard SwiftUI sheet modifier for modal presentation controlled by a Boolean binding. Apple documents sheet(isPresented:onDismiss:content:) as the modifier to use when you want to present a modal view when a Boolean becomes true. Since the button toggles showRedView, SwiftUI presents RedView() modally as a sheet.
So the completed structure is effectively:
NavigationLink( " Show Blue View " ) {
BlueView()
}
sheet(isPresented: $showRedView) {
RedView()
}
This directly aligns with SwiftUI navigation and modal presentation patterns in the App Development with Swift objective domains.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit