Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions CardStackController/Classes/CardStackController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class CardStackController: UIViewController {
fileprivate var isPresentingCard = false
fileprivate var initialDraggingPoint = CGPoint.zero
fileprivate var stackCompletionBlock: CompletionBlock?
fileprivate var backgroundSnapshotView: UIImageView?

fileprivate var previousViewController: UIViewController? {
let previousCardIndex = viewControllers.count - 2
Expand Down Expand Up @@ -127,10 +128,19 @@ public class CardStackController: UIViewController {
super.viewWillAppear(false)

guard isBeingPresented else { return }
let screenShotImage = drawWindowHierarchy(afterScreenUpdates: false)
let imageView = UIImageView(image: screenShotImage)
view.insertSubview(imageView, at: 0)
imageView.pinEdgesToSuperviewEdges()

let backgroundSnapshot = drawWindowHierarchy(afterScreenUpdates: false)
backgroundSnapshotView = UIImageView(image: backgroundSnapshot)

view.insertSubview(backgroundSnapshotView!, at: 0)
backgroundSnapshotView!.pinEdgesToSuperviewEdges()
}

public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

backgroundSnapshotView?.removeFromSuperview()
backgroundSnapshotView = nil
}

public override func viewDidLayoutSubviews() {
Expand Down