Overview

Specify a renderer to use at runtime

Rive makes use of various different renderers depending on platform and runtime. We're working towards unifying the default renderer used across all platforms/runtimes with the Rive Renderer, which is now available on iOS, Android, Rive GameKit, and on Web (JS) on Google Chrome (with WebGL draft extensions enabled).

Renderer Options and Default

You can opt-in to use a specific renderer, see Specifying a Renderer.

The table below outlines the available, and default, renderers for Rive's runtimes:

Runtime

Renderer

Options

Android

Skia

Rive / Skia

iOS

Skia

Rive / Skia

React Native

Skia

Skia

Web (Canvas)

Canvas2D

Canvas2D

Web (WebGL)

Skia

Skia

Web (WebGL2)

Rive

Rive

Flutter

Skia (other), Impeller (iOS)

Skia / Impeller

Note on Rendering in Flutter

Starting in Flutter v3.10, Impeller has replaced Skia to become the default renderer for apps on the iOS platform and may continue to be the default on future platforms over time. As such, there is a possibility of rendering and performance discrepancies when using the rive Flutter runtime with platforms that use the Impeller renderer that may not have surfaced before. If you encounter any visual or performance errors at runtime compared to expected behavior in the Rive editor, we recommend trying the following steps to triage:

  1. Try running the Flutter app with the --no-enable-impeller flag to use the Skia renderer. If the visual discrepancy does not show when using Skia, it may be a rendering bug on Impeller. However, before raising a bug with the Flutter team, try the second point below👇

flutter run --no-enable-impeller
  1. Try running the Flutter app on the latest master channel. It is possible that visual bugs may be resolved on the latest Flutter commits, but not yet released in the beta or stable channel.

  2. If you are still seeing visual discrepancies with just the Impeller renderer on the latest master branch, we recommend raising a detailed issue to the Flutter Github repo with a reproducible example, and other relevant details that can help the team debug any possible issues that may be present.

Rive Renderer

The Rive Renderer is now available on Android and iOS. See Specifying a Renderer to set it as your preferred renderer.

While it's ready for testing and your feedback is highly valued during this phase, we advise exercising caution before considering it for production builds. You may encounter compatibility issues with certain devices. Please reach out to us on Discord or through our Support Channel.

Your collaboration helps us refine and enhance the Rive Renderer to make it more robust and reliable for broader applications. Thank you for being a part of this exciting journey!

By default, both Android and iOS will use the current Skia renderer.

Starting Version

The Rive Renderer was introduced in the iOS runtime starting at v5.3.2, however, we recommend installing the latest version of the dependency to get the latest updates. See the CHANGELOG for details on the latest versions.

At this time, the Rive Renderer is not supported in simulator environments, and can only be tested on physical devices. Configuring the .riveRenderer on your project while running on the iOS simulator may use a Core Graphics (CG) renderer as a fallback, which should support all Rive features.

Also note that at this time, only Apple Silicon-based Mac machines will support the Rive Renderer in macOS applications.

Performance

The Rive Renderer will shine best on iOS in memory usage as an animation plays out, in comparison to previous default renderers.

With UIKit, you'll be able to see the best performance differences by drawing multiple times on a single RiveView, rather than creating multiple instances of RiveView's, or multiple RiveViewModel's.

Example: See this stress test example to see how you can override the drawing function on RiveView to draw multiple times on the same view, with each graphic at an offset. You can switch out the renderer with the above config and test out the performance for yourself!

Specifying a Renderer

See below for runtime instructions to enable a specific renderer.

Getting Started

Options: Rive / Skia (default)

Below are some notes on configuring the renderer in UIKit and SwiftUI.

UIKit

Set the global renderer type during your application launch:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        // For Skia: set RendererType.skiaRenderer (current default)
        RenderContextManager.shared().defaultRenderer = RendererType.riveRenderer
        return true
    }

    ...
}

SwiftUI

New SwiftUI applications launch with the App protocol, but you can still add UIApplicationDelegate functionality.

iOS

Create a new file and class called AppDelegate as such, including a line to set the defaultRenderer to RendererType.riveRenderer:

import UIKit
import Foundation
import RiveRuntime

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        RenderContextManager.shared().defaultRenderer = RendererType.riveRenderer
        return true
    }
}

Next, at the entry point of your application, use UIApplicationDelegateAdaptor to set the AppDelegate created above for the application delegate.

@main
struct MyRiveRendererApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

macOS

Create a new file and class called AppDelegate as such, including a line to set the defaultRenderer to RendererType.riveRenderer:

import Foundation
import RiveRuntime

class AppDelegate: NSObject, NSApplicationDelegate {
    func application(_ application: NSApplication, applicationDidFinishLaunching notification: Notification) -> Bool {
        RenderContextManager.shared().defaultRenderer = RendererType.riveRenderer
        return true

Next, at the entry point of your application, use UIApplicationDelegateAdaptor to set the AppDelegate created above for the application delegate.

@main
struct MyRiveRendererApp: App {
    @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}