// // ArcsIndicatorView.swift // ActivityIndicatorView // // Created by Daniil Manin on 10/7/20. // Copyright © 2020 Exyte. All rights reserved. // import SwiftUI struct ArcsIndicatorView: View { private let count: Int = 3 var body: some View { GeometryReader { geometry in ForEach(0.. Path in var p = Path() p.addArc(center: CGPoint(x: self.size.width / 2, y: self.size.height / 2), radius: self.size.width / 2 - CGFloat(self.index) * CGFloat(self.count), startAngle: .degrees(0), endAngle: .degrees(Double(Int.random(in: 120...300))), clockwise: true) return p.strokedPath(.init(lineWidth: 2)) } .frame(width: size.width, height: size.height) .rotationEffect(.degrees(rotation)) .onAppear { self.rotation = 0 DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) { withAnimation(animation) { self.rotation = 360 } } } } }