ios - Error assigning a string array in Swift -
i programmatically presenting view controller , changing value of string array string array value stored in sql (gamegametabledata). stuck on error "cannot assign value of type 'string' value of type [string]". not sure why happening. when println(gamegametabledata[index]), string array, swift telling me not string array. appreciated.
var gamegametabledata: [string] = [] override func viewdidload() { super.viewdidload() let index = indexpath.row //error below!!! "cannot assign value of type 'string' value of type [string]" gameviewcontroller.tabledata = gamegametabledata[index] }
println(gamegametabledata)[index] returns:
[cricket3.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png, cricket1.png]
your array declaration seems wrong. below.
var gamegametabledata: [[string]] = [] override func viewdidload() { super.viewdidload() let index = indexpath.row //error below!!! "cannot assign value of type 'string' value of type [string]" gameviewcontroller.tabledata = gamegametabledata[index] }
Comments
Post a Comment