Home > AI > IOS > SwiftUI >

(error) ignoring singular matrix: ProjectionTransform

This error happens when the CGAffineTransform makes the view to 0, that SwiftUI cannot render the view.

Example:

img
                          .rotation3DEffect(.degrees(self.rotateView ? -89 : 89), axis: (x: 0, y: 1, z: 0)) // can't be 90, or the view disappear, SwiftUI would be very confused.
                            .animation(Animation.linear(duration: 0.5).repeatForever(autoreverses: false))
                            .onAppear {
                                self.rotateView = true
                            }

If the degree is 90, then this error will happen, changing it to 89 can solve this problem.

Leave a Reply