0

I have a design like below flow. I need to set delay between 5th and 6th steps for 0.3second. I tried below options but couldn't get any result.

My question is, how can I achieve this?

Note: 13seconds for see the animation.

Flow

  1. Task Handler // for webService request
  2. Closure Handler // for trigger ViewController
  3. DispatchQueue.main.async // for Update UI
  4. First Animation
  5. Second Animation
  6. Navigation to next screen

Test 1

Timer.scheduledTimer(withTimeInterval: 13, repeats: false, block: {})

Test 2

UIView.animate(withDuration: 13, animations: {
    // nothing should be happened
    self.ivSuccessMark.alpha = 0.99 // for dummy animation diff
}, completion: { (completion) in
    // navigation
})

Test 3

perform(_:with:afterDelay:)

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Utku
  • 145
  • 1
  • 13

2 Answers2

1

Try this one I hope it help you(Up to 4 seconds Stop all Action in view)

DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(4), execute: {
    // Put your code which should be executed with a delay here
})
0

Try this one

UIView.animate(withDuration: 0.5, delay: 0.3, options: [.repeat, .curveEaseOut, .autoreverse], animations: {
    // animation stuff      
}, completion: { _ in
    // do stuff once animation is complete
})
  • Tried below code but doesn't work. UIView.animate(withDuration: 0.3, delay: 13, options: UIViewAnimationOptions.curveLinear, animations: { }, completion: { (completion) in }) – Utku Jun 21 '18 at 09:48