Submission checklist
Description
When registering out of bound assets, in the Legacy Runtime, we had more granular access to and could match against the name() of the asset.
For example, say I'm using Roboto as a custom font, I could then do the following:
let viewModel = RiveViewModel(fileName: "my_rive_file") { asset, _, factory in
if let fontAsset = asset as? RiveFontAsset {
guard fontAsset.name() == "Roboto" else { return false }
let decodedFont = factory.decodeFont(Data(...))
fontAsset.font(decodedFont)
return true
} else {
return false
}
}
In the New Runtime, we no longer have the same level of access to the underlying asset. So the above now translates into the following, where ideally I continue to register my asset by name:
let worker = try await WorkerProvider.shared.worker()
let font = try await worker.decodeFont(from: Data(...))
worker.addGlobalFontAsset(font, name: "Roboto")
This actually doesn't work, because, internally, Rive is now looking up and matching assets against uniqueName(), not name().
/rive-ios/submodules/rive-runtime/src/command_server.cpp
Line 64: auto itr = m_fontAssets.find(asset.uniqueName());
// Looks up "WeGoSansVariable-1234567" — NOT "Roboto
asset.uniqueName() is implemented as:
/rive-ios/submodules/rive-runtime/src/assets/
Line 27: std::string FileAsset::uniqueName() const
Line 30: std::string uniqueName = name(); // "Roboto"
Line 37: return uniqueName + "-" + std::to_string(assetId()); // "Roboto-1234567"
For out-of-bound assets like Fonts, ideally we can continue to match against the Font name(), rather than needing to know what the uniqueName() will be, as we can only currently get that when exporting the .riv file.
Previous working version
No response
Rive Apple runtime version
6.20.5
Reproduction steps / code
No response
Upload your reproduction files / stack trace
No response
Source .riv / .rev file
No response
Screenshots / video
No response
Device
iOS Simulator
Apple OS version
iOS 25.0
Additional context
No response
Submission checklist
RiveRuntimeDescription
When registering out of bound assets, in the Legacy Runtime, we had more granular access to and could match against the
name()of the asset.For example, say I'm using
Robotoas a custom font, I could then do the following:In the New Runtime, we no longer have the same level of access to the underlying asset. So the above now translates into the following, where ideally I continue to register my asset by name:
This actually doesn't work, because, internally, Rive is now looking up and matching assets against
uniqueName(), notname().asset.uniqueName()is implemented as:For out-of-bound assets like Fonts, ideally we can continue to match against the Font
name(), rather than needing to know what theuniqueName()will be, as we can only currently get that when exporting the .riv file.Previous working version
No response
Rive Apple runtime version
6.20.5
Reproduction steps / code
No response
Upload your reproduction files / stack trace
No response
Source
.riv/.revfileNo response
Screenshots / video
No response
Device
iOS Simulator
Apple OS version
iOS 25.0
Additional context
No response