What this book covers
In Chapter 1, Exploring the Fundamentals of SwiftUI, you will receive a comprehensive overview of the two distinct programming styles: imperative and declarative. Then, we will delve into the Xcode interface, the free application provided by Apple, where all our development work will take place. Finally, we will examine the fundamental SwiftUI structures required for creating applications, laying the groundwork for advancing with animations.
In Chapter 2, Understanding Animation in SwiftUI, we will examine the mechanics of animations, covering essential topics such as timing curves and animatable properties. This will establish a solid foundation for the projects we will construct.
In Chapter 3, Creating a Breathing App, we will harness the power of SwiftUI’s user-friendly modifiers and design tools to effortlessly rotate, scale, and move views. Moreover, we will utilize the animation
modifier to smoothly interpolate between start and end values, producing a seamless animation.
In Chapter 4, Building a Record Player, we will incorporate images from the Asset Catalog into our code. Then, we will create standalone files for creating various views that can be seamlessly integrated into the main view for display. Furthermore, we will add a button to trigger the animation and incorporate sound into the project.
In Chapter 5, Animating Colorful Kaleidoscope Effects, we will explore the animation of colors using the hueRotation
modifier, where hue
pertains to the colors of the object and rotation
signifies the rotation or animation of these colors. We will construct a straightforward project that showcases various images, and then utilize hueRotation
to alter the color of the images, producing a kaleidoscope-like effect.
In Chapter 6, Animating a Girl on a Swing, we will investigate the process of cutting up images into separate parts, and then using code to animate these separate parts together in creative and unique ways. Additionally, we will utilize a new modifier, mask
, to help disguise and hide specific areas of our animation that we don’t want to see.
In Chapter 7, Building a Series of Belts and Gears, we will generate a “marching ants” effect by employing the stroke
modifier, and then examine how to neatly organize code using Pragma Marks and Groups. We will also animate objects along all three axes, x, y, and z, by utilizing the rotation3Deffect
modifier.
In Chapter 8, Animating a Flower, we will construct the illusion of a bouquet of flowers breathing through the use of modifiers such as blur
, scale
, and rotationEffect
. Additionally, we will examine the UIViewRepresentable
protocol and the CAEmitter
class to incorporate falling snow into the scene.
In Chapter 9, Animating Strokes around Shapes, we will delve into the process of converting bitmap images into vector files, and then transform these vector files into code that we can utilize in a SwiftUI project. Furthermore, we will animate a stroke around various shapes through the use of the stroke
modifier and timers.
In Chapter 10, Creating an Ocean Scene, we will utilize the Shape
protocol to craft an oceanic scene featuring undulating waves, a buoy that bobs in the water, a flashing light, and accompanying sounds.
In Chapter 11, Animating an Elevator, we will employ GeometryReader
and the proxy
constant to insert images into the project and position them appropriately. This will enable the images to be dynamically resized based on the device in use. Furthermore, we will create a DataModel
to store the app’s data and functions and make use of timers to activate doors and light animations at various points in the scene.
In Chapter 12, Creating a Word Game – Part 1, we will commence with the construction of a word-based game that allows players to input words to play using three different languages, with validations in place to verify their choices.
In Chapter 13, Creating a Word Game – Part 2, we will add the finishing touches to our word game by organizing its properties and functions within DataModel
and creating distinct header and footer views to display information to the user. Additionally, we will incorporate user feedback in three different forms: pop-up alerts, haptic feedback, and audio.
In Chapter 14, Creating a Color Game, we will develop an RGB color-matching game that keeps track of the score and displays a celebratory confetti animation upon the player achieving a perfect score. We will also examine the integration of Swift packages into the project.
In Chapter 15, Integrating SpriteKit into your SwiftUI Projects, we will create six separate projects that showcase SpriteKit and a variety of particle systems. We will learn how to blend realistic and fluid animations seamlessly with your SwiftUI code.