My end goal is to pass the desired array to a function. The problem is the array name depends on the situation. It may be 1 of 30 names.
I have about 30 arrays all named "default_SomeName". Now the previous VC passes the SomeName value. Based on that value, my goal is to pass one of the 30 arrays to a function. Yet, dynamic references are apparently not easy.
I've tried:
var someName: String! //Passed from presenting VC
let desiredArray = "default_" + someName
myFunction(desiredArray)
But I get:
Cannot convert value of type 'String' to expected argument type [String]
Anyone know how to do this?
NSObject. Since you're coding in Swift, however, I would advice against this. Possibly change the approach instead; could the "passing VC" pass a simple integer reference instead? Say anIntbetween1and30that corresponds to the index in an array of string arrays,[[String]](which holds your 30 or soStringarrays).