From b7940e52aef870ac17040c1f012161c5169ce88f Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 21 Sep 2023 15:46:56 +1000 Subject: [PATCH] WIP: loading --- Session/Shared/LoadingIndicatorView.swift | 23 +++++++++---------- .../Style Guide/Themes/SwiftUI+Theme.swift | 7 ++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Session/Shared/LoadingIndicatorView.swift b/Session/Shared/LoadingIndicatorView.swift index 0db36e853..40558cc1f 100644 --- a/Session/Shared/LoadingIndicatorView.swift +++ b/Session/Shared/LoadingIndicatorView.swift @@ -7,26 +7,25 @@ public struct ActivityIndicator: View { public var body: some View { 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) - } + Circle() + .trim(from: 0, to: 0.9) + .stroke( + themeColor: .borderSeparator, + style: StrokeStyle( + lineWidth: 2, + lineCap: .round + ) + ) .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) + .timingCurve(0.5, 1, 0.25, 1, duration: 1.5) .repeatForever(autoreverses: false) ) - } } .aspectRatio(1, contentMode: .fit) .onAppear { diff --git a/SessionUIKit/Style Guide/Themes/SwiftUI+Theme.swift b/SessionUIKit/Style Guide/Themes/SwiftUI+Theme.swift index f92b3ec39..a087cba11 100644 --- a/SessionUIKit/Style Guide/Themes/SwiftUI+Theme.swift +++ b/SessionUIKit/Style Guide/Themes/SwiftUI+Theme.swift @@ -16,4 +16,11 @@ public extension Shape { ThemeManager.currentTheme.colorSwiftUI(for: themeColor) ?? Color.primary ) } + + func stroke(themeColor: ThemeValue, style: StrokeStyle) -> some View { + return self.stroke( + ThemeManager.currentTheme.colorSwiftUI(for: themeColor) ?? Color.primary, + style: style + ) + } }