title: How to download image from server and display with fade in fade out animation in swift?
body: <p>I want to download 10 images from server using alamofire and animate that image in uicollectionview's imageview..in infinite loop just like photos app on window 10..does anyone know??I have googled out but didn't find suitable answer..Some says to use timer..but I think that's not feasible way.. ` </p>
  
  <pre><code>if let employeeImage = employeeModelForDisplay?.employeeImageArray {
       self.animateImage(at: 0 , imageArray: employeeImage)
    }  
   func animateImage(at index: Int, imageArray:[String]) {
          if index &lt; imageArray.count {
              self.badgeImageView.alpha = 0.3
               self.badgeImageView.setImage(link: imageArray[index], imageType: .UserImage)
              UIView.animate(withDuration: 3.0, delay: 0.5, options: [.transitionCrossDissolve], animations: {
                  self.badgeImageView.alpha = 1.0
              }) { (completed) in
                  self.animateImage(at: index + 1, imageArray: imageArray)
              }
          } else {
                 //self.animateImage(at: 0, imageArray: imageArray)           
          }
      }
  </code></pre>
  
  <p>`</p>
  
  <p>I have coded above code in uicollectionviewcell.</p>