mirror of https://github.com/SnapKit/SnapKit
Tidy up how constants are made
This commit is contained in:
parent
aa57289b4b
commit
846d767cbb
|
@ -671,20 +671,20 @@ private extension NSLayoutAttribute {
|
||||||
switch self {
|
switch self {
|
||||||
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return point.x
|
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return point.x
|
||||||
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return point.y
|
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return point.y
|
||||||
case .Right, .RightMargin: return -point.x
|
case .Right, .RightMargin: return point.x
|
||||||
case .Bottom, .BottomMargin: return -point.y
|
case .Bottom, .BottomMargin: return point.y
|
||||||
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? point.x : -point.x
|
case .Leading, .LeadingMargin: return point.x
|
||||||
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? -point.x : point.x
|
case .Trailing, .TrailingMargin: return point.x
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch self {
|
switch self {
|
||||||
case .Left, .CenterX: return point.x
|
case .Left, .CenterX: return point.x
|
||||||
case .Top, .CenterY, .Baseline: return point.y
|
case .Top, .CenterY, .Baseline: return point.y
|
||||||
case .Right: return -point.x
|
case .Right: return point.x
|
||||||
case .Bottom: return -point.y
|
case .Bottom: return point.y
|
||||||
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? point.x : -point.x
|
case .Leading: return point.x
|
||||||
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? -point.x : point.x
|
case .Trailing: return point.x
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -695,20 +695,20 @@ private extension NSLayoutAttribute {
|
||||||
switch self {
|
switch self {
|
||||||
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return insets.left
|
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return insets.left
|
||||||
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return insets.top
|
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return insets.top
|
||||||
case .Right, .RightMargin: return -insets.right
|
case .Right, .RightMargin: return insets.right
|
||||||
case .Bottom, .BottomMargin: return -insets.bottom
|
case .Bottom, .BottomMargin: return insets.bottom
|
||||||
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : insets.right
|
||||||
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? -insets.right : insets.left
|
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : insets.left
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch self {
|
switch self {
|
||||||
case .Left, .CenterX: return insets.left
|
case .Left, .CenterX: return insets.left
|
||||||
case .Top, .CenterY, .Baseline: return insets.top
|
case .Top, .CenterY, .Baseline: return insets.top
|
||||||
case .Right: return -insets.right
|
case .Right: return insets.right
|
||||||
case .Bottom: return -insets.bottom
|
case .Bottom: return insets.bottom
|
||||||
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : insets.right
|
||||||
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? -insets.right : insets.left
|
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : insets.left
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue