Design+Code logo

Quick links

Suggested search

Meet Rive

Rive offers their own animation tool and give far more control for composing Artboards, animations and states thanks to their powerful editor and convenient SwiftUI Library, Android and Web libraries. Their tool works for Windows and Mac and you can collaborate in real-time with a team. Also, you can find, inspect and use hundreds of animated assets made by the Community.

Sponsored Course

This course is entirely free thanks to Rive. In this course, we’ll build an app from scratch in SwiftUI and focus on recreating popular animations such as backgrounds, tab bar, buttons, etc. We’ll also learn how to create our own animations using Figma and the Rive editor. The design and the source files are provided so that you can compare against your own progress.

Animated

Download Assets

To follow this course, you will need to download the Assets which include the Figma template, Xcode projects and Rive Assets.

Requirements

Compared to many frameworks, SwiftUI is easy to learn and has a ton of resources made by Apple and the community. Since my teaching style is friendly, focused on visuals and we'll code together step-by-step from a designer's perspective, you can learn with virtually zero experience. However, it is recommended that you are familiar with a computer and have light experience with HTML and CSS.

Developing an app for iOS 15 requires a Mac with Big Sur or later, and Xcode 13.

Figma Template

The full design is included with the text styles and components. Building an app while following a design is recommended to help understand the decisions behind each line of code. You can download the assets at the bottom of this page.

Screen Shot 2022-05-26 at 12.27.30 PM

Download Xcode

Xcode 13 is the application for building iOS apps and is required to follow this course. We’ll be using SwiftUI 3 and our deployment target will be iOS 15. To download, head to the Mac App Store and search for Xcode. Make sure to download and install the components.

Build an Animated App with Rive and SwiftUI image 3

Getting Started with Rive

Let’s start by creating a simple background animation with basic shapes. While this can be done directly in code, the advantage of using Rive is to ability to decouple the animation process and let designers focus on the tool rather than editing the code. You can create a free account which, similar to Figma, gives you all the features minus team collaboration.

Build an Animated App with Rive and SwiftUI image 4

Rive Assets

Another key advantage with Rive is being able to use community-made assets. For general assets like icons and loading animations that are not usually custom-made, you can browse the Community.

Build an Animated App with Rive and SwiftUI image 5

Here are a few animated icon sets and loaders that stand out:

Icons

Loaders

Progress

Multiple Artboards

Rive gives you the ability to select multiple Artboards from a single animated asset. As a result, you can have your entire library of icons in a single file.

Build an Animated App with Rive and SwiftUI image 6

In SwiftUI, set the filename as resource and specify Artboard name.

RiveViewModel(fileName: "icons", artboardName: "HOME").view()
	.background(.blue)

Play Animations

For each Artboard, you can create multiple animations like error and success.

Build an Animated App with Rive and SwiftUI image 7

In SwiftUI, each animation can be specified by name.

RiveViewModel(fileName: "check", artboardName: "check_artboard", animationName: "Check").view()

State Machine

Rive really shines when it comes to using states. You can compose the flow of your animations and switch seamlessly. Not only can you switch between true or false but you can also input a number.

Build an Animated App with Rive and SwiftUI image 8

In this code, we’re setting the View Model so that we can update the number of rooms for the house. It will animate according to the rooms state.

let animation = RiveViewModel(fileName: "house", stateMachineName: "State Machine 1")
@State var rooms: Float = 3

var body: some View {
    animation.view()
        .onAppear {
            try? animation.setInput("Rooms", value: rooms)
        }
}

You can use a Stepper to make it more interactive. Please note that this demo only works in the Simulator.

let animation = RiveViewModel(fileName: "house", stateMachineName: "State Machine 1")
@State var rooms: Float = 3

var body: some View {
    VStack {
        Stepper(value: $rooms, in: 3...6) {
            Text(String(format: "%.0f", rooms))
        }
        .padding(20)

        animation.view()
    }
    .onChange(of: rooms) { newValue in
        changeValue()
    }
    .onAppear {
        changeValue()
    }
}

func changeValue() {
    try? animation.setInput("Rooms", value: rooms)
}

Create an Xcode Project

After installing Xcode, create a new project. Select App , set the name to Animated with your domain name in reverse for the organization identifier and Interface to SwiftUI . Click Next.

Build an Animated App with Rive and SwiftUI image 9

Assets Catalog

Go to the Assets Catalog and delete the existing AppIcon and AccentColor . Then, go to the Assets folder from the source files provided and drag and drop all the folders.

Build an Animated App with Rive and SwiftUI image 10

Import Rive Assets

For the animated assets, we’ll drag and drop the folder RiveAssets comprised of files in .riv format to the left Navigator panel, next to Assets . Make sure to enable Copy items if needed , create groups and Add to targets checked.

Build an Animated App with Rive and SwiftUI image 11

Import Rive SPM Library

Rive has a library that fully supports SwiftUI. You won’t even to bridge using UIViewRepresentable since it’s already part of the library, making the usage a breeze. To install, go to FileAdd Packages . In the window, paste the following link to the top right URL input.

https://github.com/rive-app/rive-ios

Click on Add Package , then Add Package again in the subsequent window.

Build an Animated App with Rive and SwiftUI image 12

Using Animated Assets

Once the Rive library is installed, import RiveRunTime whenever you need it. Let’s create a new file OnboardingView.

import RiveRuntime

With this, you’ll be able to set the animation view and you can treat it just like any other view. Let’s start with the shapes file. Since we’re rendering a view, make sure to add .view() to RiveViewModel . Then, adjust the size, safe area, blur and background.

RiveViewModel(fileName: "shapes").view()
    .ignoresSafeArea()
    .blur(radius: 30)
    .background(
        Image("Spline")
            .blur(radius: 50)
            .offset(x: 200, y: 100)
    )

To see the animation in action, click Play on your Preview. That’s it! Note that the animation timing should be edited in the Rive editor.

READ NEXT

Background Animation in Rive

Templates and source code

Download source files

Download the videos and assets to refer and learn offline without interuption.

check

Design template

check

Source code for all sections

check

Video files, ePub and subtitles

Subtitles

Assets

Videos

1

Build an Animated App with Rive and SwiftUI

Design and code an iOS app with Rive animated assets, icon animations, custom layouts and interactions

9:55

2

Background Animation in Rive

Create a simple animation in Rive from scratch using SVG shapes

8:23

3

Button Animation in Rive

Create a simple button animation with timing and clipping in Rive and SwiftUI

10:52

4

Custom Fonts

Create dynamic text styles using custom fonts in your iOS app

14:39

5

Custom Modal

Create a login modal with reusable custom text fields and a divider

12:54

6

Modal Transition

Code a button with specific rounded corners, hex color values and a dismiss modal animation

12:15

7

Loading and Success Animation

Add Rive loading and confetti animations with state machine to the modal view after button action

13:05

8

Tab Bar Animated Icons

Create a tab bar with multiple icon animations using loop and data model

9:15

9

Tab Bar Selection

Add a selected tab bar animation using Enum and AppStorage

7:14

10

Icon Animation in Rive

Design an animated hamburger menu with Rive State Machine that transitions to a close button

13:44

11

Layout and Card Components

Create a simple layout with card components and horizontal and vertical scrolls

18:03

12

Side Menu Animated Icons

Create a side menu with multiple Rive animated icons

10:47

13

Side Menu Selection

Animate the list item background during a tap gesture and add more lists and a toggle

10:32

14

Side Menu Animation

Animate the side menu from a hamburger menu using 3D transform

6:52

15

Main View Animation

Animate the onboarding view, status bar and tab bar gradient mask

15:22

Meet the instructor

We all try to be consistent with our way of teaching step-by-step, providing source files and prioritizing design in our courses.

Meng To

I design, code and write

Meng To is the author of Design+Code. Meng started off his career as a self-taught designer from Montreal and eventually traveled around the world for 2 years as his US VISA was denied. During his travels, he wrote a book which now has 35,000 readers.

icon

39 courses - 184 hours

course logo

Build SwiftUI apps for iOS 18 with Cursor and Xcode

In this course, we'll explore the exciting new features of SwiftUI 6 and Xcode 16 for building iOS 18 apps. From mesh gradients and text animations to ripple effects, you'll learn how to create polished, highly custom apps using the latest workflows. We'll also dive into using Cursor and Claude AI for AI-driven coding, helping you start strong and customize your apps.

5 hrs

course logo

Create your Dream Apps with Cursor and Claude AI

Learn to build your dream web apps from the ground up using Cursor, Claude AI, and a suite of powerful AI tools. This course covers everything you need, including React for frontend development, Firebase for backend integration, and Stripe for handling payments. You’ll also dive into advanced AI tools like Claude Artifacts, Galileo AI, v0.dev for UI, Ideogram for design generation, and Cursor Composer for full-scale development.

6 hrs

course logo

Build a React Site from Figma to Codux

In this course, you'll learn to build a website from scratch using Codux, starting with a Figma template. You’ll master responsive design, collaborate with developers on a real React project, export CSS from Figma using Locofy, set up breakpoints with media queries, add CSS animations, improve SEO, create multiple pages with React Router, and publish your site. By following best practices, you’ll bridge design and development, improve your web design skills.

2 hrs

course logo

Create 3D UI for iOS and visionOS in Spline

Comprehensive 3D Design Course: From Basics to Advanced Techniques for iOS and visionOS using SwiftUI

3 hrs

course logo

Master No-Code Web Design with Framer

In this free Framer course, you'll learn to create modern, user-friendly interfaces. Start with dark mode and glass designs, then move from Figma to Framer, using vectors and auto layout for responsive websites. Add animations, interactive buttons, and custom components with code. Finally, you'll craft a design system suitable for teamwork or solo projects, all in a straightforward and practical approach.

4 hrs

course logo

Build SwiftUI Apps for iOS 17

In this course, we’ll be exploring the fresh and exciting features of SwiftUI 5! As we craft a variety of iOS apps from the ground up, we'll delve deep into the treasure trove that is SwiftUI's user interface, interactions, and animations.

4 hrs

course logo

Build Beautiful Apps with GPT-4 and Midjourney

Design and develop apps using GPT-4 and Midjourney with prompts for SwiftUI, React, CSS, app concepts, icons, and copywriting

4 hrs

course logo

Build SwiftUI apps for iOS 16

Create animated and interactive apps using new iOS 16 techniques using SwiftUI 4 and Xcode 14

5 hrs

course logo

Build a 3D Site Without Code with Framer

Design and publish a responsive site with 3D animation without writing a single line of code

3 hrs

course logo

Create 3D Site with Spline and React

Design and code a landing page with an interactive 3D asset using Spline and CodeSandbox

1 hrs

course logo

Build an Animated App with Rive and SwiftUI

Design and code an iOS app with Rive animated assets, icon animations, custom layouts and interactions

3 hrs

course logo

Build a SwiftUI app for iOS 15 Part 3

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

Build a SwiftUI app for iOS 15 Part 2

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

3 hrs

course logo

Build a SwiftUI app for iOS 15

Design and code a SwiftUI 3 app with custom layouts, animations and gestures using Xcode 13, SF Symbols 3, Canvas, Concurrency, Searchable and a whole lot more

4 hrs

course logo

React Livestreams

Learn how we can use React Hooks to build web apps using libraries, tools, apis and frameworks

4 hrs

course logo

Design Founder Livestreams

A journey on how we built DesignCode covering product design, management, analytics, revenue and a good dose of learning from our successes and failures

2 hrs

course logo

SwiftUI Advanced Handbook

An extensive series of tutorials covering advanced topics related to SwiftUI, with a main focus on backend and logic to take your SwiftUI skills to the next level

4 hrs

course logo

iOS Design Handbook

A complete guide to designing for iOS 14 with videos, examples and design files

2 hrs

course logo

SwiftUI Handbook

A comprehensive series of tutorials covering Xcode, SwiftUI and all the layout and development techniques

7 hrs

course logo

Build a web app with React Hooks

Learn how we built the new Design+Code site with React Hooks using Gatsby, Netlify, and advanced CSS techniques with Styled Components.

4 hrs

course logo

UI Design Handbook

A comprehensive guide to the best tips and tricks for UI design. Free tutorials for learning user interface design.

2 hrs

course logo

Figma Handbook

A comprehensive guide to the best tips and tricks in Figma

6 hrs

course logo

SwiftUI for iOS 14

Build a multi-platform app from scratch using the new techniques in iOS 14. We'll use the Sidebar and Lazy Grids to make the layout adaptive for iOS, iPadOS, macOS Big Sur and we'll learn the new Matched Geometry Effect to create beautiful transitions between screens without the complexity. This course is beginner-friendly and is taught step-by-step in a video format.

3 hrs

course logo

SwiftUI Livestreams

This is a compilation of the SwiftUI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

19 hrs

course logo

UI Design Livestreams

This is a compilation of the UI live streams hosted by Meng. Over there he talks and teaches how to use design systems, typography, navigation, iOS 14 Design, prototyping, animation and Developer Handoff.

26 hrs

course logo

UI Design for Developers

In this course we'll learn how to use design systems, set up break points, typography, spacing, navigation, size rules for adapting to the iPad, mobile and web versions, and different techniques that translate well from design to code.

3 hrs

course logo

Build an app with SwiftUI Part 3

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build an app with SwiftUI Part 2

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

Build a full site in Webflow

Webflow is a design tool that can build production-ready experiences without code. You can implement CSS-driven adaptive layouts, build complex interactions and deploy all in one tool. Webflow also comes with a built-in content management system (CMS) and Ecommerce for creating a purchase experience without the need of third-party tools.

3 hrs

course logo

Advanced Prototyping in ProtoPie

ProtoPie is a cross-platform prototyping tool that creates prototypes nearly as powerful as those made with code, with half of the efforts, and zero code. It's perfect for designers who want to quickly experiment with advanced interactions using variables, conditions, sensors and more.

3 hrs

course logo

Build an app with SwiftUI Part 1

This course was written for designers and developers who are passionate about design and about building real apps for iOS, iPadOS, macOS, tvOS and watchOS. SwiftUI works across all of those platforms. While the code is not a one-size-fits-all, the controls and techniques involved can apply to all platforms. It is beginner-friendly, but it is also packed with design tricks and cool workflows about building the best UIs and interactions.

4 hrs

course logo

React Native for Designers Part 2

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

3 hrs

course logo

React Native for Designers

React Native is a popular Javascript framework that builds on top of React by using native components to create a real mobile app indistinguishable from one made using Xcode or Android Studio. The main difference with native development is that you get to use CSS, hot-reload, Javascript and other familiar techniques that the Web has grown over the past decades. Most importantly, you're building for both iOS and Android using the same codebase.

5 hrs

course logo

Design System in Figma

Learn how to use and design a collaborative and powerful design system in Figma. Design Systems provide a shared library of reusable components and guidelines and that will let you build products much faster

3 hrs

course logo

React for Designers

Learn how to build a modern site using React and the most efficient libraries to get your site/product online. Get familiar with Grid CSS, animations, interactions, dynamic data with Contentful and deploying your site with Netlify.

3 hrs

course logo

Swift Advanced

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

9 hrs

course logo

Learn Swift

Learn Swift a robust and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch

4 hrs

course logo

Learn Sketch

Learn Sketch a design tool entirely vector-based and focused on user interface design

5 hrs

course logo

Learn iOS 11 Design

Learn colors, typography and layout for iOS 8

1 hrs