This repository aims to provide a collection of SwiftUI templates that allow you to create various objects and animations in your iOS, iPadOS, or MacOS applications. You can use them however you like, and I will be adding some animations from time to time. If you wish, you can also enhance certain code snippets to make them visually more appealing or more descriptive. It's under the MIT license, so you're free to use this repository as you see fit. Enjoy and may the code be with you ๐ค
It's a simple menu that has an enum, to which we assign an id allowing to then use tags when images are used to click on a reaction defined in the picker. It is possible to modify the apnce of this picker via a separate view which will use a Binding.
Here it is a little more complex. We use three views and a model composed of a structure allowing to attribute the basic values โโto the future animation which will occur once the button is clicked. We then configure the buttons that will be created as well as their design in the "MainView" view. It is here that we also specify that we expect a tap on the button to trigger an animation. The one that will be created in the "Particule Effect" view. In the latter we provide x and y values โโto generate the animation flow that will spring from an x โโand y of the button when it is activated by the user. There is no need for any package or specific add-on to recreate this animation, it works as long as you use system images or configure personal ones, remembering to adapt the structure appropriately.
A page that allows images to be displayed via URL, via an asyncImage method available on SwiftUI. The user also has the option of clicking on each image to preview it at the maximum size of their screen.
This is a rather nice slider with a color gradient background, which allows you to choose an emotional state between sad, neutral, happy and very happy. It is of course possible to adapt it in many ways.
This time we start with an animated shape created directly with SwiftUI. The latter follows a breathing type pattern that will make the shape grow for a few seconds and then maintain this state before shrinking to indicate the inspiration and expiration that the user must perform. In addition to this, there is also a haptic feedback system emitting more vibrations when the shape grows, they are lighter when it shrinks. I left some Mark in the code to help you understand it better.
The slide is, as its name suggests, an image carousel very easy to implement and which offers a kind of reduction and extension of the width of an image when scrolling through the carousel. This is made possible thanks to several GeometryReaders.





