Created
March 14, 2016 01:12
-
-
Save jrturton/76d71410d6dc7a643def to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Snapshot utilities | |
extension UIView { | |
func snapshotView(view: UIView, afterUpdates: Bool) -> UIView { | |
let snapshot = view.snapshotViewAfterScreenUpdates(afterUpdates) | |
self.addSubview(snapshot) | |
snapshot.frame = convertRect(view.bounds, fromView: view) | |
return snapshot | |
} | |
func snapshotViews(views: [UIView], afterUpdates: Bool) -> [UIView] { | |
return views.map { snapshotView($0, afterUpdates: afterUpdates) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment