
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to make phone call in iOS 10 using Swift?
In this post we will be seeing how to make phone in iOS programmatically.
So let’s get started.
Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “MakeCall”
Step 2 − Open Main.storyboard and add one text field and one button as shown below
Step 3 − Create @IBOutlet for the text field, name it phoneNumberTextfield.
Step 4 − Create @IBAction method callButtonClicked for call button
Step 5 − To make a call we can use iOS openURL. In callButtonClicked add following lines
if let url = URL(string: "tel://\(phoneNumberTextfield.text!)"), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil)
Step 6 − Run the app and enter the number you want to make call to as shown in the pic below
Step 7 − Click on the call button, you will be shown an alert with ‘Call’ and ‘Cancel’ options
Step 8 − Click on the call button, the call will be made to the number, as shown below
- Related Articles
- How to make the phone call in iOS 10 using Swift?
- How to make a phone call using intent in Android?
- How to make a phone call using intent in Android using Kotlin?
- How to make an HTTP request on iOS App using Swift?
- How to call a method after a delay in Swift(iOS)?
- How to make an HTTP POST request on iOS App using Swift?
- How to integrate PayU Money in iOS using swift?
- How to obtain the phone number of the iOS phone programmatically?
- How to send an attachment in email using Swift(ios)?
- How to answer incoming call programmatically in iOS?
- How to create a WebView in an iOS App using Swift?
- How to hide the status bar in a iOS App using Swift?
- How to make iPhone vibrate using Swift?
- How to manually deprecate members in iOS Swift?
- How to get the distance between two geographic locations in iOS using Swift?
