In a few weeks, Apple will release Swift 3. With it come changes in many APIs. One of them is CAKeyframeAnimation
. I am not overly delighted by the current situation and have to familiarize with many decisions. The current topic is one of them.
CAKeyframeAnimation
s keyTimes
was changed from [AnyObject]!
to [NSNumber]?
which sounds god at first. Why would somebody complain about more type safety as the property gained exactness?
First, existing code must be adapted to this. When it was ok to pass in an array of [double]
you now have to declare the variable as let keyTimes : [NSNumber]=...
. In addition to that, the migrator wont help you in doing so. Your project won't build until you resolved any issues by hand.
Furthermore, it is not possible to perform math on NSNumbers. Therefore you cannot calculate any relative keyTimes without fighting against the type system and convert back and forth.
Properties like public var beginTime: CFTimeInterval { get set }
on the other hand are of type CFTimeInterval
which makes it easy to pass in a double.
In the end I just don't know what to do. Should I file a radar? Should I write to other people about it? Should I write my frustration down into a blogpost? I started with the latter.