【发布时间】:2020-11-09 09:15:13
【问题描述】:
(Xcode 12.0,SwiftUI) 这段代码为我工作了将近 6 个月,没有任何问题,我昨天刚收到这个错误,没有进行任何编辑。我尝试了很多来清理代码并使其更短,但对我没有任何效果。
GeometryReader { (geometry: GeometryProxy) in
ForEach(0..<5) { index in
Group {
Circle()
.foregroundColor(Color("GreyOne"))
.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)
}.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))
}
}.aspectRatio(1, contentMode: .fit)
.onAppear {
self.isAnimating = true
}
【问题讨论】: