Apple URL Schemes helps you to access system apps in iOS. Native iOS app uses this schemes to integrate with system apps and provide a more seamless experience to the user.
For example :- If your app display telephone number you can use appropriate URL to launch phone app whenever user click on the telephone number.
There are many functions of Apple URL Schemes used for such as :-
1. Phone Link :-
Phone link helps you to make dialing experience easy for specific phone numbers. It will prompt an alert to the user to make a call or cancel the call option very easily.
if let url = URL(string: "tel://1234567890") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
2. Message Link :-
Message link help you to make messaging experience easy for specific phone number. It open SMS app for texting to the phone number user click.
if let url = URL(string: "sms://1234567890") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
3. Mail Link :-
Mail link help you to make mailing experience easy to the specific email address. It open mail app for sending the mail to the email address.
if let url = URL(string: "mailto://test@test.com") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
4. FaceTime Link :-
FaceTime link help to make video call and audio call experience easy to the user. It open the native FaceTime app when the user tap on the phone number or email address integrated with FaceTime link will prompt user for confirmation to make a call.
if let url = URL(string: "facetime://1234567890") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
// ---------- OR ----------
if let url = URL(string: "facetime://test@test.com") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
5. Map Link :-
Map link is used to show geographical locations and to get the driving directions between two points. If you app has address then you can make use of map link to enhance the user experience. Map URL can be use for
-
Perform a Search
if let url = URL(string: "http://maps.apple.com/?q=Punjabi+Food+Restaurant") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } }
-
Direction to a Location
if let url = URL(string: "http://maps.apple.com/?saddr=Cupertino&daddr=San+Francisco") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } }
-
View Specific Location
if let url = URL(string: "http://maps.apple.com/?ll=50.894967,4.341626") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } } // ---------- OR ---------- if let url = URL(string: "http://maps.apple.com/?address=1,Infinite+Loop,Cupertino,California") { if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } }
![enter image description here][7]
[7]: /content/images/knowbuddy/353/original/Simulator_Screen_Shot_-iPhone_7-_2017-09-25_at_13_58_45.pngstrong text