Bird
0
0

What will be the visible effect of this code snippet?

medium📝 Predict Output Q13 of 15
iOS Swift - Animations
What will be the visible effect of this code snippet?
UIView.animate(withDuration: 1.0, delay: 0, options: [.curveEaseInOut]) {
  view.frame.origin.x += 100
}
AThe view moves 100 points to the right, starting fast and slowing down.
BThe view moves 100 points to the right at a constant speed.
CThe view jumps instantly 100 points to the right without animation.
DThe view moves 100 points to the right, starting slow, speeding up, then slowing down.
Step-by-Step Solution
Solution:
  1. Step 1: Understand .curveEaseInOut timing

    .curveEaseInOut means the animation starts slowly, speeds up in the middle, then slows down at the end.
  2. Step 2: Analyze the animation effect

    The view's x position increases by 100 points over 1 second with ease-in-out timing, so it moves smoothly with acceleration and deceleration.
  3. Final Answer:

    The view moves 100 points to the right, starting slow, speeding up, then slowing down. -> Option D
  4. Quick Check:

    .curveEaseInOut = slow start & end, fast middle [OK]
Quick Trick: EaseInOut means slow start and end, fast middle [OK]
Common Mistakes:
  • Thinking it moves at constant speed
  • Confusing easeInOut with easeIn or easeOut
  • Expecting instant jump without animation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes