Post

Replies

Boosts

Views

Activity

Reply to UISceneActivationConditions and UIApplicationShortcutItem
UIApplicationShortcutItem works like NSArray in that they both immutable but provide mutable subclasses (ie UIMutableApplicationShortcutItem and NSMutableArray). Therefore if you want to set the targetContentIdentifier for a shortcut item you have to do something like the following: let shortcutItem = UIMutableApplicationShortcutItem(type: "com.myapp.shortcut", localizedTitle: "Shortcut") shortcutItem.targetContentIdentifier = "myapp://shortcut" UIApplication.shared.shortcutItems = [shortcutItem]
Feb ’22
Reply to Widget is crashing with 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=30 MB, unused=0x0)
The crash means you're going over the memory limit for widget extensions, which is currently 30MB as you can see from the error message. It's pretty easy to hit this limit, especially if you're working with images. Some things you can try are: downloading the images directly to the file system and passing around their URLs resizing large images to 46x46/61x61 before they're displayed
Sep ’22
Reply to Widget is crashing with 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=30 MB, unused=0x0)
You should use URLSession to download the images in your timeline provider then pass the URLs to these files to your view. If you're still hitting the memory limit then resize them (for example using UIImage.preparingThumbnail(of:)) before displaying them in a view. Don't use Data(contentsOf:) to download anything from the internet. You also don't need to wrap your views in AnyView.
Sep ’22