I had a list of variable name like this (BankHelper.swift):
static var va_1_atm =
\"\"\"
- Silahkan kunjungi ATM terdekat
Why 3 different variables
static var va_1_atm
static var va_2_atm
static var va_3_atm
when we can use array
here and use the value of ReservationModel.bankAccount
to get to the index
of the array
to get appropriate text.
However if you want to do it in this way
What can be done is, store all your variables in an array. The indexes for the variables you store in that array will correspond to the index values you're trying to include in the variable name.
var atms = [typeOfAtmVarHere]()
Then keep on adding in this array whenever you have any of static var va_1_atm
matching the index based on va_1_atm in var.
Lastly iterate through it and get it from the array
on basis of ReservationModel.bankAccount
as index