referring to a UIImageView programatically via a variable

Hi,

I'm sorry I'm new to this. I defined the following:-
@IBOutlet weak var clientIdCardFrontImage: UIImageView!
@IBOutlet weak var clientIdCardBackImage: UIImageView!

Now I'm trying to take pictures and add them to both UIImageView's, is there a way I can set clientIdCardFrontImage or clientIdCardFrontImage using a variable? What I mean is that once I call imagePickerController, within it I would be doing something like this:- UIImageView(VariableName) = image, where VariableName is going to be set depending on the button clicked on the VC.

Not sure to understand the problem.

The following should do it:

clientIdCardFrontImage.image = theImageYouPicked 
clientIdCardBackImage.image = theImageYouPicked 
Accepted Answer

if I set a variable called viewSelected = clientIdCardFrontImage, is there a way to set viewSelected.image = the ImageYouPicked?

UIImageView is a reference var. So YES, if you have

viewSelected = clientIdCardFrontImage

Then any change on viewSelected does change clientIdCardFrontImage.

referring to a UIImageView programatically via a variable
 
 
Q