@@ -56,65 +56,65 @@ internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {
56
56
57
57
// normal
58
58
59
- internal static var none : ConstraintAttributes { return 0 }
60
- internal static var left : ConstraintAttributes { return 1 }
61
- internal static var top : ConstraintAttributes { return 2 }
62
- internal static var right : ConstraintAttributes { return 4 }
63
- internal static var bottom : ConstraintAttributes { return 8 }
64
- internal static var leading : ConstraintAttributes { return 16 }
65
- internal static var trailing : ConstraintAttributes { return 32 }
66
- internal static var width : ConstraintAttributes { return 64 }
67
- internal static var height : ConstraintAttributes { return 128 }
68
- internal static var centerX : ConstraintAttributes { return 256 }
69
- internal static var centerY : ConstraintAttributes { return 512 }
70
- internal static var lastBaseline : ConstraintAttributes { return 1024 }
59
+ internal static let none : ConstraintAttributes = 0
60
+ internal static let left : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 0 )
61
+ internal static let top : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 1 )
62
+ internal static let right : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 2 )
63
+ internal static let bottom : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 3 )
64
+ internal static let leading : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 4 )
65
+ internal static let trailing : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 5 )
66
+ internal static let width : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 6 )
67
+ internal static let height : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 7 )
68
+ internal static let centerX : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 8 )
69
+ internal static let centerY : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 9 )
70
+ internal static let lastBaseline : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 10 )
71
71
72
72
@available ( iOS 8 . 0 , OSX 10 . 11 , * )
73
- internal static var firstBaseline : ConstraintAttributes { return 2048 }
74
-
73
+ internal static let firstBaseline : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 11 )
74
+
75
75
@available ( iOS 8 . 0 , * )
76
- internal static var leftMargin : ConstraintAttributes { return 4096 }
77
-
76
+ internal static let leftMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 12 )
77
+
78
78
@available ( iOS 8 . 0 , * )
79
- internal static var rightMargin : ConstraintAttributes { return 8192 }
80
-
79
+ internal static let rightMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 13 )
80
+
81
81
@available ( iOS 8 . 0 , * )
82
- internal static var topMargin : ConstraintAttributes { return 16384 }
83
-
82
+ internal static let topMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 14 )
83
+
84
84
@available ( iOS 8 . 0 , * )
85
- internal static var bottomMargin : ConstraintAttributes { return 32768 }
86
-
85
+ internal static let bottomMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 15 )
86
+
87
87
@available ( iOS 8 . 0 , * )
88
- internal static var leadingMargin : ConstraintAttributes { return 65536 }
89
-
88
+ internal static let leadingMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 16 )
89
+
90
90
@available ( iOS 8 . 0 , * )
91
- internal static var trailingMargin : ConstraintAttributes { return 131072 }
92
-
91
+ internal static let trailingMargin : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 17 )
92
+
93
93
@available ( iOS 8 . 0 , * )
94
- internal static var centerXWithinMargins : ConstraintAttributes { return 262144 }
95
-
94
+ internal static let centerXWithinMargins : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 18 )
95
+
96
96
@available ( iOS 8 . 0 , * )
97
- internal static var centerYWithinMargins : ConstraintAttributes { return 524288 }
97
+ internal static let centerYWithinMargins : ConstraintAttributes = ConstraintAttributes ( UInt ( 1 ) << 19 )
98
98
99
99
// aggregates
100
100
101
- internal static var edges : ConstraintAttributes { return 15 }
102
- internal static var horizontalEdges : ConstraintAttributes { return 5 }
103
- internal static var verticalEdges : ConstraintAttributes { return 10 }
104
- internal static var directionalEdges : ConstraintAttributes { return 58 }
105
- internal static var directionalHorizontalEdges : ConstraintAttributes { return 48 }
106
- internal static var directionalVerticalEdges : ConstraintAttributes { return 10 }
107
- internal static var size : ConstraintAttributes { return 192 }
108
- internal static var center : ConstraintAttributes { return 768 }
109
-
101
+ internal static let edges : ConstraintAttributes = [ . horizontalEdges , . verticalEdges ]
102
+ internal static let horizontalEdges : ConstraintAttributes = [ . left , . right ]
103
+ internal static let verticalEdges : ConstraintAttributes = [ . top , . bottom ]
104
+ internal static let directionalEdges : ConstraintAttributes = [ . directionalHorizontalEdges , . directionalVerticalEdges ]
105
+ internal static let directionalHorizontalEdges : ConstraintAttributes = [ . leading , . trailing ]
106
+ internal static let directionalVerticalEdges : ConstraintAttributes = [ . top , . bottom ]
107
+ internal static let size : ConstraintAttributes = [ . width , . height ]
108
+ internal static let center : ConstraintAttributes = [ . centerX , . centerY ]
109
+
110
110
@available ( iOS 8 . 0 , * )
111
- internal static var margins : ConstraintAttributes { return 61440 }
112
-
111
+ internal static let margins : ConstraintAttributes = [ . leftMargin , . topMargin , . rightMargin , . bottomMargin ]
112
+
113
113
@available ( iOS 8 . 0 , * )
114
- internal static var directionalMargins : ConstraintAttributes { return 245760 }
114
+ internal static let directionalMargins : ConstraintAttributes = [ . leadingMargin , . topMargin , . trailingMargin , . bottomMargin ]
115
115
116
116
@available ( iOS 8 . 0 , * )
117
- internal static var centerWithinMargins : ConstraintAttributes { return 786432 }
117
+ internal static let centerWithinMargins : ConstraintAttributes = [ . centerXWithinMargins , . centerYWithinMargins ]
118
118
119
119
internal var layoutAttributes : [ LayoutAttribute ] {
120
120
var attrs = [ LayoutAttribute] ( )
0 commit comments