title: Check If Custom Class Not Nil --- Swift Is Converting It To A UInt8
body: <p><img src="https://i.stack.imgur.com/EQQjo.png" alt="enter image description here"></p>
  
  <p>I have a custom image class and I am just trying to check if its not nil.</p>
  
  <p>Every syntax I try (with the above being my best guess) keeps saying my iImage is not a UInt8.</p>
  
  <p>First: why is it thinking by comparing to nil its a UInt8 in the first place?</p>
  
  <p>Second: how can I check if my custom class is nil?</p>
  
  <p>Update:</p>
  
  <p>Answers are appreciated but didn't work. Here is full code block</p>
  
  <pre><code>private class func doubleLayoutView(mainView:UIView,images:Array&lt;iImage&gt;)
      {
          for i in 0...1{
  
              var image:iImage = images[i]
              if image.uiImage!=nil
              {
                  image.imageFrame = CGRectMake(CGFloat(i)*mainView.frame.width/2, 0, mainView.frame.width/2, mainView.frame.height)
              }
          }
      }
  </code></pre>