DashboardSessionListTableViewCell.swift 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // DashboardSessionListTableViewCell.swift
  3. // LMS
  4. //
  5. // Created by Suraj Kumar Mandal on 06/01/23.
  6. //
  7. import UIKit
  8. class DashboardSessionListTableViewCell: UITableViewCell {
  9. @IBOutlet var sessionCustomView: UIView!
  10. @IBOutlet var sessionNameLabel: UILabel!
  11. @IBOutlet var dropdownArrowButton: UIButton!
  12. @IBOutlet var hiddenView: UIView!
  13. @IBOutlet var dayDateLabel: UILabel!
  14. @IBOutlet var timeLabel: UILabel!
  15. @IBOutlet var joinButton: UIButton!
  16. override func awakeFromNib() {
  17. super.awakeFromNib()
  18. // Initialization code
  19. }
  20. override func setSelected(_ selected: Bool, animated: Bool) {
  21. super.setSelected(selected, animated: animated)
  22. // Configure the view for the selected state
  23. if isDetailViewHidden, selected {
  24. showDetailView()
  25. } else {
  26. hideDetailView()
  27. }
  28. }
  29. func commonInit() {
  30. selectionStyle = .none
  31. hiddenView.isHidden = true
  32. dropdownArrowButton.setImage(UIImage(systemName: "chevron.right"), for: .normal)
  33. }
  34. }
  35. extension DashboardSessionListTableViewCell {
  36. var isDetailViewHidden: Bool {
  37. return hiddenView.isHidden
  38. }
  39. func showDetailView() {
  40. hiddenView.isHidden = false
  41. dropdownArrowButton.setImage(UIImage(systemName: "chevron.down"), for: .normal)
  42. }
  43. func hideDetailView() {
  44. hiddenView.isHidden = true
  45. dropdownArrowButton.setImage(UIImage(systemName: "chevron.right"), for: .normal)
  46. }
  47. }