申明协议
public protocol MTLCLInputDelegate : NSObjectProtocol {
func renderImage(ciImage : CIImage)
}
遵守协议
extension MTLCLImage : MTLCLInputDelegate {
func renderImage(ciImage: CIImage) {
}
}
使用时,若是申明遵守该协议,则调用时传入非法对象,报错
var targets = [MTLCLInputDelegate]()
func addTarget(target : MTLCLInputDelegate) {
}
网友评论