David Seek David Seek - 2 months ago 9
Swift Question

Swift / phone call / check if user wants to call

I'm using the following code to perform a phone call.

@IBAction func phoneButtonAction(sender: AnyObject) {

let phone = "tel://123456789"
let url:NSURL = NSURL(string:phone)!
UIApplication.sharedApplication().openURL(url)
}


This Functions instant calls the desired number.
What's the best practise to ask the user if he's sure he wants to call.

Help is very appreciated.

Answer

As answered by User maddy, telprompt did the trick.

@IBAction func phoneButtonAction(sender: AnyObject) {

        let phone = "telprompt://123456789"
        let url:NSURL = NSURL(string:phone)!
        UIApplication.sharedApplication().openURL(url)
        }