Skip to content

Instantly share code, notes, and snippets.

@cacheleocode
Last active March 18, 2018 07:09
Show Gist options
  • Select an option

  • Save cacheleocode/466dc8bcb1e7508d7b0156e52d1b7cdc to your computer and use it in GitHub Desktop.

Select an option

Save cacheleocode/466dc8bcb1e7508d7b0156e52d1b7cdc to your computer and use it in GitHub Desktop.
UIGraphicsBeginImageContext(self.frame.size)
let ctx = UIGraphicsGetCurrentContext()!
self.layer.render(in: ctx)
let img = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment