Looking at the Challenge description:
Build a UI with a List and a Button below it.
Declare a property that contains an array of 5 strings. These can be any 5 words you want.
Each time the button is tapped, choose a random word from the array and put it in the list.
The number of items in the list should grow as you tap the button.
You need an array to store the 5 words that are the source. Let’s call that one
You need a List which requires a separate array to display the items that are added to that separate array when the button is tapped. Lets call that array
You may recall in a previous episode that Chris Ching talked about generating random numbers in a specific range.
In this case you need to generate a random number from between 0 and the number of items in the source array minus 1. Remember that the first index in an array is 0. The last index in an array is numbered 1 less that the total number of elements. So if you have 5 elements in an array the first one is 0 and the last one is 4.
So you would generate a random number from between 0 and
animals.count - 1
When you have that random number, you use that as in index value on the array of animals and append that element to the array of
Is that enough information to help you out rather than me giving you the answer?