我有多个阵列,我想选择一个作为我的主阵列。我希望将主数组描述为字符串。如何使用我的 StationID 字符串和 DirectionID 字符串命名新数组?
let Farbhof1 = ["hi","some","Strings"]
var StationID = "Farbhof"
var DirectionID = "1"
DestViewController.TableViewArray = "\(StationID)\(DirectionID)"
最佳答案
你不能在 Swift 中做到这一点。变量名需要在编译时知道,不能在运行时计算。
关于arrays - 数组名称被描述为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45784498/