Book Image

Animating SwiftUI Applications

By : Stephen DeStefano
Book Image

Animating SwiftUI Applications

By: Stephen DeStefano

Overview of this book

Swift and SwiftUI are the backbone of Apple application development, making them a crucial skill set to learn. Animating SwiftUI Applications focuses on the creation of stunning animations, making you proficient in this declarative language and employing a minimal code approach. In this book, you'll start by exploring the fundamentals of SwiftUI and animation, before jumping into various projects that will cement these skills in practice. You will explore some simple projects, like animating circles, creating color spectrums with hueRotation, animating individual parts of an image, as well as combining multiple views together to produce dynamic creations. The book will then transition into more advanced animation projects that employ the GeometryReader, which helps align your animations across different devices, as well as creating word and color games. Finally, you will learn how to integrate the SpriteKit framework into our SwiftUI code to create scenes with wind, fire, rain, and or snow scene, along with adding physics, gravity, collisions, and particle emitters to your animations. By the end of this book, you’ll have created a number of different animation projects, and will have gained a deep understanding of SwiftUI that can be used for your own creations.
Table of Contents (18 chapters)

Exploring the Fundamentals of SwiftUI

Welcome to Animating SwiftUI Applications! If you picked up this book, then there’s a good chance you are a developer – or aspiring to be one – and you want to learn more about SwiftUI animations. Or maybe you’re fascinated by animations and how they work like I am. I know for me that the first time I played a video game (before the home computer was even available) and saw objects collide and bounce off each other on the screen, I was hooked by animations and the code behind how they worked. Whatever the reason you’re here though, together we will explore the amazing things we can make happen on an Apple device by leveraging the power of SwiftUI’s animation classes, methods, and properties.

This chapter starts with a brief look at the two programming styles, imperative and declarative, and will give you an idea of why Apple introduced the declarative SwiftUI way of coding to the development world. Then...