FBSDKGraphRequest: How to cast Facebook work experience data in Swift to UILabel -
i able retrieve , display name, birthday, email, , picture.
i able retrieve work data prints fine.
my question how able display specific employer name , position name in label.
func showuserdata() { let graphrequest : fbsdkgraphrequest = fbsdkgraphrequest(graphpath: "me", parameters: ["fields" : "id, first_name, birthday, work, email, picture.type(large)"]) graphrequest.startwithcompletionhandler({ (connection, result, error) -> void in if ((error) != nil) { // process error print("error: \(error)") } else { // request firstname let username : nsstring = result.valueforkey("first_name") as! nsstring // request birthdate let userbirthday : nsstring = result.valueforkey("birthday") as! nsstring // request work info let userwork : nsarray = result.valueforkey("work") as! nsarray self.worklabel.text = "\(userwork)" print(userwork) // convert string nsdate let dateformatter = nsdateformatter() dateformatter.dateformat = "mm-dd-yyy" let date = dateformatter.datefromstring(userbirthday string) let birthday: nsdate = date! var now: nsdate = nsdate() var agecomponents: nsdatecomponents = nscalendar.currentcalendar().components(.year, fromdate: birthday, todate: now, options: []) var age: int = agecomponents.year // request profile picture let strpictureurl: string = (result.objectforkey("picture")?.objectforkey("data")?.objectforkey("url") as? string)! self.namelabel.text = "\(username), \(age)" self.image.image = uiimage(data: nsdata(contentsofurl: nsurl(string: strpictureurl)!)!) } }) }