I'm creating an iOS app with Swift. I discovered an animation I'd like to implement in my table view, but the code is in Objective-C.
Repository: https://github.com/recruit-mp/RMPZoomTransitionAnimator
I have successfully bridged Obj-C code to Swift but can't seem to conform to a required protocol.
The protocol:
@protocol RMPZoomTransitionAnimating <NSObject>
@required
- (UIImageView *)transitionSourceImageView;
- (UIColor *)transitionSourceBackgroundColor;
- (CGRect)transitionDestinationImageViewFrame;
@end
My Swift implementation:
First class that implements the protocol:
class ChallengeViewController: UIViewController, RMPZoomTransitionAnimating
func transitionSourceImageView() -> UIImageView {
return imageView
}
func transitionSourceBackgroundColor() -> UIColor {
return UIColor.whiteColor()
}
func transitionDestinationImageViewFrame() -> CGRect {
return imageView.frame
}
Second class:
class ChallengeTableViewController: UITableViewController, RMPZoomTransitionAnimating
func transitionSourceImageView() -> UIImageView {
return imageForTransition!
}
func transitionSourceBackgroundColor() -> UIColor {
return UIColor.whiteColor()
}
func transitionDestinationImageViewFrame() -> CGRect {
return imageFrame!
}
This check that occurs before animating always fails:
Protocol *animating = @protocol(RMPZoomTransitionAnimating);
BOOL doesNotConfirmProtocol = ![self.sourceTransition conformsToProtocol:animating] || ![self.destinationTransition conformsToProtocol:animating];
I've read this topic How to create class methods that conform to a protocol shared between Swift and Objective-C? but didn't found any help
Any clues would be really appreciated