title: Can I pass a Binding variable as a parameter in a function? (do I need to in this case?)
body: <p>I'm new to Swift / Firebase and need some help with my code.</p>
  <p>I have a simple create new account page, and I am using Firebase.</p>
  <p>I want to create a user when a button is tapped - change button colour/text to reflect this - then return to HomeView</p>
  <p>Now, I want to include all the <code>Auth.auth()</code> in a separate function on a separate swift file - to keep my View code clean.</p>
  <p>Currently, I'm setting the <code>isShowingNewAccountView = false</code> to return back to <code>HomeView</code> (via a <code>NavigationLink</code> on <code>HomeView</code>) - <code>isShowingAccountView</code> is a Binding variable from <code>HomeView</code>.</p>
  <p>If I put all the <code>Auth.auth()</code> code into a separate function, is it possible to change the value of the isShowingAccountView to 'false' when a user is created from within the function? Is there a more elegant alternative</p>
  <pre class="lang-swift prettyprint-override"><code>Button(action: {
      Auth.auth().createUser(withEmail: newUser.userEmail, password: newUser.userPassword) { authDataResult, error in
          if error != nil {
              print(&quot;Error detected&quot;)
              print(error!.localizedDescription)
  
              isShowingNewAccountView = true         //Binding variable from HomeView - Keep showing NewAccountView
              newUser.successNewAccountCreated = false
              return
          }
          else
          {
              print(&quot;Account Successfully Created&quot;)
              isShowingNewAccountView = false        //Binding variable from HomeView - Revert back to HomeView
              newUser.successNewAccountCreated = true
              return
          }
      }
  }, label: {
      CustomButton(buttonText: (!newUser.successNewAccountCreated ? &quot;Create New Account&quot; : &quot;New Account Created&quot;), colourVar: newUser.successNewAccountCreated ? .green : (isInputAppropriate() ? .accentColor : .gray)
  })
  </code></pre>
  <p>On <code>HomeView</code> I have:</p>
  <pre class="lang-swift prettyprint-override"><code>NavigationLink(destination: NewAccountView(isShowingNewAccountView: $isShowingNewAccountView), isActive: $isShowingNewAccountView) {
      //passing isShowingAccountView as a binding $
      EmptyView()
  }
  </code></pre>
  <p>Thanks in advance.</p>