title: iOS - How to differentiate UI and Unit tests, and how to use them in this concrete situation?
body: <p>I am completely beginner about UI and unit tests, and very confused about how to use them, as well as how to differentiate them. So I have thought about the following use case:</p>
  
  <p>I have a user who has a set of <code>MyData</code>, a simple object like this:</p>
  
  <pre><code>class MyData: NSObject {
      var settled: Bool?
      var id: String?
  }
  
  class User {
      var datas: Set&lt;MyData&gt;?
  }
  </code></pre>
  
  <p>Here is the behaviour of the application: the user comes on a <code>MyDataListViewController</code> that's in a <code>loading</code> state first, the <code>viewDidLoad</code> method fires an asynchronous function, let's say we use <code>Parse</code> for this:</p>
  
  <pre><code>static func loadDatas(success: ((Set&lt;Data&gt;) -&gt; Void)?, error: ((String) -&gt; Void)?) {
      // Here we fetch the datas and return then in the success or an error
      // ... 
  }
  </code></pre>
  
  <p>The callback result fills the controller's <code>UITableView</code>, and when tapping a cell, it opens a modal popup for the specific <code>MyData</code> with a button to change its <code>settled</code> value.</p>
  
  <pre><code>myData.settled = !myData.settled
  myData.save()
  </code></pre>
  
  <p>Given this information, </p>
  
  <ul>
  <li>How would I separate my UI and unit tests? </li>
  <li>How and what should I setup for each of these tests?</li>
  </ul>
  
  <p>Thanks for reading me and helping me out, and sorry again if this sounds very beginner. I'm still very confused about the subject. Also, sorry if a better place than SO matches for this kind of question, I really didn't know where to ask. </p>