Post

Replies

Boosts

Views

Activity

Reply to How to Render a WKWebView() to png-file (iOS16)?
So, I don’t think that comments work… idk why, I tried it 3rimes, but my comment is still missing… So what I said was: You could replace UIGraphicsImageRenderer(bounds: bounds) with UIGraphicsImageRenderer(bounds: *CGRect*) or UIGraphicsImageRenderer(frame: *CGSize*). I think in both cases "*CGSize*" should change the image Size.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to How to Render a WKWebView() to png-file (iOS16)?
I think following extension could do the work: extension UIView {     func saveAsImage() -> UIImage {         let renderer = UIGraphicsImageRenderer(bounds: bounds)         let image = renderer.image { rendererContext in             layer.render(in: rendererContext.cgContext)         }          if let data = image.pngData() {             let filename = *file path*             try? data.write(to: filename)         }     } } you than just have to call the function(I never tried it…) don’t forget to replace file path with the file path where you want to save the image.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Swift Base64 Encoding
Ok ich habe herausgefunden das ich .jpegData() statt .pngData() verwenden sollte (man sieht in shortcuts das das mit /9j anfängt) aber jetzt weiß ich nicht welche compressionQuality ich brauche…Also welche compressionQuality Shortcuts verwendet…?
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’22