How to make a phone call in iOS 10 using Swift?

In simulator we can’t test in below code using device we can try

1234567970 - example phone number


let url: NSURL = URL(string: "TEL://1234567970")! as NSURL as URL, options: [:], completionHandler: nil)


We can write above code as one function and call that method in viewdidload. (Or) write above code as it is in viewdidload method.