[ABANDONED] Mastodon iOS client.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
954 B

6 years ago
  1. //
  2. // CellHeightManager.swift
  3. // elpha-ios
  4. //
  5. // Created by Dwayne Harris on 11/10/18.
  6. // Copyright © 2018 Elpha. All rights reserved.
  7. //
  8. import UIKit
  9. class CellHeightManager {
  10. static private var cellHeightsDictionary: NSMutableDictionary = [:]
  11. static func set(statusID: String, height: CGFloat) {
  12. cellHeightsDictionary[statusID] = height
  13. }
  14. static func set(status: StatusMO?, height: CGFloat) {
  15. if let id = status?.id {
  16. set(statusID: id, height: height)
  17. }
  18. }
  19. static func get(statusID: String) -> CGFloat {
  20. if let height = cellHeightsDictionary[statusID] as? CGFloat {
  21. return height
  22. }
  23. return UITableView.automaticDimension
  24. }
  25. static func get(status: StatusMO?) -> CGFloat {
  26. if let id = status?.id {
  27. return get(statusID: id)
  28. }
  29. return UITableView.automaticDimension
  30. }
  31. }