You need to create an application that will make a call to the specified number when you press a button in an application written in SWIFT. For example, in an ambulance. I have little experience in working with Swift, so I don’t know how to implement it. Are there any frameworks that allow you to do this or can this be solved by standard means?

    1 answer 1

    You can use standard tools for this. An example of a function to make a call:

    Swift 2.3:

    func callForHelp(number: String) { let url = NSURL(string: "tel://\(number)")! if UIApplication.sharedApplication().canOpenURL(url) { UIApplication.sharedApplication().openURL(url) } } 

    Swift 3:

     func callForHelp(_ number: String) { let url = URL(string: "tel://\(number)")! if UIApplication.shared.canOpenURL(url) { UIApplication.shared.openURL(url) } }