Apple App Development with Swift Certified User - App-Development-with-Swift-Certified-User Exam Practice Test

Complete the code that will add the BlueView to the NavigationStack and present the RedView modally.

|Complete the code by typing in the boxes.
Correct Answer:
NavigationLink, .sheet
Explanation:
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.
Review the code.

When entered into the TextField, which number will display a blue canvas on the SecondView?
Correct Answer: A
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).
When you press ' Show Button ' on your app. a modal View appears.
Complete the code by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct answer.
Correct Answer:

Explanation:

This question belongs to View Building with SwiftUI , specifically the domain on creating a multi-view app with navigation stacks, links, and sheets .
To present a modal view in SwiftUI when a Boolean state changes, the correct modifier is .sheet . The matching sheet API for a Boolean binding is:
sheet(isPresented: $showInfo) {
// modal content
}
So the first blank must be .sheet , and the second blank must be (isPresented: .
The logic works like this:
* @State stores the local Boolean that controls presentation.
* Pressing the button calls showInfo.toggle(), changing the value from false to true.
* When that Boolean becomes true, the .sheet(isPresented:) modifier presents the modal view.
* When the modal is dismissed, SwiftUI updates the Boolean back as needed.
There is also a typing issue in the screenshot: the state variable appears as ShowInfo, while the button and binding use showInfo. Swift is case-sensitive, so those names must match. The corrected code should use the same identifier consistently, such as:
@State var showInfo = false
Therefore, the correct dropdown selections are:
sheet
(isPresented:
In SwiftUI, how can you extract a subview from a main view to make the code more modular?
Correct Answer: C
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).
Review the code snippet.

Which statement completes the code snippet so that:
* The lastReleaseDate remains the same when nextApplePhone.releaseDate is nil.
* The lastReleaseDate updates to the nextApplePhone.releaseDate when nextApplePhone.releaseDate is NOT nil.
Correct Answer: C
Explanation: Only visible for ExamsLabs members. You can sign-up / login (it's free).