[Swift-user] Question about arrays of struct data

Lorenzo Pesce lpesce at uchicago.edu
Wed Mar 20 13:12:42 CDT 2013


I need to create a struct that will become more complex with time, let's say this is what it looks like now:

type Sample{
    string name;
    string dir;
}

Then I need an array of such structs

Sample [] mySamples;

However, I would like to create the struct on the fly into the swift script itself. For arrays I would typically do
string FileID [] = ["C440.TCGA-BR-7196-10A-01D-2053-08.2","C440.TCGA-CG-4477-10A-01D-1158-08.5"];

How can I do that for a struct? (I don't want to use readData, but I can if there is no other choice)

Thanks,

Lorenzo




More information about the Swift-user mailing list