Turn public var String into Global Array

I am segueing a data from vc1 to vc2 however I can only store 1 data entry in a string so I have to turn it into in array.

    public var loneScore: String?

How do I turn this code into an array?

@timswift Thanks very much for your question!

Your code:

public var loneScore: String?

is a single variable. Assuming “loneScore” is having a value, then I would imagine you would do something like:

var myArray = String
myArray.append(loneScore)

and then pass the object “myArray” as a variable from vc1 to vc2.

I hope this helps!

All the best :slight_smile:

This topic was automatically closed after 166 days. New replies are no longer allowed.