Swift 1.2(Xpre 6.3)
引入了
Set与桥接的本机类型
NSSet。Swift博客和Xpre6.3发行说明中都提到了这一点,
(更新:正如Ahmad Ghadiri所指出的,现在 已
记录在案)。
该
UIResponder方法现在声明为
func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent)
您可以像这样覆盖它:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { if let touch = touches.first as? UITouch { // ... } super.touchesBegan(touches , withEvent:event)}Swift 2(Xpre 7)更新:( 比较Swift 2中的OverrideFunc错误]
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { if let touch = touches.first { // ... } super.touchesBegan(touches, withEvent:event)}Swift 3更新:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { if let touch = touches.first { // ... } super.touchesBegan(touches, with: event)}


