SwiftUI Tutorial – How to create a Loading/Activity Animations in Xcode 12 Part 2

AnthonyDesignCode
3 min readFeb 17, 2021

--

Welcome to a new SwiftUI tutorial. We are going to be creating some simple loading animations over the next few weeks we are going to to creating five activity animations using SwiftUI 2.0 in Xcode 12.

Let’s get started 👍

Before we start we are going to be continuing for the last tutorial. We are going to be working from the same Xcode project we started so let’s go ahead and open that up. As you can see we have created an awesome timer animation, if you haven’t seen that tutorial yet I will be putting a Link at the end.

Before we start with our second animation we are going to edit the padding on the first animation. We are going to bring it up more from the bottom.

Now we have moved that up we are going to create a new Section.

We are going to be using a RoundedRectangle shape for this animation.

Now we have created the shape we are going to give this a fill and a frame.

In the last tutorial we created a private State var called shouldAnimate we are going to use an offset to change the value of the shapes position on the view.

Now we are going to add the animation.

One more thing we need to add before we give this a run. We are going to use .onAppear to toggle this animation to true.

Now we just need to add some padding to the bottom to move this up.

Conclusion 👏

Dope, we have now finished this tutorial on how to create a simple activity animation Part 2 using Xcode 12. We have learnt how to use a Section, .onAppear and much more. With this knowledge you should be able to create some awesome animations.

Here is the link to Part 1

If you would like the whole source code of this tutorial GitHub

I hope you have enjoyed this tutorial! If you want to learn more about SwiftUI and Neumorphism Design, check out my YouTube channel for other dope SwiftUI tutorials. Also make sure to keep yourself up to date with our upcoming tutorials on Instagram

Thank you for reading this content.

--

--

AnthonyDesignCode
AnthonyDesignCode

Written by AnthonyDesignCode

Hey 👋 I’m Anthony! I hope you are well?! Thank you for looking at my blog. Here you will learn how to make apps in SwiftUI for iOS 16! Thanks for reading.

No responses yet