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) }
  }
  
}