SnapshotService.swift
531 Bytes
//
// SnapshotService.swift
// browser
//
// Created by Artem Talko on 23.10.2023.
//
import UIKit
import WebKit
final class SnapshotService {
static let shared = SnapshotService()
private init() {}
func makeSnapshot(_ viewForSnap: UIView) -> UIImage {
let renderer = UIGraphicsImageRenderer(size: viewForSnap.bounds.size)
let siteSnapshotImage = renderer.image { (context) in
viewForSnap.layer.render(in: context.cgContext)
}
return siteSnapshotImage
}
}