title: Do Swift functions variables require weak references?
body: <p>I have an extension method to add an animated border to image views, which I achieve by using CAShapeLayer:</p>
  
  <pre><code>extension UIImageView {
  
      func addAnimatedBorder () {
          let border = CAShapeLayer()
          //...setup animation
          border.position = self.center
          self.layer.addSublayer(border)
      }
  }
  </code></pre>
  
  <p>Since the CAShapeLayer is referencing the UIImageView (through its position), and the UIImageView has the CAShapeLayer as a layer, I'm worried there will be a retain cycle.</p>
  
  <p>Do I need to declare the "border" -- the CAShapeLayer -- as weak? Or will that go out of scope once the function executes, leaving the only reference to the object being the one from the UIImageView?</p>