SwiftUI OpenURLAction not working withs link to my own app store app.

Can anyone explain why this code is failing? The link itself works in the Safari browser, but when I try to use it in this code below it gives me errors.

import SwiftUI



struct OpenURLActionView: View {

    @Environment(\.openURL) var openURL



    var body: some View {

        Button(action: contactSupport) {

            Text("Email Support")

            Image(systemName: "envelope.open")

        }

    }



    func contactSupport() {

        //guard let url = URL(string: "https://apple.com") else {

        guard let url = URL(string: "https://apps.apple.com/us/app/mealtime-prayers/id1299492959?ls=1") else {

            return

        }

        openURL(url)

    }

}



struct OpenURLActionView_Previews: PreviewProvider {

    static var previews: some View {

        OpenURLActionView()

    }

}
code-block

And the error I get is:

SwiftUI OpenURLAction not working withs link to my own app store app.
 
 
Q