title: Swift how to check if API is NOT available
body: <p>I am applying corner radius to only top left and top right of a view. In <code>viewDidLoad()</code> I have:</p>
  
  <pre><code>if #available(iOS 11.0, *) {
      view.layer.cornerRadius = 20.0
      view.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
  } 
  </code></pre>
  
  <p>If iOS 11 is not available, the best way seems to do it in <code>draw(_ rect:)</code>. Since I have to override it outside <code>viewDidLoad()</code>, I want to do the following</p>
  
  <pre><code>if NOT #available(iOS 11.0, *) {
      override func draw(_ rect: CGRect) {
          let maskPath = UIBezierPath(roundedRect: self.contentView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 20.0, height: 20.0))
          let shapeLayer = CAShapeLayer()
          shapeLayer.frame = self.bounds
          shapeLayer.path = maskPath.cgPath
          view.layer.mask = shapeLayer
      }
  }
  </code></pre>
  
  <p>It is syntactically incorrect of course. What should I do?</p>