title: Remove subview created for activityIndicator with swift
body: <p>i have created an activity window function which takes 3 inputs,</p>
  
  <ul>
  <li>msg:String - the message which should show in the activity window</li>
  <li>indicator:Bool - if the activity window should show or not</li>
  <li>view:UIView - the uiview which should get the frame sizes etc from the View Controller which its called on</li>
  </ul>
  
  <p>everything works fine, except the part where subview needs to be removed.if the same function is run on the main view controller. it works fine. just when i moved it to NSObject, it does not. please help</p>
  
  <pre><code>class UIDesignFunction: NSObject {
  
  func progressBarDisplayer(msg:String, indicator:Bool, view:UIView) {
  
      var activityIndicator = UIActivityIndicatorView()
      var strLabel = UILabel()
      var msgFrame = UIView()
  
      if indicator{
  
          //println(msg)
          strLabel = UILabel(frame: CGRect(x: 50, y: 0, width: 200, height: 50))
          strLabel.text = msg
          strLabel.textColor = UIColor.whiteColor()
          msgFrame = UIView(frame: CGRect(x: view.frame.midX - 90, y: view.frame.midY - 25 , width: 180, height: 50))
          msgFrame.layer.cornerRadius = 15
          msgFrame.backgroundColor = UIColor(white: 0, alpha: 0.7)
  
          activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.White)
          activityIndicator.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
          activityIndicator.startAnimating()
          msgFrame.addSubview(activityIndicator)
          UIApplication.sharedApplication().beginIgnoringInteractionEvents()
          msgFrame.addSubview(strLabel)
          view.addSubview(msgFrame)
      }else{
          UIApplication.sharedApplication().endIgnoringInteractionEvents()
          msgFrame.removeFromSuperview()
      }
  
  }
  </code></pre>