Nav apraksta

FFAlertAction.swift 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // FFAlertAction.swift
  3. // FFAlert
  4. //
  5. // Created by FFIB on 2017/11/16.
  6. // Copyright © 2017年 FFIB. All rights reserved.
  7. //
  8. import UIKit
  9. public class FFAlertAction {
  10. private(set) public var title: String? {
  11. get { return attributedTitle?.string }
  12. set { attributedTitle = NSAttributedString(string: newValue ?? "") }
  13. }
  14. internal(set) public var contentEdgInsets: UIEdgeInsets?
  15. private(set) var handler: ((FFAlertAction) -> Void)?
  16. private(set) public var attributedTitle: NSAttributedString?
  17. private(set) public var backgroundColor: UIColor
  18. init(attributedTitle: NSAttributedString?, contentEdgInsets: UIEdgeInsets? = nil,
  19. backgroundColor: UIColor? = nil, handler: ((FFAlertAction) -> Void)?) {
  20. self.contentEdgInsets = contentEdgInsets
  21. self.backgroundColor = backgroundColor ?? UIColor.white
  22. self.attributedTitle = attributedTitle
  23. self.handler = handler
  24. }
  25. init(title: String?, contentEdgInsets: UIEdgeInsets? = nil,
  26. backgroundColor: UIColor? = nil, handler: ((FFAlertAction) -> Void)?) {
  27. self.contentEdgInsets = contentEdgInsets
  28. self.backgroundColor = backgroundColor ?? UIColor.white
  29. self.title = title
  30. self.handler = handler
  31. }
  32. }