Guest User

Untitled

a guest
Dec 4th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  2. let valueToPass = jobs[indexPath.row].text; jobs[indexPath.row].addedByUser<- ERROR; jobs[indexPath.row].like(); jobs[indexPath.row].dislike()
  3. performSegue(withIdentifier: "toDetails", sender: valueToPass)
  4. }
  5.  
  6. class Job {
  7. var text: String = ""
  8. var addedByUser: String!
  9.  
  10. init(text: String, addedByUser: String) {
  11. self.text = text
  12. self.addedByUser = addedByUser
  13. }
  14.  
  15. init(snapshot: DataSnapshot){
  16. if let value = snapshot.value as? [String : Any] {
  17. text = value["text"] as! String
  18. addedByUser = value["addedByUser"] as? String
  19. }
  20. }
  21.  
  22. func toDictionary() -> [String : Any] {
  23. return [
  24. "text" : text,
  25. "addedByUser" : addedByUser,
  26. ]
  27. }
  28. }
Add Comment
Please, Sign In to add comment