From a66b82adc170ee347df697daf3addfa8bab52203 Mon Sep 17 00:00:00 2001 From: jeffgrann Date: Mon, 10 Jan 2022 18:02:35 -0500 Subject: [PATCH] Fixes for iOS 15 animation. Issue: https://github.com/maustinstar/liquid/issues/8#issue-1028423549 --- .../PrivateViews/LiquidCircleView.swift | 48 ++++++++++--------- .../Liquid/PrivateViews/LiquidPathView.swift | 17 +++---- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/Sources/Liquid/PrivateViews/LiquidCircleView.swift b/Sources/Liquid/PrivateViews/LiquidCircleView.swift index c97576f..40e127e 100644 --- a/Sources/Liquid/PrivateViews/LiquidCircleView.swift +++ b/Sources/Liquid/PrivateViews/LiquidCircleView.swift @@ -1,6 +1,6 @@ // // LiquidCircleView.swift -// +// // // Created by Michael Verges on 8/17/20. // @@ -19,25 +19,20 @@ struct LiquidCircleView: View { self._samples = .init(initialValue: samples) self._radians = .init(initialValue: AnimatableArray(LiquidCircleView.generateRadial(samples))) self.period = period - - startTimer() } - + var body: some View { LiquidCircle(radians: radians) - .animation(.linear(duration: period)) .onAppear { - self.radians = AnimatableArray(LiquidCircleView.generateRadial(self.samples)) - - self.startTimer() + startTimer() } .onDisappear { - self.stopTimer() + stopTimer() } } - + static func generateRadial(_ count: Int = 6) -> [Double] { - + var radians: [Double] = [] let offset = Double.random(in: 0...(.pi / Double(count))) for i in 0..