Deprecated.swift 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // Deprecated.swift
  3. // QuickTableViewController
  4. //
  5. // Created by bcylin on 01/01/2019.
  6. // Copyright © 2019 bcylin.
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining a copy
  9. // of this software and associated documentation files (the "Software"), to deal
  10. // in the Software without restriction, including without limitation the rights
  11. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. // copies of the Software, and to permit persons to whom the Software is
  13. // furnished to do so, subject to the following conditions:
  14. //
  15. // The above copyright notice and this permission notice shall be included in all
  16. // copies or substantial portions of the Software.
  17. //
  18. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  24. // SOFTWARE.
  25. //
  26. import Foundation
  27. public extension Row {
  28. @available(*, deprecated, message: "Use `text` instead.")
  29. public var title: String {
  30. return text
  31. }
  32. @available(*, deprecated, message: "Use `detailText` instead.")
  33. public var subtitle: Subtitle? {
  34. return detailText?.subtitle
  35. }
  36. }
  37. ////////////////////////////////////////////////////////////////////////////////
  38. public extension NavigationRow {
  39. @available(*, deprecated, message: "Use `init(text:detailText:icon:customization:action:)` instead.")
  40. public convenience init(
  41. title: String,
  42. subtitle: Subtitle,
  43. icon: Icon? = nil,
  44. customization: ((UITableViewCell, Row & RowStyle) -> Void)? = nil,
  45. action: ((Row) -> Void)? = nil
  46. ) {
  47. self.init(
  48. text: title,
  49. detailText: subtitle.detailText,
  50. icon: icon,
  51. customization: customization,
  52. action: action
  53. )
  54. }
  55. }
  56. ////////////////////////////////////////////////////////////////////////////////
  57. public extension OptionRow {
  58. @available(*, deprecated, message: "Use `init(text:detailText:isSelected:icon:customization:action:)` instead.")
  59. public convenience init(
  60. title: String,
  61. isSelected: Bool,
  62. icon: Icon? = nil,
  63. customization: ((UITableViewCell, Row & RowStyle) -> Void)? = nil,
  64. action: ((Row) -> Void)?
  65. ) {
  66. self.init(
  67. text: title,
  68. detailText: nil,
  69. isSelected: isSelected,
  70. icon: icon,
  71. customization: customization,
  72. action: action
  73. )
  74. }
  75. }
  76. ////////////////////////////////////////////////////////////////////////////////
  77. public extension SwitchRow {
  78. @available(*, deprecated, message: "Use `init(text:detailText:switchValue:icon:customization:action:)` instead.")
  79. public convenience init(
  80. title: String,
  81. switchValue: Bool,
  82. icon: Icon? = nil,
  83. customization: ((UITableViewCell, Row & RowStyle) -> Void)? = nil,
  84. action: ((Row) -> Void)?
  85. ) {
  86. self.init(
  87. text: title,
  88. detailText: nil,
  89. switchValue: switchValue,
  90. icon: icon,
  91. customization: customization,
  92. action: action
  93. )
  94. }
  95. }
  96. ////////////////////////////////////////////////////////////////////////////////
  97. public extension TapActionRow {
  98. @available(*, deprecated, message: "Use `init(text:customization:action:)` instead.")
  99. public convenience init(
  100. title: String,
  101. customization: ((UITableViewCell, Row & RowStyle) -> Void)? = nil,
  102. action: ((Row) -> Void)?
  103. ) {
  104. self.init(
  105. text: title,
  106. customization: customization,
  107. action: action
  108. )
  109. }
  110. }