DEV Community

loading...

How To Open Apple Maps From An Address In SwiftUI

yourdevguy profile image Mike Haslam ・1 min read

Alt Text

In an iOS app I am working on I need to show a map from an address.
But after researching and asking some questions I was able to get it to work.

I must admit I struggled quite a bit with how to show an alert if the address string was invalid In hindsight, the solution is pretty straightforward. It comes down to just Observing a published property in an Observable Object Class.

I am finding that SwiftUI has really made things a lot simpler.
I put up a small repository using this feature maybe it would be helpful to others.

Open Apple Maps In SwiftUI

Here are some resources I used in my research.

Apple docs

Ray Wenderlich Tutorial

Hacking With Swift

Discussion (0)

pic
Editor guide