Phone Button or Email Button

In the course. I’ve watch how the deal button works and successfully followed and successfully worked. Now I want to make a button to call me and a button to email me on my app I’m building. Any Helpers out there ? Please Advise Thank You.

This thread might be of use to you.

https://forums.developer.apple.com/forums/thread/87997

Alternatively, this works:

struct ContentView: View {
    var body: some View {
        VStack {
            Button {
                let dialer = URL(string: "tel://+NumberToCall")
                    if let dialer {
                        UIApplication.shared.open(dialer)
                }
            } label: {
                Text("Phone")
            }

            Button {
                let emailer = URL(string: "mailto:your_email_address?subject=Just testing&body=Whatever text you would like to add.")
                    if let emailer {
                        UIApplication.shared.open(emailer)
                }
            } label: {
                Text("Email")
            }
        }
        .padding()
    }
}

Thank You Chris

1 Like