Created
August 9, 2024 23:11
-
-
Save itjustcrashed/587dec599ad16a1149bc6800c0486e5c to your computer and use it in GitHub Desktop.
Open in Apple Maps Xcode Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Paste into ~/Library/Developer/Xcode/UserData/CodeSnippets ---> | |
<!--- Created by @wannafedor4 aka @itjustcrashed ---> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>IDECodeSnippetCompletionPrefix</key> | |
<string>maps_url</string> | |
<key>IDECodeSnippetCompletionScopes</key> | |
<array> | |
<string>CodeBlock</string> | |
</array> | |
<key>IDECodeSnippetContents</key> | |
<string>let mapsURL = URL(string: "maps://?saddr=&daddr=<#latitude#>,<#longitude#>") | |
if UIApplication.shared.canOpenURL(mapsURL!) { | |
UIApplication.shared.open(mapsURL!) | |
} else { | |
<#Handle nonexistant Maps#> | |
}</string> | |
<key>IDECodeSnippetIdentifier</key> | |
<string>353EE9E1-EB3B-431E-B706-F5E71C9BF9B3</string> | |
<key>IDECodeSnippetLanguage</key> | |
<string>Xcode.SourceCodeLanguage.Swift</string> | |
<key>IDECodeSnippetSummary</key> | |
<string>Check if Apple Maps is installed, and launch it with specified coordinates.</string> | |
<key>IDECodeSnippetTitle</key> | |
<string>Open in Maps</string> | |
<key>IDECodeSnippetUserSnippet</key> | |
<true/> | |
<key>IDECodeSnippetVersion</key> | |
<integer>2</integer> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment