iOS/macOS
iOS/macOS runtime for Rive
Last updated
iOS/macOS runtime for Rive
Last updated
This article is out of date! Find the new version here.
This guide documents how to get started using the iOS/macOS runtime library. Rive runtime libraries are open-source. The source is available in its GitHub repository. This library contains an API for iOS/macOS apps to easily integrate their Rive assets for both UIKit/AppKit and SwiftUI. The runtime can also be installed via Cocoapods or Swift Package Manager.
The minimum iOS target is 14.0, and the target for macOS is 13.1
Note: macOS runtime support is included in v4.0.1+
You can run our iOS/macOS example app from the Rive GitHub repository.
Open the Example-iOS
app in XCode and be sure to select the Preview (iOS)
or Preview (macOS)
scheme. The other schemes are for development purposes and require additional configuration, see CONTRIBUTING.MD.
Follow the steps below for a quick start on integrating Rive into your iOS/macOS app.
Add the following to your Podspec file:
To install via Swift Package Manager, in the package finder in Xcode, search for rive-ios
or the full Github path: https://github.com/rive-app/rive-ios
Add the following to the top of your file where you utilize the Rive runtime:
In Rive iOS runtimes of versions 2.x.x or later, the primary object you'll use is a RiveViewModel
. It is responsible for creating and interacting with Rive assets.
Set up RiveViewModel w/ View
In the above example, you reference the name of a .riv
asset bundled into your application, but you can also load in a .riv
file hosted on a remote URL like so:
The simplest way of adding Rive to a controller using Storyboards is to make a RiveViewModel
, and set its view to be the RiveView
you made in the Storyboard.
You can also add Rive to a controller purely with code by making the RiveViewModel
, telling it to create a fresh RiveView
and then adding it to the view hierarchy.
See subsequent runtime pages to learn how to control animation playback, state machines, and more.
Github: https://github.com/rive-app/rive-ios Examples:
Free course from Meng To: https://designcode.io/swiftui-rive