title: Swift - How to animate Images?
body: <p>I'm trying to animate images in particular time- duration. It is working fine in Objective C. However, it is not working for Swift, where is my mistake?</p>
  
  <p><strong>The code for Objective-C is -</strong></p>
  
  <pre><code>-(void)viewDidLoad
  {
     [super viewDidLoad];
     NSMutableArray *imgListArray=[NSMutableArray array];
     for (int i=0; i&lt;=11; i++)
  
     {
         NSString *strImageName=[NSString stringWithFormat:@"c%d.png", i];
         NSLog(@"%@",strImageName);
         UIImage *image=[UIImage imageNamed:strImageName];
         [imgListArray addObject:image];
     }
  
     self.imgView.animationImages = imgListArray;
     self.imgView.animationDuration =1.0f;    
     [self.imgView startAnimating];
     // Do any additional setup after loading the view, typically from a nib
  }
  </code></pre>
  
  <p><strong>The Code for swift is-</strong></p>
  
  <pre><code>override func viewDidLoad()
  {
     super.viewDidLoad()
  
     var imgListArray :NSMutableArray = []
     for countValue in 1...11
     {
        var strImageName : String = "c\(countValue).png"
        var image = UIImage(named:strImageName) // suggested by Anil
        imgListArray.addObject(image)
     }
  
     // Swift code HERE for Objective c
  }
  </code></pre>