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.

47 lines
1.1 KiB

6 years ago
  1. //
  2. // HomeCellModel.swift
  3. // GMERemittance
  4. //
  5. // Created by FMI-12 on 3/19/18.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. import UIKit
  10. class HomeCellModel {
  11. let totalItem: CGFloat = 2
  12. let column: CGFloat = 2
  13. let minLineSpacing: CGFloat = 5.0
  14. let minItemSpacing: CGFloat = 5.0
  15. let offset: CGFloat = 5.0 // TODO: for each side, define its offset
  16. let numCollectionItem: CGFloat = 4.0
  17. var clicked: Bool = false
  18. func getItemWidth(boundWidth: CGFloat) -> CGFloat {
  19. // totalCellWidth = (collectionview width or tableview width) - (left offset + right offset) - (total space x space width)
  20. let totalWidth = boundWidth - (offset + offset) - ((column - 1) * minItemSpacing)
  21. return totalWidth / column
  22. }
  23. func getCountforCollection() -> CGFloat {
  24. return numCollectionItem
  25. }
  26. func getClicked() -> Bool {
  27. return clicked
  28. }
  29. func setClicked(click: Bool) {
  30. clicked = click
  31. }
  32. }