I have converted the code for making a phone call from Objective-C to Swift, but in Objective-C, we can set the type of the URL that we like to open (e.g. telephone, SMS, web) like this:
@"tel:xx"
@"mailto:[email protected]"
@"http://stackoverflow.com"
@"sms:768number"
The code in Swift is:
UIApplication.sharedApplication().openURL(NSURL(string : "9809088798")
I read that have not released any scheme parameter for tel:
, but I don't know if Swift can detect if the string is for making a phone call, sending email, or opening a website. Or may I write:
(string : "tel//:9809088798")
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…