Bird
0
0

Which of the following is the correct syntax to create a fade transition using CATransition in Swift?

easy📝 Syntax Q3 of 15
iOS Swift - Animations
Which of the following is the correct syntax to create a fade transition using CATransition in Swift?
Alet transition = CATransition(); transition.type = .fade
Blet transition = CATransition(); transition.style = "fade"
Clet transition = CATransition(); transition.animationType = .fade
Dlet transition = CATransition(); transition.effect = "fade"
Step-by-Step Solution
Solution:
  1. Step 1: Recall CATransition syntax

    CATransition's type property is set using .fade for fade effect.
  2. Step 2: Check each option's correctness

    Only let transition = CATransition(); transition.type = .fade uses correct property 'type' and enum '.fade'. Others use invalid properties.
  3. Final Answer:

    let transition = CATransition(); transition.type = .fade -> Option A
  4. Quick Check:

    Correct property = type, correct value = .fade [OK]
Quick Trick: Use .type = .fade for fade transitions [OK]
Common Mistakes:
  • Using wrong property names
  • Assigning string instead of enum
  • Confusing effect with type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes