扫码关注官方订阅号
认证高级PHP讲师
在 Swift 1.2 (Xcode 6.3 beta) 中,有了几个新的语言特性,New native Set data structure 则是之一,提供了桥接 NSSet 的原生 Set 数据结构,可以像操作 Array 和 Dictionary 一样操作 Set。
NSSet
Set
Array
Dictionary
所以 touchesBegan 相关方法也变了,现在你可以这样写:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { if let touch = touches.first as? UITouch { // ... } super.touchesBegan(touches , withEvent:event) }
参考:Swift Blog - Swift 1.2 and Xcode 6.3 beta
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
在 Swift 1.2 (Xcode 6.3 beta) 中,有了几个新的语言特性,New native Set data structure 则是之一,提供了桥接
NSSet的原生Set数据结构,可以像操作Array和Dictionary一样操作Set。所以 touchesBegan 相关方法也变了,现在你可以这样写:
参考:Swift Blog - Swift 1.2 and Xcode 6.3 beta