Generatethumbnailrepresentations

[Solved] Generatethumbnailrepresentations | Php Frameworks Codeigniter - Code Explorer | yomemimo.com
Question : generateThumbnailRepresentations

Answered by : happy-hyena-j4t6squdpbx2

func generateThumbnailRepresentations() { // Set up the parameters of the request. guard let url = Bundle.main.url(forResource: "example", withExtension: "png") else { // Handle the error case. assert(false, "The URL can't be nil") return } let size: CGSize = CGSize(width: 60, height: 90) let scale = UIScreen.main.scale // Create the thumbnail request. let request = QLThumbnailGenerator.Request(fileAt: url, size: size, scale: scale, representationTypes: .all) // Retrieve the singleton instance of the thumbnail generator and generate the thumbnails. let generator = QLThumbnailGenerator.shared generator.generateRepresentations(for: request) { (thumbnail, type, error) in DispatchQueue.main.async { if thumbnail == nil || error != nil { // Handle the error case gracefully. } else { // Display the thumbnail that you created. } } }
}

Source : https://developer.apple.com/documentation/quicklookthumbnailing/creating_quick_look_thumbnails_to_preview_files_in_your_app | Last Update : Fri, 02 Jul 21

Answers related to generatethumbnailrepresentations

Code Explorer Popular Question For Php Frameworks Codeigniter