Skip to content

Commit 540c6a4

Browse files
author
Michele Volpato
committed
Calculating proper top margin is more succint
1 parent 4a1d95c commit 540c6a4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Examples/NavigationTransitionsExample/Transition/Transition/InteractiveZoomTransitionController.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,12 @@ extension InteractiveZoomTransitionController : SharedElementProvider {
6868
let targetFrame: CGRect
6969

7070
// Get top margin, depending on possible safe area
71-
var yMargin: CGFloat
71+
var yMargin = CollectionViewController.margin
7272

7373
if #available(iOS 11.0, *) {
74-
yMargin = toViewController.collectionView.safeAreaInsets.top
75-
} else {
76-
yMargin = 0.0
74+
yMargin += toViewController.collectionView.safeAreaInsets.top
7775
}
7876

79-
yMargin += CollectionViewController.margin
80-
8177
if isPresenting {
8278
initialFrame = fromViewController.targetFrame
8379
targetFrame = CGRect(origin: CGPoint(x: CollectionViewController.margin, y: yMargin), size: header.image.frame.size)

0 commit comments

Comments
 (0)