-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathPopMenuViewController.swift
More file actions
652 lines (519 loc) Β· 25.2 KB
/
PopMenuViewController.swift
File metadata and controls
652 lines (519 loc) Β· 25.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
//
// PopMenuViewController.swift
// PopMenu
//
// Created by Cali Castle on 4/12/18.
// Copyright Β© 2018 Cali Castle. All rights reserved.
//
import UIKit
/// Delegate for handling PopMenu selection.
@objc public protocol PopMenuViewControllerDelegate: class {
/// Called when an action is selected.
@objc optional func popMenuDidSelectItem(_ popMenuViewController: PopMenuViewController, at index: Int)
}
final public class PopMenuViewController: UIViewController {
// MARK: - Properties
/// Delegate instance for handling callbacks.
public weak var delegate: PopMenuViewControllerDelegate?
/// Appearance configuration.
public var appearance = PopMenuAppearance()
/// Background overlay that covers the whole screen.
public let backgroundView = UIView()
/// The blur overlay view for translucent illusion.
private lazy var blurOverlayView: UIVisualEffectView = {
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
blurView.translatesAutoresizingMaskIntoConstraints = false
blurView.layer.cornerRadius = appearance.popMenuCornerRadius
blurView.layer.masksToBounds = true
blurView.isUserInteractionEnabled = false
return blurView
}()
/// Main root view that has shadows.
public let containerView = UIView()
/// Main content view.
public let contentView = PopMenuGradientView()
/// The view contains all the actions.
public let actionsView = UIStackView()
/// The source View to be displayed from.
private(set) weak var sourceView: AnyObject?
/// The absolute source frame relative to screen.
private(set) var absoluteSourceFrame: CGRect?
/// The calculated content frame.
public lazy var contentFrame: CGRect = {
return calculateContentFittingFrame()
}()
// MARK: - Configurations
/// Determines whether to dismiss menu after an action is selected.
public var shouldDismissOnSelection: Bool = true
/// Determines whether the pan gesture is enabled on the actions.
public var shouldEnablePanGesture: Bool = true
/// Determines whether enable haptics for iPhone 7 and up.
public var shouldEnableHaptics: Bool = true
/// Handler for when the menu is dismissed.
public var didDismiss: ((Bool) -> Void)?
// MARK: - Constraints
private(set) var contentLeftConstraint: NSLayoutConstraint!
private(set) var contentTopConstraint: NSLayoutConstraint!
private(set) var contentWidthConstraint: NSLayoutConstraint!
private(set) var contentHeightConstraint: NSLayoutConstraint!
/// The UIView instance of source view.
fileprivate lazy var sourceViewAsUIView: UIView? = {
guard let sourceView = sourceView else { return nil }
// Check if UIBarButtonItem
if let sourceBarButtonItem = sourceView as? UIBarButtonItem {
if let buttonView = sourceBarButtonItem.value(forKey: "view") as? UIView {
return buttonView
}
}
if let sourceView = sourceView as? UIView {
return sourceView
}
return nil
}()
/// Tap gesture to dismiss for background view.
fileprivate lazy var tapGestureForDismissal: UITapGestureRecognizer = {
let tapper = UITapGestureRecognizer(target: self, action: #selector(backgroundViewDidTap(_:)))
tapper.cancelsTouchesInView = false
tapper.delaysTouchesEnded = false
return tapper
}()
/// Pan gesture to highligh actions.
fileprivate lazy var panGestureForMenu: UIPanGestureRecognizer = {
let panner = UIPanGestureRecognizer(target: self, action: #selector(menuDidPan(_:)))
panner.maximumNumberOfTouches = 1
return panner
}()
/// Actions of menu.
public private(set) var actions: [PopMenuAction] = []
/// Max content width allowed for the content to stretch to.
fileprivate let maxContentWidth: CGFloat = UIScreen.main.bounds.size.width * 0.9
// MARK: - View Life Cycle
/// PopMenuViewController constructor
///
/// - Parameters:
/// - sourceView: the source view for triggering the menu
/// - actions: all the menu actions
/// - appearance: appearance configuration
public convenience init(sourceView: AnyObject? = nil, actions: [PopMenuAction], appearance: PopMenuAppearance? = nil) {
self.init(nibName: nil, bundle: nil)
self.sourceView = sourceView
self.actions = actions
// Assign appearance or use the default one.
if let appearance = appearance {
self.appearance = appearance
}
setAbsoluteSourceFrame()
transitioningDelegate = self
modalPresentationStyle = .overFullScreen
modalPresentationCapturesStatusBarAppearance = true
}
/// Load view entry point.
public override func loadView() {
super.loadView()
view.backgroundColor = .clear
configureBackgroundView()
configureContentView()
configureActionsView()
}
/// Set absolute source frame relative to screen frame.
fileprivate func setAbsoluteSourceFrame() {
if let sourceView = sourceViewAsUIView {
absoluteSourceFrame = sourceView.convert(sourceView.bounds, to: nil)
}
}
/// Add a new action to the menu.
///
/// - Parameter action: Action to be added
public func addAction(_ action: PopMenuAction) {
actions.append(action)
}
// MARK: - Status Bar Appearance
public override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
return .fade
}
/// Set status bar style.
public override var preferredStatusBarStyle: UIStatusBarStyle {
// If style defined, return
if let statusBarStyle = appearance.popMenuStatusBarStyle {
return statusBarStyle
}
// Contrast of blur style
let backgroundStyle = appearance.popMenuBackgroundStyle
if let blurStyle = backgroundStyle.blurStyle {
switch blurStyle {
case .dark:
return .lightContent
default:
return .default
}
}
// Contrast of dimmed color
if let dimColor = backgroundStyle.dimColor {
return dimColor.blackOrWhiteContrastingColor() == .white ? .lightContent : .default
}
return .lightContent
}
/// Handle when device orientation changed or container size changed.
///
/// - Parameters:
/// - size: Changed size
/// - coordinator: Coordinator that manages the container
public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
coordinator.animate(alongsideTransition: { context in
self.configureBackgroundView()
self.contentFrame = self.calculateContentFittingFrame()
self.setupContentConstraints()
})
super.viewWillTransition(to: size, with: coordinator)
}
}
// MARK: - View Configurations
extension PopMenuViewController {
/// Setup the background view at the bottom.
fileprivate func configureBackgroundView() {
backgroundView.frame = view.frame
backgroundView.backgroundColor = .clear
backgroundView.translatesAutoresizingMaskIntoConstraints = false
backgroundView.addGestureRecognizer(tapGestureForDismissal)
backgroundView.isUserInteractionEnabled = true
let backgroundStyle = appearance.popMenuBackgroundStyle
// Blurred background
if let isBlurred = backgroundStyle.isBlurred,
isBlurred,
let blurStyle = backgroundStyle.blurStyle {
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: blurStyle))
blurView.frame = backgroundView.frame
backgroundView.addSubview(blurView)
}
// Dimmed background
if let isDimmed = backgroundStyle.isDimmed,
isDimmed,
let color = backgroundStyle.dimColor,
let opacity = backgroundStyle.dimOpacity {
backgroundView.backgroundColor = color.withAlphaComponent(opacity)
}
view.insertSubview(backgroundView, at: 0)
}
/// Setup the content view.
fileprivate func configureContentView() {
containerView.translatesAutoresizingMaskIntoConstraints = false
containerView.addShadow(offset: .init(width: 0, height: 1), opacity: 0.5, radius: 20)
containerView.layer.cornerRadius = appearance.popMenuCornerRadius
containerView.backgroundColor = .clear
view.addSubview(containerView)
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.layer.cornerRadius = appearance.popMenuCornerRadius
contentView.layer.masksToBounds = true
contentView.clipsToBounds = true
let colors = appearance.popMenuColor.backgroundColor.colors
if colors.count > 0 {
if colors.count == 1 {
// Configure solid fill background.
contentView.backgroundColor = colors.first?.withAlphaComponent(0.9)
contentView.startColor = .clear
contentView.endColor = .clear
} else {
// Configure gradient color.
contentView.diagonalMode = true
contentView.startColor = colors.first!
contentView.endColor = colors.last!
contentView.gradientLayer.opacity = 0.8
}
}
containerView.addSubview(blurOverlayView)
containerView.addSubview(contentView)
setupContentConstraints()
}
/// Activate necessary constraints.
fileprivate func setupContentConstraints() {
contentLeftConstraint = containerView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: contentFrame.origin.x)
contentTopConstraint = containerView.topAnchor.constraint(equalTo: view.topAnchor, constant: contentFrame.origin.y)
contentWidthConstraint = containerView.widthAnchor.constraint(equalToConstant: contentFrame.size.width)
contentHeightConstraint = containerView.heightAnchor.constraint(equalToConstant: contentFrame.size.height)
// Activate container view constraints
NSLayoutConstraint.activate([
contentLeftConstraint,
contentTopConstraint,
contentWidthConstraint,
contentHeightConstraint
])
// Activate content view constraints
NSLayoutConstraint.activate([
contentView.leftAnchor.constraint(equalTo: containerView.leftAnchor),
contentView.rightAnchor.constraint(equalTo: containerView.rightAnchor),
contentView.topAnchor.constraint(equalTo: containerView.topAnchor),
contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
])
// Activate blur overlay constraints
NSLayoutConstraint.activate([
blurOverlayView.leftAnchor.constraint(equalTo: containerView.leftAnchor),
blurOverlayView.rightAnchor.constraint(equalTo: containerView.rightAnchor),
blurOverlayView.topAnchor.constraint(equalTo: containerView.topAnchor),
blurOverlayView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
])
}
/// Determine the fitting frame for content.
///
/// - Returns: The fitting frame
fileprivate func calculateContentFittingFrame() -> CGRect {
var height: CGFloat
if actions.count >= appearance.popMenuActionCountForScrollable {
// Make scroll view
height = CGFloat(appearance.popMenuActionCountForScrollable) * appearance.popMenuActionHeight
height -= 20
} else {
height = CGFloat(actions.count) * appearance.popMenuActionHeight
}
let size = CGSize(width: calculateContentWidth() + appearance.popMenuContentInset.left + appearance.popMenuContentInset.right, height: height + appearance.popMenuContentInset.top + appearance.popMenuContentInset.bottom)
let origin = calculateContentOrigin(with: size)
return CGRect(origin: origin, size: size)
}
/// Determine where the menu should display.
///
/// - Returns: The source origin point
fileprivate func calculateContentOrigin(with size: CGSize) -> CGPoint {
guard let sourceFrame = absoluteSourceFrame else { return CGPoint(x: view.center.x - size.width / 2, y: view.center.y - size.height / 2) }
let minContentPos: CGFloat = UIScreen.main.bounds.size.width * 0.05
let maxContentPos: CGFloat = UIScreen.main.bounds.size.width * 0.95
// Get desired content origin point
let offsetX = (size.width - sourceFrame.size.width ) / 2
var desiredOrigin = CGPoint(x: sourceFrame.origin.x - offsetX, y: sourceFrame.origin.y)
if (desiredOrigin.x + size.width) > maxContentPos {
desiredOrigin.x = maxContentPos - size.width
}
if desiredOrigin.x < minContentPos {
desiredOrigin.x = minContentPos
}
// Move content in place
translateOverflowX(desiredOrigin: &desiredOrigin, contentSize: size)
translateOverflowY(desiredOrigin: &desiredOrigin, contentSize: size)
return desiredOrigin
}
/// Move content into view if it's overflowed in X axis.
///
/// - Parameters:
/// - desiredOrigin: The desired origin point
/// - contentSize: Content size
fileprivate func translateOverflowX(desiredOrigin: inout CGPoint, contentSize: CGSize) {
let edgePadding: CGFloat = 8
// Check content in left or right side
let leftSide = (desiredOrigin.x - view.center.x) < 0
// Check view overflow
let origin = CGPoint(x: leftSide ? desiredOrigin.x : desiredOrigin.x + contentSize.width, y: desiredOrigin.y)
// Move accordingly
if !view.frame.contains(origin) {
let overflowX: CGFloat = (leftSide ? 1 : -1) * ((leftSide ? view.frame.origin.x : view.frame.origin.x + view.frame.size.width) - origin.x) + edgePadding
desiredOrigin = CGPoint(x: desiredOrigin.x - (leftSide ? -1 : 1) * overflowX, y: origin.y)
}
}
/// Move content into view if it's overflowed in Y axis.
///
/// - Parameters:
/// - desiredOrigin: The desired origin point
/// - contentSize: Content size
fileprivate func translateOverflowY(desiredOrigin: inout CGPoint, contentSize: CGSize) {
let edgePadding: CGFloat
let origin = CGPoint(x: desiredOrigin.x, y: desiredOrigin.y + contentSize.height)
if #available(iOS 11.0, *) {
edgePadding = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 8
} else {
edgePadding = 8
}
// Check content inside of view or not
if !view.frame.contains(origin) {
let overFlowY: CGFloat = origin.y - view.frame.size.height + edgePadding
desiredOrigin = CGPoint(x: desiredOrigin.x, y: desiredOrigin.y - overFlowY)
}
}
/// Determine the content width by the longest title possible.
///
/// - Returns: The fitting width for content
fileprivate func calculateContentWidth() -> CGFloat {
var contentFitWidth: CGFloat = 0
contentFitWidth += PopMenuDefaultAction.textLeftPadding * 2
// Calculate the widest width from action titles to determine the width
if let action = actions.max(by: {
guard let title1 = $0.title, let title2 = $1.title else { return false }
return title1.count < title2.count
}) {
let sizingLabel = UILabel()
sizingLabel.text = action.title
let desiredWidth = sizingLabel.sizeThatFits(view.bounds.size).width
contentFitWidth += desiredWidth
contentFitWidth += action.iconWidthHeight
}
return min(contentFitWidth,maxContentWidth)
}
/// Setup actions view.
fileprivate func configureActionsView() {
actionsView.translatesAutoresizingMaskIntoConstraints = false
actionsView.axis = .vertical
actionsView.alignment = .fill
actionsView.distribution = .fillEqually
// Configure each action
actions.forEach { action in
action.font = appearance.popMenuFont
action.tintColor = action.color ?? appearance.popMenuColor.actionColor.color
action.cornerRadius = appearance.popMenuCornerRadius / 2
action.renderActionView()
// Give separator to each action but the last
if !action.isEqual(actions.last) {
addSeparator(to: action.view)
}
let tapper = UITapGestureRecognizer(target: self, action: #selector(menuDidTap(_:)))
tapper.delaysTouchesEnded = false
action.view.addGestureRecognizer(tapper)
actionsView.addArrangedSubview(action.view)
}
// Check add scroll view or not
if actions.count >= (appearance.popMenuActionCountForScrollable) {
// Scrollable actions
let scrollView = UIScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.showsHorizontalScrollIndicator = false
scrollView.showsVerticalScrollIndicator = !appearance.popMenuScrollIndicatorHidden
scrollView.indicatorStyle = appearance.popMenuScrollIndicatorStyle
scrollView.contentSize.height = appearance.popMenuActionHeight * CGFloat(actions.count)
scrollView.addSubview(actionsView)
contentView.addSubview(scrollView)
NSLayoutConstraint.activate([
scrollView.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: appearance.popMenuContentInset.left),
scrollView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: appearance.popMenuContentInset.top),
scrollView.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant: -appearance.popMenuContentInset.right),
scrollView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -appearance.popMenuContentInset.bottom)
])
NSLayoutConstraint.activate([
actionsView.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: appearance.popMenuContentInset.left),
actionsView.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant: -appearance.popMenuContentInset.right),
actionsView.topAnchor.constraint(equalTo: scrollView.topAnchor),
actionsView.heightAnchor.constraint(equalToConstant: scrollView.contentSize.height)
])
} else {
// Not scrollable
actionsView.addGestureRecognizer(panGestureForMenu)
contentView.addSubview(actionsView)
NSLayoutConstraint.activate([
actionsView.leftAnchor.constraint(equalTo: contentView.leftAnchor, constant: appearance.popMenuContentInset.left),
actionsView.rightAnchor.constraint(equalTo: contentView.rightAnchor, constant: -appearance.popMenuContentInset.right),
actionsView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: appearance.popMenuContentInset.top),
actionsView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -appearance.popMenuContentInset.bottom)
])
}
}
/// Add separator view for the given action view.
///
/// - Parameters:
/// - separator: Separator style
/// - actionView: Action's view
fileprivate func addSeparator(to actionView: UIView) {
// Only setup separator if the style is neither 0 height or clear color
guard appearance.popMenuItemSeparator != .none() else { return }
let separator = appearance.popMenuItemSeparator
let separatorView = UIView()
separatorView.translatesAutoresizingMaskIntoConstraints = false
separatorView.backgroundColor = separator.color
actionView.addSubview(separatorView)
NSLayoutConstraint.activate([
separatorView.leftAnchor.constraint(equalTo: actionView.leftAnchor),
separatorView.rightAnchor.constraint(equalTo: actionView.rightAnchor),
separatorView.bottomAnchor.constraint(equalTo: actionView.bottomAnchor),
separatorView.heightAnchor.constraint(equalToConstant: separator.height)
])
}
}
// MARK: - Gestures Control
extension PopMenuViewController {
/// Once the background view is tapped (for dismissal).
@objc fileprivate func backgroundViewDidTap(_ gesture: UITapGestureRecognizer) {
guard gesture.isEqual(tapGestureForDismissal), !touchedInsideContent(location: gesture.location(in: view)) else { return }
dismiss(animated: true) {
// No selection made.
self.didDismiss?(false)
}
}
/// When the menu action gets tapped.
@objc fileprivate func menuDidTap(_ gesture: UITapGestureRecognizer) {
guard let attachedView = gesture.view, let index = actions.index(where: { $0.view.isEqual(attachedView) }) else { return }
actionDidSelect(at: index)
}
/// When the pan gesture triggered in actions view.
@objc fileprivate func menuDidPan(_ gesture: UIPanGestureRecognizer) {
guard shouldEnablePanGesture else { return }
switch gesture.state {
case .began, .changed:
if let index = associatedActionIndex(gesture) {
let action = actions[index]
// Must not be already highlighted
guard !action.highlighted else { return }
if shouldEnableHaptics {
Haptic.selection.generate()
}
// Highlight current action view.
action.highlighted = true
// Unhighlight other actions.
actions.filter { return !$0.isEqual(action) }.forEach { $0.highlighted = false }
}
case .ended:
// Unhighlight all actions.
actions.filter { return $0.highlighted }.forEach { $0.highlighted = false }
// Trigger action selection.
if let index = associatedActionIndex(gesture) {
actionDidSelect(at: index, animated: false)
}
default:
return
}
}
/// Check if touch is inside content view.
fileprivate func touchedInsideContent(location: CGPoint) -> Bool {
return containerView.frame.contains(location)
}
/// Get the gesture associated action index.
///
/// - Parameter gesture: Gesture recognizer
/// - Returns: The index
fileprivate func associatedActionIndex(_ gesture: UIGestureRecognizer) -> Int? {
guard touchedInsideContent(location: gesture.location(in: view)) else { return nil }
// Check which action is associated.
let touchLocation = gesture.location(in: actionsView)
// Get associated index for touch location.
if let touchedView = actionsView.arrangedSubviews.filter({ return $0.frame.contains(touchLocation) }).first,
let index = actionsView.arrangedSubviews.index(of: touchedView){
return index
}
return nil
}
/// Triggers when an action is selected.
///
/// - Parameter index: The index for action
fileprivate func actionDidSelect(at index: Int, animated: Bool = true) {
let action = actions[index]
action.actionSelected?(animated: animated)
if shouldEnableHaptics {
// Generate haptics
if #available(iOS 10.0, *) {
Haptic.impact(.medium).generate()
}
}
// Notify delegate
delegate?.popMenuDidSelectItem?(self, at: index)
// Should dismiss or not
if shouldDismissOnSelection {
dismiss(animated: true) {
// Selection made.
self.didDismiss?(true)
}
}
}
}
// MARK: - Transitioning Delegate
extension PopMenuViewController: UIViewControllerTransitioningDelegate {
/// Custom presentation animation.
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return PopMenuPresentAnimationController(sourceFrame: absoluteSourceFrame)
}
/// Custom dismissal animation.
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return PopMenuDismissAnimationController(sourceFrame: absoluteSourceFrame)
}
}