Adding the wave’s animatableData property
We now have a wave shape that we can duplicate as many times as needed to create a layered ocean scene. However, those waves are still static, meaning they won’t do anything unless we have a way of changing the value in the yOffset variable. To accomplish that, we need to add one more important variable to the file here: animatableData.
So, let’s add it right under the declaration of the yOffset variable:
var animatableData: CGFloat {
get {
return yOffset
}
set {
yOffset = newValue
}
}
The animatableData property is an instance of a Swift class called Animatable...