ConstraintView+Extensions.swift 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //
  2. // SnapKit
  3. //
  4. // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to deal
  8. // in the Software without restriction, including without limitation the rights
  9. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. // copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. // THE SOFTWARE.
  23. #if os(iOS) || os(tvOS)
  24. import UIKit
  25. #else
  26. import AppKit
  27. #endif
  28. public extension ConstraintView {
  29. @available(*, deprecated, renamed:"snp.left")
  30. var snp_left: ConstraintItem { return self.snp.left }
  31. @available(*, deprecated, renamed:"snp.top")
  32. var snp_top: ConstraintItem { return self.snp.top }
  33. @available(*, deprecated, renamed:"snp.right")
  34. var snp_right: ConstraintItem { return self.snp.right }
  35. @available(*, deprecated, renamed:"snp.bottom")
  36. var snp_bottom: ConstraintItem { return self.snp.bottom }
  37. @available(*, deprecated, renamed:"snp.leading")
  38. var snp_leading: ConstraintItem { return self.snp.leading }
  39. @available(*, deprecated, renamed:"snp.trailing")
  40. var snp_trailing: ConstraintItem { return self.snp.trailing }
  41. @available(*, deprecated, renamed:"snp.width")
  42. var snp_width: ConstraintItem { return self.snp.width }
  43. @available(*, deprecated, renamed:"snp.height")
  44. var snp_height: ConstraintItem { return self.snp.height }
  45. @available(*, deprecated, renamed:"snp.centerX")
  46. var snp_centerX: ConstraintItem { return self.snp.centerX }
  47. @available(*, deprecated, renamed:"snp.centerY")
  48. var snp_centerY: ConstraintItem { return self.snp.centerY }
  49. @available(*, deprecated, renamed:"snp.baseline")
  50. var snp_baseline: ConstraintItem { return self.snp.baseline }
  51. @available(*, deprecated, renamed:"snp.lastBaseline")
  52. @available(iOS 8.0, OSX 10.11, *)
  53. var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
  54. @available(iOS, deprecated, renamed:"snp.firstBaseline")
  55. @available(iOS 8.0, OSX 10.11, *)
  56. var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
  57. @available(iOS, deprecated, renamed:"snp.leftMargin")
  58. @available(iOS 8.0, *)
  59. var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
  60. @available(iOS, deprecated, renamed:"snp.topMargin")
  61. @available(iOS 8.0, *)
  62. var snp_topMargin: ConstraintItem { return self.snp.topMargin }
  63. @available(iOS, deprecated, renamed:"snp.rightMargin")
  64. @available(iOS 8.0, *)
  65. var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
  66. @available(iOS, deprecated, renamed:"snp.bottomMargin")
  67. @available(iOS 8.0, *)
  68. var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
  69. @available(iOS, deprecated, renamed:"snp.leadingMargin")
  70. @available(iOS 8.0, *)
  71. var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
  72. @available(iOS, deprecated, renamed:"snp.trailingMargin")
  73. @available(iOS 8.0, *)
  74. var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
  75. @available(iOS, deprecated, renamed:"snp.centerXWithinMargins")
  76. @available(iOS 8.0, *)
  77. var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
  78. @available(iOS, deprecated, renamed:"snp.centerYWithinMargins")
  79. @available(iOS 8.0, *)
  80. var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
  81. @available(*, deprecated, renamed:"snp.edges")
  82. var snp_edges: ConstraintItem { return self.snp.edges }
  83. @available(*, deprecated, renamed:"snp.size")
  84. var snp_size: ConstraintItem { return self.snp.size }
  85. @available(*, deprecated, renamed:"snp.center")
  86. var snp_center: ConstraintItem { return self.snp.center }
  87. @available(iOS, deprecated, renamed:"snp.margins")
  88. @available(iOS 8.0, *)
  89. var snp_margins: ConstraintItem { return self.snp.margins }
  90. @available(iOS, deprecated, renamed:"snp.centerWithinMargins")
  91. @available(iOS 8.0, *)
  92. var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
  93. @available(*, deprecated, renamed:"snp.prepareConstraints(_:)")
  94. func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
  95. return self.snp.prepareConstraints(closure)
  96. }
  97. @available(*, deprecated, renamed:"snp.makeConstraints(_:)")
  98. func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
  99. self.snp.makeConstraints(closure)
  100. }
  101. @available(*, deprecated, renamed:"snp.remakeConstraints(_:)")
  102. func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
  103. self.snp.remakeConstraints(closure)
  104. }
  105. @available(*, deprecated, renamed:"snp.updateConstraints(_:)")
  106. func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
  107. self.snp.updateConstraints(closure)
  108. }
  109. @available(*, deprecated, renamed:"snp.removeConstraints()")
  110. func snp_removeConstraints() {
  111. self.snp.removeConstraints()
  112. }
  113. var snp: ConstraintViewDSL {
  114. return ConstraintViewDSL(view: self)
  115. }
  116. }