Bird
0
0

What will be the result of this SwiftUI code when the button is tapped?

medium📝 ui behavior Q5 of 15
iOS Swift - Navigation
What will be the result of this SwiftUI code when the button is tapped?
struct ContentView: View {
  @State private var showFull = false
  var body: some View {
    Button("Open") {
      showFull = true
    }
    .fullScreenCover(isPresented: $showFull) {
      Text("Full Screen")
    }
  }
}
ANothing happens because showFull is not toggled
BA sheet partially covers the screen
CA full screen modal with "Full Screen" text appears
DApp crashes due to missing navigation view
Step-by-Step Solution
Solution:
  1. Step 1: Check the button action

    Button sets showFull to true, triggering the fullScreenCover.

  2. Step 2: Understand fullScreenCover behavior

    It presents a full screen modal with the specified content.

  3. Final Answer:

    A full screen modal with "Full Screen" text appears -> Option C
  4. Quick Check:

    fullScreenCover shows full screen modal [OK]
Quick Trick: fullScreenCover needs isPresented binding true to show [OK]
Common Mistakes:
  • Confusing fullScreenCover with sheet
  • Expecting partial modal instead of full screen
  • Thinking navigation view is required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes