Hi, Sorry it took so long to get back to you. It does run correctly if I switch it to Swift 5.
Post
Replies
Boosts
Views
Activity
The same issue appears when using animatableData with GeometryEffect:
struct ShakeEffect: GeometryEffect {
var position: CGFloat
var animatableData: CGFloat {
get { position }
set { position = newValue }
}
init(shakes: Int) {
position = CGFloat(shakes)
}
func effectValue(size: CGSize) -> ProjectionTransform {
return ProjectionTransform(
CGAffineTransform(translationX: -30 * sin(position * 2 * .pi),
y: 0))
}
}
same here:
struct ShakeEffect: GeometryEffect {
var position: CGFloat
var animatableData: CGFloat { //same error as in original post here
get {position}
set {position = newValue}
}
init(shakes: Int) {
position = CGFloat(shakes)
}
func effectValue(size: CGSize) -> ProjectionTransform { //same error as in original post here
ProjectionTransform(CGAffineTransform(translationX: -30 * sin(position * 2 * .pi), y: 0))
}
}