feat: experimental iOS API support (getEnums via SPM)#134
Draft
feat: experimental iOS API support (getEnums via SPM)#134
Conversation
491c96b to
95816cf
Compare
Add RiveFile.getEnums() to retrieve enum definitions from Rive files. iOS uses the new experimental API (RiveRuntime 6.15.0 via SPM), Android uses existing File.enums property. Conditional compilation ensures it builds with both SPM and CocoaPods. Set USE_RIVE_SPM=1 with pod install to enable.
95816cf to
4fe9e12
Compare
Adds new experimental iOS backend (ios/new/) using RiveRuntime's Worker + CommandQueue architecture. Converts RiveFile, ViewModel, and property APIs to async to support the experimental iOS API's thread-safe command queue. Updates hooks and example app accordingly.
- Convert all Promise-based APIs to sync (properties, viewModel methods, file queries) - Add blockingAsync main-thread precondition guard - Fix Color property Int32 overflow crash in experimental backend - Add CommandQueue teardown crash documentation Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
| override fun getEnums(): Array<RiveEnumDefinition> { | ||
| val file = riveFile ?: return emptyArray() | ||
| return try { | ||
| file.enums.map { enum -> |
Contributor
There was a problem hiding this comment.
🚫 [ktlint] standard:chain-method-continuation reported by reviewdog 🐶
Expected newline before '.'
- Wrap valueStream iteration in retry loop for all property types - Restore TestComponentOverlay removed by mistake - Fix React Compiler catch variable bug in TestsPage - Add missingData upstream issue doc Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
blockingAsynchelper to bridge async rive-ios API to sync interfacePromise.async {}wrappers (underlying SDK is already sync)useViewModelInstance,useRiveProperty) — no moreuseState+useEffectfor async loadingvaluegetter/setter instead ofgetValue()/setValue()Usage
Without the flag, the legacy (CocoaPods) backend is used.
Known Issues (experimental iOS runtime)
Use-after-free crash on navigation back
After interacting with a view (e.g. pressing "update label" in MenuList), pressing back causes a crash in
rive::CommandQueue::processMessages:This is a use-after-free in the Rive C++ engine — the CADisplayLink fires after the Worker/ViewModelInstance have been deallocated. The command queue needs to be drained or the display link invalidated before teardown. This is upstream in rive-ios, not fixable on our side.
See
docs/commandqueue-crash-on-teardown.mdfor full repro.valueStream throws
missingDataon empty nested propertySetting a nested ViewModel string property to
""causesvalueStreamto throwmissingData, killing the listener permanently. Empty string is a valid value and should not be treated as missing data. We work around this by restarting the stream on error.See
docs/valuestream-missingdata-on-empty-string.mdfor full repro.