How to use openURL for making a phone call in Swift?

后端 未结 12 588
囚心锁ツ
囚心锁ツ 2020-11-30 05:30

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, we

12条回答
  •  隐瞒了意图╮
    2020-11-30 06:04

    Swift 4 and above

    let dialer = URL(string: "tel://5028493750")
        if let dialerURL = dialer {
            UIApplication.shared.open(dialerURL)
    }
    

提交回复
热议问题