-1

I am following along a YouTube video tutorial on Swipe Gestures. The code I am writing is exactly as being shown in the tutorial, but I an getting the error (Cannot assign to property: "description" property is immutable error) on the line (leftSwipe.description = .Left)

override func viewDidLoad() {
        super.viewDidLoad()

var leftSwipe = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes"))

leftSwipe.description = .Left
 }

The tutorial author is writing it exactly the same way but not getting the error I am getting. I would be grateful for help. Link to the YouTubeVideo Tutorial I am following is: https://www.youtube.com/watch?v=9r1UFNeVuFA

Faheem Ahmad
  • 99
  • 10

4 Answers4

2

is not description

 leftSwipe.description = .Left

it is direction

leftSwipe.direction = UISwipeGestureRecognizerDirection.Left 

// or use 

 leftSwipe.direction = .Left 
Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
1

Not description, you're using the wrong property name, it should be direction.

Wain
  • 118,658
  • 15
  • 128
  • 151
1
override func viewDidLoad() 
{      
    super.viewDidLoad()

    var leftSwipe = UISwipeGestureRecognizer(target: self, action:     
    Selector("handleSwipes"))

    leftSwipe.direction = .Left
 }
Awesome.Apple
  • 1,316
  • 1
  • 11
  • 24
1

use

 leftSwipe.direction = .Left
ios
  • 955
  • 1
  • 12
  • 35