ios – SwiftUI animation stops working after toggle Settings->Accessibility->Show & Textual content Measurement->Button Shapes


I’ve an issue with SwiftUI animation of a Button label. The issue is that after I alter the ‘Button Shapes’ accessibility setting from the iOS settings menu (Settings->Accessibility->Show & Textual content Measurement->Button Shapes), the animation stops working till I kill the appliance and begin it once more.

For instance and proof, I add the next code:

import SwiftUI

struct ContentView: View {
    @State personal var animAmount = 1.0
    
    var physique: some View {
        VStack {
            Button(motion: {
                print("Button tapped.")
            }, label: {
                Picture(systemName: "globe")
                    .resizable()
                    .scaledToFit()
                    .body(width : 200)
                    .foregroundColor(.accentColor)
                    .scaleEffect(animAmount)
                    .onAppear {
                        let baseAnimation = Animation.easeOut(length: 1.5)
                        let repeated = baseAnimation.repeatForever(autoreverses: true)
                        
                        withAnimation(repeated) {
                            animAmount = 1.5
                        }
                    }
            })
            .padding()
        }
    }
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles