Da Sie keine Implementierung innerhalb der Protokolldeklaration selbst bereitstellen können, sollten Sie innerhalb der Standardimplementierung auf UIView
Klasse verweisen. Ich hoffe, dass einer dieser drei Vorlagenkästen genau das ist, was Sie brauchen:
import UIKit
protocol SomeProtocol {
static func animateWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, options: UIViewAnimationOptions, animations:() -> Void, completion: ((Bool) -> Void)?)
func animateWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, options: UIViewAnimationOptions, animations:() -> Void, completion: ((Bool) -> Void)?)
func someCustomFuncForAnimate()
}
extension SomeProtocol {
static func animateWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, options: UIViewAnimationOptions, animations:() -> Void, completion: ((Bool) -> Void)?) {
UIView.animateWithDuration(duration, delay: delay, options: options, animations: animations, completion: completion)
}
func animateWithDuration(duration: NSTimeInterval, delay: NSTimeInterval, options: UIViewAnimationOptions, animations:() -> Void, completion: ((Bool) -> Void)?) {
UIView.animateWithDuration(duration, delay: delay, options: options, animations: animations, completion: completion)
}
func someCustomFuncForAnimate() {
UIView.animateWithDuration(0.2, delay: 1, options: .TransitionCrossDissolve, animations: {/*...*/}, completion: nil)
}
}
Bitte zeigen Sie uns Ihren Code – Hamish