title: putting conditions to my presentation controller from retrieved data firebase
body: <p>im using presentation controller and i want it to appear only if the area name is (king saud university) or (king khalid airport) and the (isAvailable == true ) and the value of sensor is true.
  im using different values for each area so i assign them with 1 or 2. attached is a screen shot of my firebase and my code. what do you suggest so i can solve the problem [sensors database][1]?
  [areas database][2]</p>
  <pre><code>            let storyboard = UIStoryboard(name: &quot;Main&quot;, bundle: nil)
                              let viewController = storyboard.instantiateViewController(withIdentifier: &quot;ConfirmAndPay&quot;)
                              
                              if let presentationController = viewController.presentationController as? UISheetPresentationController {
                                  presentationController.detents = [.medium()] /// change to [.medium(), .large()] for a half and full screen sheet
                              }
              let ref = Database.database().reference()
              ref.child(&quot;Areas&quot;).observeSingleEvent(of:
                 .childAdded, with: { (snapshot) in
  
                let value = snapshot.value as? NSDictionary
                  let isAvailable = value?[&quot;isAvailable&quot;] as? Double ?? 0.0
                  let areaname = value?[&quot;areaname&quot;] as? String ?? &quot;&quot;
                  print(isAvailable)
                  print(areaname)
              
              ref.child(&quot;Sensors&quot;).observeSingleEvent(of: .value, with: { [self] (snapshot) in
  
                let value = snapshot.value as? NSDictionary
                let Value1 = value?[&quot;Value1&quot;] as? Double ?? 0.0
                let Value2 = value?[&quot;Value&quot;] as? Double ?? 0.0
              
                  if  areaname == &quot;King Saud University&quot; &amp;&amp; isAvailable == 1 &amp;&amp; Value1 == 1  {
                      self.present(viewController, animated: true)
                  } else if areaname == &quot;King Khalid Airport&quot; &amp;&amp; isAvailable == 1 &amp;&amp; Value2 == 1  {
                      self.present(viewController, animated: true)
                  }else if isAvailable == 0 {
                      let cell = self.ParkingsViews.dequeueReusableCell(withIdentifier: &quot;CustomCell&quot;) as! CustomCell
                      cell.layer.borderColor = UIColor.red.cgColor
                      cell.Alert.text = &quot;No Available Parkings&quot;
                  }
              
                  
              })})
          } ```
  
  
    [1]: https://i.stack.imgur.com/tqcHR.png
    [2]: https://i.stack.imgur.com/Qz3VS.png
  </code></pre>