I'm getting the following error
Cannot assign value of type 'StarButton' to type 'CAAnimationDelegate?'
on the last line of this CABasicAnimation block:
let fillCircle = CABasicAnimation(keyPath: "opacity")
fillCircle.toValue = 0
fillCircle.duration = 0.3
fillCircle.setValue(notFavoriteKey, forKey: starKey)
fillCircle.delegate = self // this is where the error is thrown
self
is a custom UIButton class. This wasn't an issue in previous versions of Swift... any suggestions on a solution?
UPDATE
Here is a downloadable link to the source file for the StarButton class for best reference:
https://www.dropbox.com/s/gvc2sky05f4p3au/StarButton.swift?dl=0
As @Doc mentioned in the comments above, the solution is to replace
class StarButton: UIButton {
with
class StarButton: UIButton, CAAnimationDelegate {
It would seem that the CAAnimationDelegate protocol is no longer implied and must be specified explicitly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With