title: Swift- error: Variable 'self.___' used before being initialized
body: <p>I am trying to work with gesture recognizers in a Playground but am having some trouble.</p>
  
  <p>Here is my class:</p>
  
  <pre><code>class foo {
  
      var fooVarSwipe: Any
      var fooVarTap: Any
  
      init() {
  
          let gr = UISwipeGestureRecognizer(target: self, action: #selector(foo.bar))
          let tr = UITapGestureRecognizer(target: self, action: #selector(foo.tar))
          helloApple.addGestureRecognizer(gr)
          helloApple.addGestureRecognizer(tr)
          helloApple.isUserInteractionEnabled = true
          self.fooVarSwipe = gr
          self.fooVarTap = tr
  
      }
  
  
  
      @objc func tar() {
          print("tapped")
      }
  
      @objc func bar() {
          print("swiped")
          currentViewNum = 1
      }
  }
  </code></pre>
  
  <p>The problem I am having is that on the line starting with "let gr" it is saying "Variable 'self.fooVarSwipe' used before being initialized." Why is this? I initialize the class outside but it still is showing me the error.</p>
  
  <p>Any help would be much appreciated!!
  Cheers and thanks in advance,
  Theo</p>