0

OK, what's going on with Swift 1.2? I recently updated and suddently my project is all red. Has the compatibility with NSSets been removed or what? How do I fix this?

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

results to:

Overriding method with selector 'touchesBegan:withEvent:' has incompatible type '(NSSet, UIEvent) -> ()'
user3673836
  • 591
  • 1
  • 9
  • 23

2 Answers2

5

Please not that NNsets is now being declared as :

 func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent)

Please try the below code for overriding

  override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {

        // ...
    }
Keshav
  • 1,123
  • 1
  • 18
  • 36
1

Change NSSet to Set. Swift now has its own native sets and bridges NSSets to them just like it does Arrays and Strings.

Catfish_Man
  • 41,261
  • 11
  • 67
  • 84