title: How to display a variable text in SwiftUI alert
body: <p>I'm trying to write a simple application using SwiftUI to understand better how it's working.</p>
  <p>In my application logic I need to display a alert with localized description of fault in case if one happened. Quite simple thing. I wrote the following code:</p>
  <pre><code>struct LoginView: View {
      @State fileprivate var isDisplayAlertFirebaseError = false
      @State fileprivate var firebaseErrorLocalizedMessage = &quot;&quot;
  
      // ...
  
  Text(&quot;We will send you SMS with validation code to confirm your phone number&quot;)
                          .font(.system(size: Appearance.labelFontSize))
                          .multilineTextAlignment(.center)
                          .padding(.horizontal, 55)
                          .offset(x: 0, y: 15)
                          .alert(isPresented: $isDisplayAlertFirebaseError) {
                              Alert(title: Text(&quot;Error&quot;), message: Text($firebaseErrorLocalizedMessage), dismissButton: .default(Text(&quot;OK&quot;)))
                          }
  }
  </code></pre>
  <p>However it doesn't compile with message &quot;Initializer 'init(_:)' requires that 'Binding' conform to 'StringProtocol'&quot;</p>
  <p>Can you please suggest how can I do that?</p>
  <p>Also I'm trying to understand the architecture of SwiftUI, and I found a bit strange, that I need to declare all alerts and assign them to some UI controls (could be a lot alerts in fact in some screens - will be necessary to create empty views for this), is there are really no way to display it just from code? What is the reason of that?</p>
  <p>Thank you very much</p>