Skip to content

Commit

Permalink
chore: replace screenshot deprecated method (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Aug 13, 2024
1 parent 61c4dad commit e878c64
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions PostHog/Replay/UIView+Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,12 @@
return nil
}

// Begin image context
UIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque, 0.0)
let renderer = UIGraphicsImageRenderer(size: size)

// Render the view's layer into the current context
guard let context = UIGraphicsGetCurrentContext() else {
UIGraphicsEndImageContext()
return UIImage()
let image = renderer.image { context in
// Render the view's layer into the current context
layer.render(in: context.cgContext)
}
layer.render(in: context)

// Capture the image from the current context
let image = UIGraphicsGetImageFromCurrentImageContext()

// End the image context
UIGraphicsEndImageContext()

return image
}
Expand Down

0 comments on commit e878c64

Please sign in to comment.