FoodOption+ActionSheetItems.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // FoodOption+ActionSheetItems.swift
  3. // SheeeeeeeeetExample
  4. //
  5. // Created by Jonas Ullström on 2018-03-16.
  6. // Copyright © 2018 Jonas Ullström. All rights reserved.
  7. //
  8. /*
  9. This file contains food option extensions, that can be used
  10. to create action sheet items in the example app.
  11. */
  12. import Sheeeeeeeeet
  13. extension FoodOption {
  14. func item() -> ActionSheetItem {
  15. return ActionSheetItem(
  16. title: displayName,
  17. value: self,
  18. image: image)
  19. }
  20. func linkItem() -> ActionSheetItem {
  21. return ActionSheetLinkItem(
  22. title: displayName,
  23. value: self,
  24. image: image)
  25. }
  26. func multiSelectItem(isSelected: Bool, group: String) -> ActionSheetItem {
  27. return ActionSheetMultiSelectItem(
  28. title: displayName,
  29. isSelected: isSelected,
  30. group: group,
  31. value: self,
  32. image: image)
  33. }
  34. func singleSelectItem(isSelected: Bool, group: String) -> ActionSheetItem {
  35. let item = ActionSheetSingleSelectItem(
  36. title: displayName,
  37. isSelected: isSelected,
  38. group: group,
  39. value: self,
  40. image: image)
  41. item.tapBehavior = .none
  42. return item
  43. }
  44. }