WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

Share Default / Seed Data with Widget?

Forums > SwiftUI

I know that for a widget to access the same file as my iOS app, I need to create an App Group and use the shared location containerURL, yadda yadda yadda.

I have a file called bananas.data that is the seed data used by both the app and the widget extension. By default apps will simply look in the bundle for a file, but does that mean the first thing my app needs to do when launched is open the banana file and write it to the App Group containerURL location? That seems wildly inefficient.

Is there a way to bake the banana file directly into the shared App Group containerURL location at launch?

3      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.