Skip to content

Instantly share code, notes, and snippets.

@oitan
Created May 2, 2018 18:55
Show Gist options
  • Save oitan/0447ea42b35d649e6daff4ec961322ab to your computer and use it in GitHub Desktop.
Save oitan/0447ea42b35d649e6daff4ec961322ab to your computer and use it in GitHub Desktop.
//taken from: https://www.hackingwithswift.com/example-code/media/how-to-render-a-uiview-to-a-uiimage
//Available from iOS 10.0
let renderer = UIGraphicsImageRenderer(size: view.bounds.size)
let image = renderer.image { ctx in
view.drawHierarchy(in: view.bounds, afterScreenUpdates: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment