Handling asset loading when using webURL
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.
Can you try an alternate method of initialization? It's a bit more verbose, but you can try RiveFile -> RiveModel -> RiveViewModel.
-
RiveFile(httpUrl:,loadCdn ,customAssetLoader:,with:) -
RiveModel(riveFile:)using the file from above -
RiveViewModel(_:)using the model from above
You should then be able to use the custom asset loader with a web URL.
Great this answers my question.
Is there plans in the future to make this a convenience init in the future for RiveViewModel?
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.