rive-ios icon indicating copy to clipboard operation
rive-ios copied to clipboard

Handling asset loading when using webURL

Open mikehobi opened this issue 6 months ago • 3 comments

Hello.

I'm testing out Rive features and trying to figure out how to load in referenced images and fonts into a web url hosted rive file

Currently, with embedded files I have:

RiveViewModel(fileName: "my-rive-file", autoPlay: false, loadCdn: false, customLoader: ContentView.loader);

But I see that customLoader is not a param when referencing a webURL:

RiveViewModel(webURL: "https://mycdn.com/files/my-rive-file.riv")

I see there is possibly a delegate that is passed to RiveModel from RiveViewModel. But I'm unsure of what the correct way to handle this is.

mikehobi avatar Jul 30 '25 20:07 mikehobi

Can you try an alternate method of initialization? It's a bit more verbose, but you can try RiveFile -> RiveModel -> RiveViewModel.

  1. RiveFile(httpUrl:,loadCdn ,customAssetLoader:,with:)
  2. RiveModel(riveFile:) using the file from above
  3. RiveViewModel(_:) using the model from above

You should then be able to use the custom asset loader with a web URL.

dskuza avatar Aug 05 '25 19:08 dskuza

Great this answers my question.

Is there plans in the future to make this a convenience init in the future for RiveViewModel?

mikehobi avatar Aug 12 '25 17:08 mikehobi

I can see about adding to the current API, but there will be an updated API in the coming months that should alleviate the multi-step inits.

dskuza avatar Aug 28 '25 19:08 dskuza