Q:

Image Gallery in Swift

I have 20 imageview in scrollview, I am displaying selected image in next ViewController in SubScrollView...
I want to zoom the particular imageView, I don't have idea to get that imageview tag, here is my code
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView?
{
    var i : Int = 0
    var imgView = UIImageView()
   for img in scrollView.subviews
   {
        imgView = view.viewWithTag(Tags.Tag_imgView.rawValue + i)
        imgView = img as UIImageView
        break
   }
    return imgView
}

A:

func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView?
{
   var imgView : UIImageView? = view.viewWithTag(Tags.Tag_imgView.rawValue) as? UIImageView
   for img in scrollView.subviews
   {
        imgView = img as? UIImageView
        break
   }
    return imgView
}

