Apple App Development with Swift Certified User - App-Development-with-Swift-Certified-User Exam Practice Test
For each statement about Navigation in SwiftUI. select True or False.


Correct Answer:

Explanation:
* You can treat a NavigationLink like a button, and run some Swift code when it is pressed. - False
* NavigationSplitView can be used to do navigation differently on different device sizes. - True
* You can put a header on your present View in a NavigationStack using .navigationTitle. - True
* If you have a NavigationLink that goes to another View with a NavigationLink, you need to declare a NavigationStack at each level. - False This question belongs to View Building with SwiftUI , specifically the objective on creating a multi-view app with navigation stacks, links, and sheets . Statement 1 is False because NavigationLink is primarily a navigation control that pushes or presents a destination in a navigation container; Apple documents it as creating a navigation link that presents a destination, not as a general-purpose action control like Button.
Statement 2 is True because NavigationSplitView is designed for adaptive navigation and can present navigation in different ways depending on platform and available space. Apple documents NavigationSplitView as a container for navigation across multiple columns, and this adaptive behavior is exactly why it is used differently across device sizes.
Statement 3 is True because .navigationTitle(...) sets the navigation title for a view shown inside a navigation container. Apple explicitly describes a view's navigation title as something used to visually display the current navigation state of an interface.
Statement 4 is False because you do not need a separate NavigationStack at every level. Apple describes NavigationStack as the container that manages a stack of views, and NavigationLink pushes additional destinations onto that stack. Nested destinations can keep navigating within the same stack.
You have created a view which includes some formatted text:

You decide to extract this formatted text into a subview so that you can reuse the formatting for other texts.
You highlight the Text and choose Extract subview.
You refactor ExtractedView to BigGreenTextView.
You add the line let text: String to the extracted view above the body.
You replace " That ' s all folks " with a reference to text
How should you call this extracted View from the original View?

You decide to extract this formatted text into a subview so that you can reuse the formatting for other texts.
You highlight the Text and choose Extract subview.
You refactor ExtractedView to BigGreenTextView.
You add the line let text: String to the extracted view above the body.
You replace " That ' s all folks " with a reference to text
How should you call this extracted View from the original View?
Correct Answer: C
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Review the code.
var capitalCities = [ " USA " : " Washington D.C. " , " Spain " : " Madrid " , " Peru " : " Lima " ] Which two statements add the capital city of " Italy " to the dictionary? (Choose 2.)
var capitalCities = [ " USA " : " Washington D.C. " , " Spain " : " Madrid " , " Peru " : " Lima " ] Which two statements add the capital city of " Italy " to the dictionary? (Choose 2.)
Correct Answer: B,C
Vote an answer
Review the code.
struct ContentView: View {
let fruits = [ " Apple " , " Banana " , " Kiwi " ]
var body: some View {
List(fruits, id: \.self) { fruit in
Text(fruit)
.font(.headline)
.padding()
}
}
}
Which of the following statements is true about the code?
struct ContentView: View {
let fruits = [ " Apple " , " Banana " , " Kiwi " ]
var body: some View {
List(fruits, id: \.self) { fruit in
Text(fruit)
.font(.headline)
.padding()
}
}
}
Which of the following statements is true about the code?
Correct Answer: C
Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Complete the code that will add the BlueView to the NavigationStack and present the RedView modally.

|Complete the code by typing in the boxes.

|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.

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.
