I already create an array of image (imagelateral) and I want to implement the next button in the Xcode, but I cannot view the image in the array for the next image in an array
import UIKit class ViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! let images: [UIImage] = [#imageLiteral(resourceName: "tub"),#imageLiteral(resourceName: "ball"),#imageLiteral(resourceName: "apple"),#imageLiteral(resourceName: "igloo"),#imageLiteral(resourceName: "frog")] var i : Int = 0 override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func nextButton(_ sender: UIButton) { if(i+1 > images.count){ i = 0 } //self.imageView.image = [images images[i]:i] imageView.image = UIImage [images images[i]:i] } } it should show the next image in the array example 1st: "tub" when clicking on the button next then show "ball"
imageView.image = images[i]?