title: swift check if variable of type Data is empty
body: <p>I was going through docs of Data in swift from this link <a href="https://developer.apple.com/documentation/foundation/data" rel="nofollow noreferrer">https://developer.apple.com/documentation/foundation/data</a></p>
  
  <p>So basically what i am doing is, i am creating a variable of type data inside a function and later on putting some value in it and then returning this variable from the function like this:</p>
  
  <pre><code>var data = Data.init()
      //call some function which returns a data variable on success
      // and then put that variable inside this 
  
      // data = returnedData
  
  
  return data
  </code></pre>
  
  <p>After returning this data from the function how can i check if it is empty.I couldn't find any method in the docs.</p>