TableViewOption.swift 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // TableViewOption.swift
  3. // SheeeeeeeeetExample
  4. //
  5. // Created by Daniel Saidi on 2017-11-27.
  6. // Copyright © 2017 Daniel Saidi. All rights reserved.
  7. //
  8. // This enum is only used to populate our example table view.
  9. import UIKit
  10. enum TableViewOption {
  11. case
  12. danger,
  13. collections,
  14. customView,
  15. headerView,
  16. links,
  17. multiSelect,
  18. nonDismissable,
  19. sections,
  20. singleSelect,
  21. standard
  22. var title: String {
  23. switch self {
  24. case .collections: return "Collection items"
  25. case .customView: return "Custom view"
  26. case .danger: return "Destructive Action"
  27. case .headerView: return "Header View"
  28. case .links: return "Link items"
  29. case .multiSelect: return "Multi-select items"
  30. case .nonDismissable: return "Non-dismissable sheets"
  31. case .sections: return "Section items"
  32. case .singleSelect: return "Single-select items"
  33. case .standard: return "Standard items"
  34. }
  35. }
  36. var description: String {
  37. switch self {
  38. case .collections: return "Show a sheet with horizontal collections items."
  39. case .customView: return "Custom view items can embed any view."
  40. case .danger: return "Show a sheet with a destructive action."
  41. case .headerView: return "Show a sheet with a custom header view."
  42. case .links: return "Show a sheet with tappable links."
  43. case .multiSelect: return "Show a sheet where you can select multiple values."
  44. case .nonDismissable: return "Show a sheet that cannot be dismissed by tapping outside the sheet."
  45. case .sections: return "Show a sheet where items are divided in sections."
  46. case .singleSelect: return "Show a sheet where you can select a single value."
  47. case .standard: return "Show a sheet where you can pick a single option."
  48. }
  49. }
  50. var image: UIImage? {
  51. return UIImage(named: imageName)
  52. }
  53. var imageName: String {
  54. switch self {
  55. case .collections: return "ic_view_module"
  56. case .customView: return "ic_custom"
  57. case .danger: return "ic_warning"
  58. case .headerView: return "ic_header_view"
  59. case .links: return "ic_arrow_right"
  60. case .multiSelect: return "ic_checkmarks"
  61. case .sections: return "ic_sections"
  62. case .singleSelect: return "ic_checkmark"
  63. case .standard: return "ic_list"
  64. case .nonDismissable: return "ic_list"
  65. }
  66. }
  67. }