diff --git a/ActivityIndicatorView.podspec b/ActivityIndicatorView.podspec index 3f61679..af35c49 100644 --- a/ActivityIndicatorView.podspec +++ b/ActivityIndicatorView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ActivityIndicatorView" - s.version = "0.0.2" + s.version = "0.0.3" s.summary = "A number of preset loading indicators created with SwiftUI." s.homepage = 'https://github.com/exyte/ActivityIndicatorView.git' diff --git a/Example/Example.xcworkspace/contents.xcworkspacedata b/Example/Example.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a37cf19 --- /dev/null +++ b/Example/Example.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..084d6d7 --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,16 @@ +PODS: + - ActivityIndicatorView (0.0.2) + +DEPENDENCIES: + - ActivityIndicatorView (from `../`) + +EXTERNAL SOURCES: + ActivityIndicatorView: + :path: "../" + +SPEC CHECKSUMS: + ActivityIndicatorView: 49aa5a93650b19783fc47a7d15961eb6f2d72b7e + +PODFILE CHECKSUM: 54898b444f2a064d09ec9574815fb481a733ffec + +COCOAPODS: 1.9.1 diff --git a/Source/ActivityIndicatorView.swift b/Source/ActivityIndicatorView.swift index 687c059..bd701a6 100644 --- a/Source/ActivityIndicatorView.swift +++ b/Source/ActivityIndicatorView.swift @@ -124,20 +124,26 @@ public struct ActivityIndicatorView: View { } func createRotatingDotsIndicator() -> AnyView { - AnyView(GeometryReader { (geometry: GeometryProxy) in + + func createSmallCircle(_ size: CGSize, _ index: Int) -> some View { + return Circle() + .frame(width: size.width / 5, height: size.height / 5) + .scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 5 : 0.2 + CGFloat(index) / 5) + .offset(y: size.width / 10 - size.height / 2) + } + + let indicator = GeometryReader { (geometry: GeometryProxy) in ForEach(0..<5) { index in Group { - Circle() - .frame(width: geometry.size.width / 5, height: geometry.size.height / 5) - .scaleEffect(!self.isAnimating ? 1 - CGFloat(index) / 5 : 0.2 + CGFloat(index) / 5) - .offset(y: geometry.size.width / 10 - geometry.size.height / 2) + createSmallCircle(geometry.size, index) }.frame(width: geometry.size.width, height: geometry.size.height) .rotationEffect(!self.isAnimating ? .degrees(0) : .degrees(360)) .animation(Animation .timingCurve(0.5, 0.15 + Double(index) / 5, 0.25, 1, duration: 1.5) .repeatForever(autoreverses: false)) } - }) + } + return AnyView(indicator) } func createFlickeringDotsIndicator() -> AnyView {