2015-04-12 27 views
10

bugün ben güncellenmiş Swift kodum Swift 1.1 üzerinde de çalışıyordu 1.2 ile xcode ama ben bu hata var güncellenen zaman adında bir üye yok 'Set' :<NSObject> 'anyObject'

override public func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) { 
    let location:CGPoint? = touches.anyObject()?.locationInView(self) 
    if let loc = location { 
     if (!CGRectContainsPoint(ScaleRect(self.bounds, n: 2.0), loc)) { 
      self.highlighted = false 
     } 
    } 
} 

Bunu nasıl düzeltebilirim konusunda bir fikriniz var mı lütfen? Swift için NSSet ait anyObject eşdeğerdir

+0

http://stackoverflow.com/questions/28771896/overriding-method-with-selector-touchesbeganwithevent-has-incompatible- türü, http://stackoverflow.com/questions/29566861/event-touchesforview-anyobject-not-working-in-xcode-6-3, http://stackoverflow.com/questions/29593411/swift-1-2- replace-for-nsset-anyobject –

cevap

31

Kullanım first ayarlar:

touches.first 
+0

* "Set - NSSet anyObject yönteminin eşdeğeri yok" * - Önce 'peki? –

+0

@MartinR teşekkürler, düzeltildi –

İlgili konular