Post

Replies

Boosts

Views

Activity

SwiftUI: Show Modal Dialog from … anywhere?
Context: Authorized Network requests. I have a process (a publisher, to be precise), which will give me a fresh access token for a request. To do that, I may need user interaction, i.e. show a View, Alert, or something like that. How can I do that in SwiftUI? Can I just (modally) display something, without explicitly being in a View body? Should I have to pass in a "superview" to do this, or do you have other ideas? Thanks Alex
0
0
1.3k
Mar ’21
Loading an Image in an Widget View
Primary Objective My Widget displays pictures from a list. If I load in all the pictures when setting up the timeline, I run into a memory issue (EXC_RESOURCE RESOURCE_TYPE_MEMORY), because Widgets have a strict limit on how much memory they can use. My Solution Instead of storing a UIImage in my timeline entry, I store the URL to the picture, and load it with a .taskattached to the view. This works, when the view is displayed in the app, and is also shown in the Preview window. The Problem The image is apparently loaded, but not updated for the Widget. Not if running in the simulator or on device, or in the Preview canvas. The Question Obviously: Am I doing it wrong? Do I need to update my timeline more conservatively? Can I load the pictures on demand? Is there a different way of doing this? The Sample Sample code illustrating this can be found here: https://github.com/below/WidgetSample
0
0
2.1k
Oct ’22
Recording WKWebView
I am trying to record the requests and responses in a WKWebView, but instruments does not seem to record them. Is this to be expected? The webView is set to inspectable, and I am using the HTTP Traffic instrument. All the requests the app is doing are recorded, but neither the original request for the webView, nor subsequent traffic is recorded. When I use Safari to inspect the webView, all I see is the last page (even when I start the inspector before the first request is made). How can I see these requests?
0
0
115
May ’25