title: Type '' does not conform to protocol 'Decodable'/'Encodable'
body: <p>I have this code to get information from firestore:</p>
  <pre><code> struct Spty: Identifiable, Codable{
     @DocumentID var id: String? = UUID().uuidString
     var spty: String
     var r: NSNumber
     var g: NSNumber
     var b: NSNumber
  }
  
   class SptyViewModel: NSObject, ObservableObject{
     @Published var specialities = [Spty]()
     @Published var search = &quot;&quot;
       func fetchData(){
        let db = Firestore.firestore()
          db.collection(&quot;specialities&quot;).addSnapshotListener { (querySnapshot, error) in
          guard let documents = querySnapshot else {return }
          self.specialities = documents.documents.compactMap { (doc) -&gt; Spty? in
            let id = doc.documentID
              if  let spty = doc.get(&quot;spty&quot;) as? String,
              let r = doc.get(&quot;r&quot;) as?  NSNumber,
              let g = doc.get(&quot;g&quot;) as?  NSNumber,
              let b = doc.get(&quot;b&quot;) as?  NSNumber{
              
              return Spty(id: id, spty: spty, r: r , g: g , b: b )
              }
              else{
                  return nil
              }
          }
        }
      }
  
     }
  </code></pre>
  <p>after seeing <a href="https://www.youtube.com/watch?v=3-yQeAf3bLE" rel="nofollow noreferrer">this video</a>, I started to make the changes on my code. But, as I added <code>Codable</code> I got those errors</p>
  <blockquote>
  <p>Type 'Spty' does not conform to protocol 'Decodable'</p>
  </blockquote>
  <blockquote>
  <p>Type 'Spty' does not conform to protocol 'Encodable'</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/wvyL4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wvyL4.png" alt="image" /></a></p>