title: How to make activity indicator needs to be placed centre in all devices using constraints programmatically in swift 3?
body: <p>Here I am having customized activity indicator to place centre in all devices but I am unable to place it centre can anyone help me how to implement this ? </p>
  
  <p>here is the code for activity indicator</p>
  
  <pre><code> func showActivityIndicator(uiView: UIView) {
          container.frame = uiView.frame
          container.center = uiView.center
          container.backgroundColor = UIColorFromHex(rgbValue: 0xffffff, alpha: 0.3)
  
          loadingView.frame = CGRect(x: 0, y: 0, width: 80, height: 80)
          loadingView.center = uiView.center
          loadingView.backgroundColor = UIColorFromHex(rgbValue: 0x444444, alpha: 0.7)
          loadingView.clipsToBounds = true
          loadingView.layer.cornerRadius = 10
  
          customActivityIndicator.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
          customActivityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.whiteLarge
          customActivityIndicator.center = CGPoint(x: loadingView.frame.size.width / 2, y: loadingView.frame.size.height / 2)
  
          loadingView.addSubview(customActivityIndicator)
          view.isUserInteractionEnabled = false
          container.addSubview(loadingView)
          contentView.addSubview(container)
          container.translatesAutoresizingMaskIntoConstraints = false
  
          NSLayoutConstraint(
              item: container,
              attribute: .centerX,
              relatedBy: .equal,
              toItem: view,
              attribute: .centerX,
              multiplier: 1.0,
              constant: 0.0
              ).isActive = true
  
          NSLayoutConstraint(
              item: container,
              attribute: .centerY,
              relatedBy: .equal,
              toItem: view,
              attribute: .centerY,
              multiplier: 1.0, 
              constant: 0.0
              ).isActive = true
          NSLayoutConstraint(item: container, attribute: .width, relatedBy: .equal, toItem: view, attribute: .width, multiplier: 1, constant: 50).isActive = true
          NSLayoutConstraint(item: container, attribute: .height, relatedBy: .equal, toItem: view, attribute: .height, multiplier: 1, constant: 350).isActive = true
          customActivityIndicator.startAnimating()
      }
      func hideActivityIndicator(uiView: UIView) {
          customActivityIndicator.stopAnimating()
          view.isUserInteractionEnabled = true
          container.removeFromSuperview()
      }
  </code></pre>
  
  <p>Here is the code for using the above function</p>
  
  <pre><code>func buyNowActionForNewCollection(button: UIButton){
          if loginCheck == 1 {
              showActivityIndicator(uiView: contentView)
  </code></pre>