title: Error: 'Transaction' is ambiguous for type lookup in this context
body: <p>I am writing an app in SwiftUI using CoreData. I am getting an error in one view:</p>
  
  <blockquote>
    <p>'Transaction' is ambiguous for type lookup in this context</p>
  </blockquote>
  
  <p>Because of this error Preview doesn't work for this view. However, I can build the app and run in Simulator.</p>
  
  <p>The code I am having problem is as follows:</p>
  
  <pre><code>import SwiftUI
  
  struct TransactionsListView: View {
  
      var fetchRequest: FetchRequest&lt;Transaction&gt;
      var transactions: FetchedResults&lt;Transaction&gt; { fetchRequest.wrappedValue }
  
      var body: some View {
  
          Text("test")
  //      Some other code that doesn't make the error
      }
  
      init(filter: Bool?) {
          if let filter = filter {
              fetchRequest = FetchRequest&lt;Transaction&gt;(entity: Transaction.entity(), sortDescriptors: [], predicate: NSPredicate(format: "income = %d", filter))
          } else {
              fetchRequest = FetchRequest&lt;Transaction&gt;(entity: Transaction.entity(), sortDescriptors: [])
          }
      }
  
  }
  
  struct TransactionsListView_Previews: PreviewProvider {
      static var previews: some View {
          TransactionsListView(filter: true)
      }
  }
  </code></pre>
  
  <p>What does this error mean and how to fix it?</p>