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.

80 lines
2.8 KiB

6 years ago
  1. // IndicatorInfo.swift
  2. // XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
  3. //
  4. // Copyright (c) 2017 Xmartlabs ( http://xmartlabs.com )
  5. //
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a copy
  8. // of this software and associated documentation files (the "Software"), to deal
  9. // in the Software without restriction, including without limitation the rights
  10. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. // copies of the Software, and to permit persons to whom the Software is
  12. // furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included in
  15. // all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. import Foundation
  25. public struct IndicatorInfo {
  26. public var title: String?
  27. public var image: UIImage?
  28. public var highlightedImage: UIImage?
  29. public var accessibilityLabel: String?
  30. public var userInfo: Any?
  31. public init(title: String?) {
  32. self.title = title
  33. self.accessibilityLabel = title
  34. }
  35. public init(image: UIImage?, highlightedImage: UIImage? = nil, userInfo: Any? = nil) {
  36. self.image = image
  37. self.highlightedImage = highlightedImage
  38. self.userInfo = userInfo
  39. }
  40. public init(title: String?, image: UIImage?, highlightedImage: UIImage? = nil, userInfo: Any? = nil) {
  41. self.title = title
  42. self.accessibilityLabel = title
  43. self.image = image
  44. self.highlightedImage = highlightedImage
  45. self.userInfo = userInfo
  46. }
  47. public init(title: String?, accessibilityLabel:String?, image: UIImage?, highlightedImage: UIImage? = nil, userInfo: Any? = nil) {
  48. self.title = title
  49. self.accessibilityLabel = accessibilityLabel
  50. self.image = image
  51. self.highlightedImage = highlightedImage
  52. self.userInfo = userInfo
  53. }
  54. }
  55. extension IndicatorInfo : ExpressibleByStringLiteral {
  56. public init(stringLiteral value: String) {
  57. title = value
  58. accessibilityLabel = value
  59. }
  60. public init(extendedGraphemeClusterLiteral value: String) {
  61. title = value
  62. accessibilityLabel = value
  63. }
  64. public init(unicodeScalarLiteral value: String) {
  65. title = value
  66. accessibilityLabel = value
  67. }
  68. }