title: Memory leak when initializing @ObservedObject inside View
body: <p>I have a <code>ViewModel</code> class that is an <code>ObservableObject</code> and I initialize it when initializing its corresponding view. It seems that if I have any bindings to the <code>ViewModel</code> inside the view, the <code>ViewModel</code> is leaked.</p>
  
  <p>For example, if I show said view inside a sheet, every time I present the sheet, a new reference is allocated and it does not get deallocated when the sheet is dismissed. The reference count keeps growing as many times I present the sheet.</p>
  
  <p>Am I missing something, or is the <code>@ObservedObject</code> property wrapper not supposed to be used this way?</p>
  
  <p>This is a simple example that exhibits the issue. The <code>deinit</code> function is never called for the <code>ViewModel</code></p>
  
  <pre><code>struct NewContactView: View {
  
      class ViewModel: ObservableObject {
  
          @Published var firstName = ""
          @Published var lastName = ""
          @Published var email = ""
          @Published var phoneNumber = ""
  
          init() {
              print("INIT")
          }
  
          deinit {
              print("DEINIT")
          }
  
      }
  
      @ObservedObject private var viewModel = ViewModel()
  
      var didCreateNewContact: (Contact) -&gt; Void = { _ in }
  
      var body: some View {
          NavigationView {
              Form {
                  Section(header: Text("Names")) {
                      TextField("First Name", text: $viewModel.firstName)
                      TextField("Last Name", text: $viewModel.lastName)
                  }
  
                  Section(header: Text("Details")) {
                      TextField("Email", text: $viewModel.email)
                      TextField("Phone Number", text: $viewModel.phoneNumber)
                  }
  
                  Button(action: {}) {
                      Text("Save")
                  }
              }
          }
      }
  }
  
  </code></pre>
  
  <p><strong>Edit: Added code that presents the sheet</strong></p>
  
  <pre><code>struct ContactsListView: View {
  
      @EnvironmentObject var contactStore: ContactStore
  
      @State private var isCreatingNewContact = false
  
      var body: some View {
  
              List(contactStore.contacts) { contact in
                  ContactListItem(contact: contact)
              }
              .navigationBarItems(trailing: Button(action: { self.isCreatingNewContact = true }) {
                  Image(systemName: "plus")
              })
  
  
              .sheet(isPresented: $isCreatingNewContact) {
                  NewContactView(didCreateNewContact: self.createNewContactHandler)
          }
      }
  
  
      private func createNewContactHandler(_ contact: Contact) {
          contactStore.contacts.append(contact)
          isCreatingNewContact = false
      }
  
  }
  </code></pre>
  
  <p><strong>Edit 2: Memory Graph Screenshots</strong></p>
  
  <p><a href="https://i.stack.imgur.com/CV1qL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CV1qL.png" alt="Memory graph"></a></p>
  
  <p><strong>Edit 3: Weirdly enough, replacing the Form view with a VStack gets rid of the leak. If I use a List view instead of the VStack, the leak comes back.</strong></p>