ActionSheetSelectItemAppearance.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // ActionSheetSelectItemAppearance.swift
  3. // Sheeeeeeeeet
  4. //
  5. // Created by Daniel Saidi on 2017-11-24.
  6. // Copyright © 2017 Daniel Saidi. All rights reserved.
  7. //
  8. /*
  9. This appearance inherits the base appearance and applies to
  10. select items. The additional properties are applied when an
  11. item is selected:
  12. * `selectedIcon` is displayed rightmost, e.g. a checkmark
  13. * `selectedTextColor` is applied to the text (duh)
  14. * `selectedTintColor` is applied to both icons if they are rendered as template images
  15. * `selectedIconTintColor` can override `selectedTintColor` for the selected icon
  16. */
  17. import UIKit
  18. open class ActionSheetSelectItemAppearance: ActionSheetItemAppearance {
  19. // MARK: - Initialization
  20. public override init() {
  21. super.init()
  22. }
  23. public override init(copy: ActionSheetItemAppearance) {
  24. super.init(copy: copy)
  25. selectedTextColor = copy.textColor
  26. selectedTintColor = copy.tintColor
  27. guard let copy = copy as? ActionSheetSelectItemAppearance else { return }
  28. selectedIcon = copy.selectedIcon
  29. selectedTextColor = copy.selectedTextColor ?? selectedTextColor
  30. selectedTintColor = copy.selectedTintColor ?? selectedTintColor
  31. selectedIconTintColor = copy.selectedIconTintColor ?? selectedTintColor
  32. }
  33. // MARK: - Properties
  34. public var selectedIcon: UIImage?
  35. public var selectedIconTintColor: UIColor?
  36. public var selectedTextColor: UIColor?
  37. public var selectedTintColor: UIColor?
  38. }