title: SwiftUI - Setting function ID to post.id
body: <p>In my function, I am trying to set (id:) to post.id. Post and ID are in PostModel, which I've referenced as <code>var post : PostModel</code>. However, with my current code, I am receiving these errors:</p>
  <p><em>Variable 'self.post' used before being initialized</em></p>
  <p><em>`self' used in method call 'getComments' before all stored properties are initialized</em></p>
  <p><em>Return from initializer without initializing all stored properties</em></p>
  <p>My code for this part of my app is here:</p>
  <pre><code>import SwiftUI
  import Firebase
  
  class CommentsViewModel : ObservableObject{
      
      @Published var comments : [CommentsModel] = []
      @Published var noComments = false
      @Published var newComment = false
      @Published var commentTxt = &quot;&quot;
      
      var post : PostModel
      
      let ref = Firestore.firestore()
      let uid = Auth.auth().currentUser!.uid
      
      init() {
          getComments(id: post.id) //this has to resort to post.id
      }
      
      func getComments(id: String) {
  //code for function
  }
  
  </code></pre>
  <p>Inside my getComments function, I am trying to call 'id' like this:
  <code>ref.collection(&quot;Posts&quot;).document(id).collection(&quot;Comments&quot;).addSnapshotListener</code></p>
  <p>Any help would be appriciated.</p>