Strange warning in SwiftUI BUT the Code works!

Hi,

I'm getting the following warning when I compile my test app:


Braces here form a trailing closure separated from its callee by multiple newlines.


Here's the code. Note where the warning is appearing....


/*
    How to present an alertView in SwiftUI
 */


import SwiftUI

struct ContentView: View {
  
  @State private var showSheet = false
  
    var body: some View {
      
      VStack {
        Text("Click below for an Alert")
          .fontWeight(.bold)
          .font(.largeTitle)
      
      Button(action: {
        
        self.showSheet = true
        
      }
      ) {
        
        Text("Click Me")
        .bold()
        .foregroundColor(.white)
        .background(Color.red)
        .font(.largeTitle)
        .padding()
      }
        
      .alert(isPresented: $showSheet)
        
      { // <---- The warning is HERE.

        Alert(title: Text("Alert"), message: Text("About **** time"), dismissButton: .default(Text("OK")))
        
        }

}
  }

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
}


Thanks in advance,

Dan Uff

Never mind....


You cannot have a space between the .alert and the bracket.

Strange warning in SwiftUI BUT the Code works!
 
 
Q