Post

Replies

Boosts

Views

Activity

Ok Apple how to dismiss a SwiftUI Modal
I use UIHostingController inside my UIViewController to present a SwiftUI View. I have a button in that view which I want to tap and dismiss the presented view. How do I dimiss SwiftUI views when presented in a UIHostingController...{ let vc = UIHostingController(rootView: SwiftUIView()) present(vc, animated: true, completion: nil) }struct SwiftUIView : View { var body: some View { CustomButton() } }struct CustomButton: View { var body: some View { Button(action: { self.buttonAction() }) { Text(buttonTitle) } } func buttonAction(){ //dismiss the SwiftUIView when this button pressed } }
1
0
5.3k
Aug ’19
PDFKit memory issue
I have a loop that iterates all pages in a PDF and saves parts of its content into core data. Problem seems to be that each PDFPage takes up around 30mb+ of memory. This memory is not retuned when the loop moves to ther next page. with large enough PDF in can cause out of memory crash.At first I thought it was something in the loop holidng a reference. However when I dont run the loop, or attempt to save any of the PDFPage contents and simply swipe through the PDFPages of the PDF, the memory still goes up 30mb + per page. So my question is how to clear the previous page from memory when no longer the page in view?I would add code but seems you cant pste into here so jist know its basic PDFKit code to load a pdf url
4
0
2.6k
Feb ’18
URLRequest and gzip
From the Internet I read that URLRequest sends an Accept-Encoding header by default. I also read that URLSession auto decompresses any data that’s returned compressed. However these are what the internet says. I go to the Apple docs and read the URLSession & URLRequest sections but I can’t find where does it say that it sends the Accept-Encoding headers by default or that it auto decompresses compressed data. I know it does the latter as I am able to parse compressed data and have to do nothing to decompress. Just tell me where this stuff is documented by Apple so I can read about it.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
3.0k
Aug ’17