Supporting updatable assets

How often have you wanted to change some small setting in your application? In most apps, there are things you want to be able to tweak without generating a new build and getting it through the Apple approval process:

  • Configurations for experimental features, e.g., we use this at The Browser Company a lot.
  • Policy and reference links, e.g., need to update because you are changing a domain?
  • Small Javascript snippets to apply some logic, e.g., we use this at The New York Times to filter out some analytics events before they hit the server.
Remote Asset Manager in action


I always start my work with requirements and expected behaviors:

  • The app will always start with the bundled resource
  • If valid, we'll replace the bundled resource with a remote one
  • If the app version changes, we replace the cached resource with a new bundled one
  • In development mode, we want real-time updates
  • We want to build an expressive API
  • Easy testability

The basic creation of the manager will look like this:

  bundle: Bundle.main.url(forResource: "Icon", withExtension: "png"),
  remote: URL(fileURLWithPath: "/Users/merowing/Downloads/Icon.png"),
  materialize: .image.swiftUI
  dataProvider: .dataTask(.shared).autoRefresh(interval: 60.fps)

But we'll make it even nicer with a shared repository model:

struct ContentView: View {
    private var remoteImage = RemoteAsset.icon.manager

    var body: some View {

This post is for paying subscribers only

Sign up now to read this article and get access to all premium posts.
Already have an account? Sign In

You've successfully subscribed to Krzysztof Zabłocki
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.