Reputation: 15
I managed to access whatsapp from swiftui with code snippet:
let urlWhats = "https://wa.me/55555123456/?text=hello"
if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed) {
if let whatsappURL = NSURL(string: urlString) {
if UIApplication.shared.canOpenURL(whatsappURL as URL) {
UIApplication.shared.open(whatsappURL as URL, options: [:], completionHandler: nil)
It opens whatsapp, and writes "hello" in the input field. But the message is not sent yet. I have to actively press the "send" button (blue with white aeroplane) in whatsapp so send the message. Is there a possibility that the send-action is done automatically?
Upvotes: 0
Views: 216