Chetan Lodhi
Chetan Lodhi

Reputation: 353

Why #selector() is not working in swift

I'm trying to learn Swift. I want to make side menu in swift. I'd google and found some peace of code. I'm using Xcode 7.2 and swift version 2.1.1?

Error is showing in these following line :-

self.panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(ENSideMenu.handleGesture(_:)))// (Expected , separator)

HandleGesture method is :-

internal func handleGesture(gesture: UISwipeGestureRecognizer) {
    toggleMenu((self.menuPosition == .Right && gesture.direction == .Left)
            || (self.menuPosition == .Left && gesture.direction == .Right))
}

what should i do?

Thanks in Advance.

Upvotes: 2

Views: 1156

Answers (1)

Özgür Ersil
Özgür Ersil

Reputation: 7013

try with old syntax

self.panRecognizer = UIPanGestureRecognizer(target: self, action: Selector("handleGesture:"))

Upvotes: 1

Related Questions