i trying override touchesbegan in custom subclass of uitapgesturerecognizer. code below. got here: how accelerate identification of single tap on double tap?. accepted answer, getting error: method not override method superclass. have checked , indeed seems signature touchesbegan. help?
import uikit class uishorttapgesturerecognizer: uitapgesturerecognizer { let tapmaxdelay: double = 0.3 override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { super.touchesbegan(touches, withevent: event) delay(tapmaxdelay) { // enough time has passed , gesture not recognized -> has failed. if self.state != uigesturerecognizerstate.ended { self.state = uigesturerecognizerstate.failed } } } }
the problem stems fact not using xcode 7; syntax in swift 1.2+ not supported xcode version using.
if using xcode version swift version prior 1.2, need change method signature follows:
override func touchesbegan(touches: nsset!, withevent event: uievent?)
or, upgrade xcode 7.
override func touchesbegan(touches: set<uitouch>, withevent event: uievent?)
became available since xcode 6.3.
Comments
Post a Comment