I would like to refer to a variable in swift using a combination of a string and another variable. In php, I often did the following:
$i = 1 ${'variable' . $i} = 'test'
Same as
$variable1 = 'test'
How is this done in Swift?
You can not. Unlike PHP, Swift is not an interpreted language. Starting with version 1.1, it does not support almost any dynamism (which is the price for safety and efficiency).