Checking if array is nil or not : <p>I have a array of my custom model, and I want to check if it is not nil and its size is greater then 0. </p>

<p>Following is my array with custom object </p>

<blockquote>
  <p><code>var listCountries : [Countries]? = nil</code></p>
</blockquote>

<p>now In viewDIdLoad I want to make a check on it. I am new to Swift. I have good experience in working in Java.  </p>

<p>I have read out Optional values concept and guard, if let statements. But I am unable to understand how efficiently they may be used. I have read too much  SO questions but failed to figure out. </p>

<p>for example , if I want to check the upper given array in java I have only to do </p>

<pre><code>if(listCountries != null &amp;&amp; listCountries.size()&gt;0){
    //DO something 
}
</code></pre>

<p>So to summarize my question:</p>

<ol>
<li>How to make the upper given(Java code)  check in to swift 4.? What is more smooth and reliable way. </li>
<li>What is a use of if let , guard, guard let statements. if I declare a variable (array, string) as optional I have to bear optional check like force wrapping each and every place. This is for me so making too much confusion. </li>
</ol>

<p>Please help. I know this question has been asked in different ways. But this has some different context. </p>
