To create a spinner in SwiftUI, you can use the built-in ProgressView element with some customization to make it look like a spinner.
Here is an example code snippet that you can use to create a spinning animation:
main.swift824 chars30 linesThis code creates a Circle with a gradient stroke that fills 70% of the circle's circumference. It then rotates the circle with an animation that repeats forever. The text "Loading..." is positioned above the circle.
To start the animation, we set the isAnimating state variable to true in the onAppear closure of the VStack.
gistlibby LogSnag