ConstraintMakerExtendable.swift 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 class ConstraintMakerExtendable: ConstraintMakerRelatable {
  29. public var left: ConstraintMakerExtendable {
  30. self.description.attributes += ConstraintAttributes.Left
  31. return self
  32. }
  33. public var top: ConstraintMakerExtendable {
  34. self.description.attributes += ConstraintAttributes.Top
  35. return self
  36. }
  37. public var bottom: ConstraintMakerExtendable {
  38. self.description.attributes += ConstraintAttributes.Bottom
  39. return self
  40. }
  41. public var right: ConstraintMakerExtendable {
  42. self.description.attributes += ConstraintAttributes.Right
  43. return self
  44. }
  45. public var leading: ConstraintMakerExtendable {
  46. self.description.attributes += ConstraintAttributes.Leading
  47. return self
  48. }
  49. public var trailing: ConstraintMakerExtendable {
  50. self.description.attributes += ConstraintAttributes.Trailing
  51. return self
  52. }
  53. public var width: ConstraintMakerExtendable {
  54. self.description.attributes += ConstraintAttributes.Width
  55. return self
  56. }
  57. public var height: ConstraintMakerExtendable {
  58. self.description.attributes += ConstraintAttributes.Height
  59. return self
  60. }
  61. public var centerX: ConstraintMakerExtendable {
  62. self.description.attributes += ConstraintAttributes.CenterX
  63. return self
  64. }
  65. public var centerY: ConstraintMakerExtendable {
  66. self.description.attributes += ConstraintAttributes.CenterY
  67. return self
  68. }
  69. public var baseline: ConstraintMakerExtendable {
  70. self.description.attributes += ConstraintAttributes.Baseline
  71. return self
  72. }
  73. @available(iOS 8.0, *)
  74. public var firstBaseline: ConstraintMakerExtendable {
  75. self.description.attributes += ConstraintAttributes.FirstBaseline
  76. return self
  77. }
  78. @available(iOS 8.0, *)
  79. public var leftMargin: ConstraintMakerExtendable {
  80. self.description.attributes += ConstraintAttributes.LeftMargin
  81. return self
  82. }
  83. @available(iOS 8.0, *)
  84. public var rightMargin: ConstraintMakerExtendable {
  85. self.description.attributes += ConstraintAttributes.RightMargin
  86. return self
  87. }
  88. @available(iOS 8.0, *)
  89. public var bottomMargin: ConstraintMakerExtendable {
  90. self.description.attributes += ConstraintAttributes.BottomMargin
  91. return self
  92. }
  93. @available(iOS 8.0, *)
  94. public var leadingMargin: ConstraintMakerExtendable {
  95. self.description.attributes += ConstraintAttributes.LeadingMargin
  96. return self
  97. }
  98. @available(iOS 8.0, *)
  99. public var trailingMargin: ConstraintMakerExtendable {
  100. self.description.attributes += ConstraintAttributes.TrailingMargin
  101. return self
  102. }
  103. @available(iOS 8.0, *)
  104. public var centerXWithinMargins: ConstraintMakerExtendable {
  105. self.description.attributes += ConstraintAttributes.CenterXWithinMargins
  106. return self
  107. }
  108. @available(iOS 8.0, *)
  109. public var centerYWithinMargins: ConstraintMakerExtendable {
  110. self.description.attributes += ConstraintAttributes.CenterYWithinMargins
  111. return self
  112. }
  113. public var edges: ConstraintMakerExtendable {
  114. self.description.attributes += ConstraintAttributes.Edges
  115. return self
  116. }
  117. public var size: ConstraintMakerExtendable {
  118. self.description.attributes += ConstraintAttributes.Size
  119. return self
  120. }
  121. @available(iOS 8.0, *)
  122. public var margins: ConstraintMakerExtendable {
  123. self.description.attributes += ConstraintAttributes.Margins
  124. return self
  125. }
  126. @available(iOS 8.0, *)
  127. public var centerWithinMargins: ConstraintMakerExtendable {
  128. self.description.attributes += ConstraintAttributes.CenterWithinMargins
  129. return self
  130. }
  131. }