title: How do I check if UIImage is empty in swift?
body: <p>This is my code but it seems the conditional "if" check for UIImage being empty is not executing. Is it the wrong way of checking if UIImage is empty? I have also tried </p>
  
  <pre><code>if allStyleArrays[i][ii][iii] as UIImage? == nil {
    ...
  }
  </code></pre>
  
  <p>And not working, please if none of those methods checks, what is the correct way?</p>
  
  <p>Thanks.</p>
  
  <p>Code:</p>
  
  <pre><code>for var i = 0; i &lt;= allStyleArrays.count; i++ {
  
                  if i == allStyleArrays.count {
                  self.performSegueWithIdentifier("toStylistReviewAndConfirm", sender: self)
  
              } else {
  
              for var ii = 0; ii &lt; allStyleArrays[i].count; ii++ {
  
                  for var iii = 0; iii &lt; allStyleArrays[i][ii].count; iii++ {
  
                      if allStyleArrays[i][ii][iii] as UIImage? == UIImage(named: "") {
  
                      } else {
  
                          switch i {
                          case 0:
                              styleN[0].append(allStyleArrays[i][ii][iii])
                              //print("style 1 \(style1.count)")
                              break
  
                          case 1:
                              styleN[1].append(allStyleArrays[i][ii][iii])
                              //print("style 2 \(style2.count)")
                              break
  
                          default:
                              styleN[2].append(allStyleArrays[i][ii][iii])
                              //print("style 3 \(style3.count)")
                              break
                          }
  
                      }
  
                  }
  
              }
  
          }
  
      }
  </code></pre>