I'm trying to create an UIImageView
that when I tap on it, changes it's image, but don't know how to make it clickable.
I have this :
lazy var myImage: UIImageView = {
let image = UIImageView(frame: .zero)
image.translatesAutoresizingMaskIntoConstraints = false
image.heightAnchor.constraint(equalToConstant: 50).isActive = true
image.widthAnchor.constraint(equalToConstant: 50).isActive = true
image.contentMode = .scaleAspectFit
//Here shall I specify the first state? if it's enabled or not? Enabled or not means enabled = Image1, not enabled = Image2
return image
}()
I'm using this image from other class, so perhaps here I do not have to specify anything and only from the method of my presenter set the image as I described :
Enabled = Image1
Disabled = Image2