@@ -134,6 +134,177 @@ extension View {
134
134
}
135
135
}
136
136
137
+ extension View {
138
+ /// Options for animating views using block objects.
139
+ public struct AnimationOptions : OptionSet {
140
+ public typealias RawValue = UInt
141
+
142
+ public let rawValue : RawValue
143
+
144
+ public init ( rawValue: RawValue ) {
145
+ self . rawValue = rawValue
146
+ }
147
+ }
148
+ }
149
+
150
+ extension View . AnimationOptions {
151
+ /// Lay out subviews at commit time so that they are animated along with their
152
+ /// parent.
153
+ public static var layoutSubviews : View . AnimationOptions {
154
+ View . AnimationOptions ( rawValue: 1 << 0 )
155
+ }
156
+
157
+ /// Allow the user to interact with views while they are being animated.
158
+ public static var allowUserInteraction : View . AnimationOptions {
159
+ View . AnimationOptions ( rawValue: 1 << 1 )
160
+ }
161
+
162
+ /// Start the animation from the current setting associated with an already
163
+ /// in-flight animation.
164
+ ///
165
+ /// If this key is not present, all in-flight animations are allowed to finish
166
+ /// before the new animation is started. If another animation is not in
167
+ /// flight, this key has no effect.
168
+ public static var beginFromCurrentState : View . AnimationOptions {
169
+ View . AnimationOptions ( rawValue: 1 << 2 )
170
+ }
171
+
172
+ /// Repeat the animation indefinitely.
173
+ public static var `repeat` : View . AnimationOptions {
174
+ View . AnimationOptions ( rawValue: 1 << 3 )
175
+ }
176
+
177
+ /// Run the animation backwards and forwards (must be combined with the repeat
178
+ /// option).
179
+ public static var autoreverse : View . AnimationOptions {
180
+ View . AnimationOptions ( rawValue: 1 << 4 )
181
+ }
182
+
183
+ /// Force the animation to use the original duration value specified when the
184
+ /// animation was submitted.
185
+ public static var overrideInheritedDuration : View . AnimationOptions {
186
+ View . AnimationOptions ( rawValue: 1 << 5 )
187
+ }
188
+
189
+ /// Force the animation to use the original curve value specified when the
190
+ /// animation was submitted.
191
+ ///
192
+ /// If this key is not present, the animation inherits the curve of the
193
+ /// in-flight animation, if any.
194
+ public static var overrideInheritedCurve : View . AnimationOptions {
195
+ View . AnimationOptions ( rawValue: 1 << 6 )
196
+ }
197
+
198
+ /// Animate the views by changing the property values dynamically and
199
+ /// redrawing the view.
200
+ public static var allowAnimatedContent : View . AnimationOptions {
201
+ View . AnimationOptions ( rawValue: 1 << 7 )
202
+ }
203
+
204
+ /// Hide or show views during a view transition.
205
+ ///
206
+ /// When present, this key causes views to be hidden or shown (instead of
207
+ /// removed or added) when performing a view transition. Both views must
208
+ /// already be present in the parent view's hierarchy when using this key. If
209
+ /// this key is not present, the to-view in a transition is added to, and the
210
+ /// from-view is removed from, the parent view's list of subviews.
211
+ public static var showHideTransitionViews : View . AnimationOptions {
212
+ View . AnimationOptions ( rawValue: 1 << 8 )
213
+ }
214
+
215
+ /// The option to not inherit the animation type or any options.
216
+ public static var overrideInheritedOptions : View . AnimationOptions {
217
+ View . AnimationOptions ( rawValue: 1 << 9 )
218
+ }
219
+
220
+ /// Specify an ease-in ease-out curve, which causes the animation to begin
221
+ /// slowly, accelerate through the middle of its duration, and then slow again
222
+ /// before completing.
223
+ public static var curveEaseInOut : View . AnimationOptions {
224
+ View . AnimationOptions ( rawValue: 0 << 16 )
225
+ }
226
+
227
+ /// An ease-in curve causes the animation to begin slowly, and then speed up
228
+ /// as it progresses.
229
+ public static var curveEaseIn : View . AnimationOptions {
230
+ View . AnimationOptions ( rawValue: 1 << 16 )
231
+ }
232
+
233
+ /// An ease-out curve causes the animation to begin quickly, and then slow as
234
+ /// it completes.
235
+ public static var curveEaseOut : View . AnimationOptions {
236
+ View . AnimationOptions ( rawValue: 2 << 16 )
237
+ }
238
+
239
+ /// A linear animation curve causes an animation to occur evenly over its
240
+ /// duration.
241
+ public static var curveLinear : View . AnimationOptions {
242
+ View . AnimationOptions ( rawValue: 3 << 16 )
243
+ }
244
+
245
+ internal static var transitionNone : View . AnimationOptions {
246
+ View . AnimationOptions ( rawValue: 0 << 20 )
247
+ }
248
+
249
+ /// A transition that flips a view around its vertical axis from left to right
250
+ /// (the left side of the view moves toward the front and right side toward
251
+ /// the back).
252
+ public static var transitionFlipFromLeft : View . AnimationOptions {
253
+ View . AnimationOptions ( rawValue: 1 << 20 )
254
+ }
255
+
256
+ /// A transition that flips a view around its vertical axis from right to left
257
+ /// (the right side of the view moves toward the front and left side toward
258
+ /// the back).
259
+ public static var transitionFlipFromRight : View . AnimationOptions {
260
+ View . AnimationOptions ( rawValue: 2 << 20 )
261
+ }
262
+
263
+ /// A transition that curls a view up from the bottom.
264
+ public static var transitionCurlUp : View . AnimationOptions {
265
+ View . AnimationOptions ( rawValue: 3 << 20 )
266
+ }
267
+
268
+ /// A transition that curls a view down from the top.
269
+ public static var transitionCurlDown : View . AnimationOptions {
270
+ View . AnimationOptions ( rawValue: 4 << 20 )
271
+ }
272
+
273
+ /// A transition that dissolves from one view to the next.
274
+ public static var transitionCrossDissolve : View . AnimationOptions {
275
+ View . AnimationOptions ( rawValue: 5 << 20 )
276
+ }
277
+
278
+ /// A transition that flips a view around its horizontal axis from top to
279
+ /// bottom (the top side of the view moves toward the front and the bottom
280
+ /// side toward the back).
281
+ public static var transitionFlipFromTop : View . AnimationOptions {
282
+ View . AnimationOptions ( rawValue: 6 << 20 )
283
+ }
284
+
285
+ internal static var preferredFramesPersSecondDefault : View . AnimationOptions {
286
+ View . AnimationOptions ( rawValue: 0 << 24 )
287
+ }
288
+
289
+ /// A frame rate of 30 frames per second.
290
+ ///
291
+ /// Specify this value to request a preferred frame rate. It's recommended
292
+ /// that you use the default value unless you have identified a specific need
293
+ /// for an explicit rate.
294
+ public static var preferredFramesPerSecond30 : View . AnimationOptions {
295
+ View . AnimationOptions ( rawValue: 7 << 24 )
296
+ }
297
+
298
+ /// A frame rate of 60 frames per second.
299
+ ///
300
+ /// Specify this value to request a preferred frame rate. It's recommended
301
+ /// that you use the default value unless you have identified a specific need
302
+ /// for an explicit rate.
303
+ public static var preferredFramesPerSecond60 : View . AnimationOptions {
304
+ View . AnimationOptions ( rawValue: 3 << 24 )
305
+ }
306
+ }
307
+
137
308
extension View {
138
309
/// Options for automatic view resizing.
139
310
public struct AutoresizingMask : OptionSet {
0 commit comments