MattBlack MattBlack - 2 months ago 22
Swift Question

Shake Gesture not Working

I have a project set up using SWReveal for the slide out menu.

When I place a motion ended override function it never seems to be called even though everything else in the class loads (indicated with the 'loading'.

I have had a good play around and found that if I change the segue to the page to a 'show' segue the code functions as I would expect it to.

However when I use a custom segue with the SWReveal as the class the motion ended does not work.

I have attached a screen shot to help describe the issue.

Any help much appreciated.enter image description here

Answer

You need to override canBecomeFirstResponder method.

override func canBecomeFirstResponder() -> Bool {
    return true
}