I've a plist file named as "data.plist" like this:

I have six arrays, and I also have 6 buttons and a text field. I would like to save the string in the text field to the correct array when I press the right button.
On
Make the changes as below.
Structure of the pList: Make the button titles as the keys in the plist.
Logic to save: When a button is pressed, fetch the array of the button's title and save the text from the textField into the array. Update this new array as the value for the key(selectedButton's title)
On
Note: It is necessary to set tag more than 0 because by default all the ui elements have 0 as tag.
There are many approaches, here is one:
livello_0-livello_5.let tag = sender.tag) and get the array withlet array = data["livello_\(tag)"].