Search code examples
swiftblockuiviewanimation

Showing error while using 'animateWithDuration'


I am new in Swift so could not figure out the problem , Please guide me

using It like

 UIView.animateWithDuration(duration, delay: 0.0, options: option, animations: { () -> Void in
        self.btnCallButton.hidden = true
       }, completion: nil)

and it showing following error

Cannot invoke 'animateWithDuration' with an argument list of type '(Float, delay: FloatLiteralConvertible, options: UIViewAnimationOptions, animations: () -> Void, completion: NilLiteralConvertible)'

please give the required suggestion and also provide some links which describe the blocks in swift


Solution

  • Like this:

    UIView.animate(withDuration: 0.35) {
      // animate things
      return
    }