Building a startup with generative AI? Here are 4 things you need to understand

Intelligence has been democratized over the last few years with the advances in AI, but the shift that we have seen in generative AI space since the release of GPT-3 is unprecedented. This short…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Launch Google Map or Apple Map to show route

Learn how to open Google Maps and/or Apple Maps to show direction between the user’s position and the destination. Using Swift 5 and Xcode 12.

3 iPhones displaying both Google Map and Apple Map
From the author

Difficulty: Beginner | Easy | Normal | Challenging

Environment : Xcode 12 & UIKit

Open Xcode > new project > Storyboard Interface and call it MapDirection

Create a new Swift file from Xcode and call it OpenMapDirections, then copy/paste the following code in it:

We will use the above code to present an alert controller with 2 actions: one for opening Google Maps, the other to open Apple Maps. Here we pass the coordinate for both directly. Note that for Google Maps, we are using an URL, for Apple it’s handling through the MapKit framework.

Head back to your ViewController, we will present the alert from there to open the map. Copy/paste the following button declaration over the viewDidLoad method:

Then, we set up the button and pass it the function that we created at first:

Add a comment

Related posts:

Free House Buyers Florida Tasks Online

You might have heard people saying that they are earning a monthly house buyers Florida income online. If you want to be one of them, you need to explore and know the basic facts about house buyers…

What Is the Data Analysis Process? 7 Key Steps to Follow

Data analysis is an essential part of making informed decisions and drawing insights from data. However, before beginning the data analysis process, there are certain mandatory steps that need to be…