ios - Displaying The Date with NSDateFormatter -


what i'm trying display date , time similar see within facebook. however, xcode displaying error:

use of unresolved identifier 'creator'.

here's function i'm having trouble with:

override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("postcell", forindexpath: indexpath) as! postcell     cell.post = posts[indexpath.row]     cell.index = indexpath.row      var dataformatter:nsdateformatter = nsdateformatter()     dataformatter.dateformat = "yyyy-mm-dd hh:mm"     cell.timestamplabel.text = dataformatter.stringfromdate(creator.createdat)      return cell } 

an error wasn't displaying until typed out second last line of code. specifically, know error being caused creator, believe timestamplabel culprit because didn't change color person following along in video. i'm utilizing parse store users data , creator 1 of categories have in parse. hoping point me in right direction i've spent way long on that's simple.

the culprit not timestamplabel. culprit creator object.

use of unresolved identifier 'creator'

means object not defined in current scope. in case creator object. creator should defined.

assuming youtube video , code posts object array of parse objects(pfobject)

  override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {      let cell = tableview.dequeuereusablecellwithidentifier("postcell", forindexpath: indexpath) as! postcell     cell.post = posts[indexpath.row]     cell.index = indexpath.row     //---------------------------add this-------------------     var creator = cell.post pfobject     //------------------------------------------------------      var dataformatter:nsdateformatter = nsdateformatter()     dataformatter.dateformat = "yyyy-mm-dd hh:mm"     cell.timestamplabel.text = dataformatter.stringfromdate(creator.createdat)       return cell } 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -