使用Xcode 6 beta 5协议和委托不像第一个那样工作。调用self.delegate?.printCar()时不会调用printCar() 。我现在如何使用协议和委托?
import UIKit
protocol communication{
func printCar()
}
class car{
var delegate:communication?
init(){}
func passCar(){
self.delegate?.printCar()
}
}
class ViewController: UIViewController,communication {
override func viewDidLoad() {
super.viewDidLoad()
println("start")
var bmw = car()
bmw.passCar()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func printCar(){
println("car")
}
}