title: UIAlertController with textfield validation alert displaying issue in swift ios
body: <p>I'm able to display alert controller with textfield and get textfield input data properly. </p>
  
  <p>Here i wanted to do two validation based on textfield data. 1. if no text in textfield and tapped on create display please enter room name alert in label. 2. if entered text is matches to already available string and then create tapped display you've already created room with this name these screenshots are shown in below.</p>
  
  <p><a href="https://i.stack.imgur.com/9KZ9f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9KZ9f.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/9e3gp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9e3gp.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/NH2qa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NH2qa.png" alt="enter image description here"></a></p>
  
  <p>Here the issue is if i display no text alert first and then second matches alert both are combined and showing in alert shown in below. i don't want to display both in one time.</p>
  
  <p><a href="https://i.stack.imgur.com/nHEqd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nHEqd.png" alt="enter image description here"></a></p>
  
  <p>Here is my complete code to display the alert controller below.</p>
  
  <pre><code>    @IBAction func getAlertBtn(_ sender: Any) {
      alertControllerWithTf()
  }
  var roomTextField: UITextField!
  func alertControllerWithTf(){
      let dialogMessage = UIAlertController(title: "New Room", message: nil, preferredStyle: .alert)
      let Create = UIAlertAction(title: "Create", style: .default, handler: { (action) -&gt; Void in
          if let userInput = self.roomTextField!.text {
              let label = UILabel(frame: CGRect(x: 0, y: 40, width: 270, height:18))
              label.textAlignment = .center
              label.textColor = .red
              label.font = label.font.withSize(12)
              dialogMessage.view.addSubview(label)
              label.isHidden = true
              if userInput == ""{
                  label.text = "Please enter room name to create."
                  label.isHidden = false
                  self.present(dialogMessage, animated: true, completion: nil)
  
              }else if self.haveSameRoomName(createdRoomName: userInput){
                  label.text = "You've already created room with this name."
                  label.isHidden = false
                  self.present(dialogMessage, animated: true, completion: nil)
              }else{
                  print("Create button success block called do stuff here....")
              }
          }
      })
      let cancel = UIAlertAction(title: "Cancel", style: .default) { (action) -&gt; Void in
          print("Cancel button tapped")
      }
  
      //Add OK and Cancel button to dialog message
  
      dialogMessage.addAction(Create)
      dialogMessage.addAction(cancel)
      // Add Input TextField to dialog message
      dialogMessage.addTextField { (textField) -&gt; Void in
          self.roomTextField = textField
          self.roomTextField?.placeholder = "Please enter room name"
      }
      // Present dialog message to user
      self.present(dialogMessage, animated: true, completion: nil)
  }
  func haveSameRoomName(createdRoomName: String) -&gt; Bool{
      let allRoomNames =  ["FIRST", "SECOND", "THIRD", "FOURTH", "FIFTH","SIXTH"]
      if allRoomNames.contains(createdRoomName){
          return true
      }else{
          return false
      }
  }
  </code></pre>
  
  <p>Can somebody please suggest me i can't able to handle these two cases error text displaying in label. thanks in advance.</p>