title: Passing IBOutlet/object into generic function for repeatable animations
body: <p>I am writing an app that utilizes the same animation on multiple elements. To make my life easier, I want to create a generic function that will take in an object from my storyboard and animate it.</p>
  
  <p>What I'm looking for</p>
  
  <pre><code>// Object I want to pass
  IBOutlet weak var titleLabel: UILabel!
  
  // Animate function
  func animateIn&lt;T&gt;(a: AnyObject, myType:T.Type) {
      if let a = a as? T{
          UIView.animate(withDuration: 0.3, delay: 0.0, options: [], animations: {
              a.transform = .identity
          })
  
          UIView.animate(withDuration: 0.5, delay: 0.1, options: [], animations: {
              a.alpha = 1.0
          })
      }
  }
  
  // Call function
  animateIn(a: titleLabel, myType: UILabel.self)
  </code></pre>
  
  <p>However, I get the errors:</p>
  
  <blockquote>
    <p>Value of type <code>T</code> has no member <code>transform</code><br>
    Value of type <code>T</code> has no member <code>alpha</code></p>
  </blockquote>
  
  <p>How can I fix this?</p>