ios - Cells do not show up in my tableview -


i new swift / xcode. stuck, have created struct sectionname, sectionobject, , section image. believe code correct, when run simulator not populate tableview cells have created. cell type basic, , identifier cell.

there no errors besides yellow triangle says "initialization of immutable value 'objectarray' never used; consider replacing assignment '_' or removing it" around object array variable

when run code, doesn't call of tableview func 's .

i have removed of content in objectarray ,and replaced them "xxxxx" make easier.

i must missing , here code :

class "classname" : uiviewcontroller, uitableviewdelegate,     uitableviewdatasource {  struct objects {     var sectionname : string!     var sectionobjects : [string]!     var sectionimage : [uiimage]!     }  var objectarray = [objects]()  @iboutlet weak var "myname"tableview: uitableview!  override func viewdidload() {     super.viewdidload()    let objectarray = [objects(sectionname: "drinks", sectionobjects: ["xxxxxx"], sectionimage:  [uiimage(named: "coollime.jpg")!,    ]),    objects(sectionname: "fresh brewed coffee drinks", sectionobjects: ["blonde roast",   "caffè misto",   "xxxxx"], sectionimage: [uiimage(named: "br.jpg")!,   uiimage(named: "cf.jpg")!,   uiimage(named: "scbcm.jpg")!]),    objects(sectionname: "espresso beverages", sectionobjects: ["caffè americano",   "caffè latte",   "xxxxxxx", sectionimage: [uiimage(named: "ca1.jpg")!,   "xxxxxxx"   ] }  func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {   let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) uitableviewcell   cell.textlabel?.text = self.objectarray[indexpath.section].sectionobjects[indexpath.row]    let imagename = objectarray[indexpath.section].sectionimage[indexpath.row]    cell.imageview!.image = imagename       return cell }  func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int{   return objectarray[section].sectionobjects.count }  func numberofsectionsintableview(tableview: uitableview) -> int {   return objectarray.count }  func tableview(tableview: uitableview, titleforheaderinsection section: int) -> string? {   return objectarray[section].sectionname }  override func didreceivememorywarning() {   super.didreceivememorywarning() } } 


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -