Skip to content

Instantly share code, notes, and snippets.

@itjustcrashed
Created August 9, 2024 23:11

Revisions

  1. itjustcrashed created this gist Aug 9, 2024.
    34 changes: 34 additions & 0 deletions openinmaps.codesnippet
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    <!--- 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=&amp;daddr=&lt;#latitude#&gt;,&lt;#longitude#&gt;")
    if UIApplication.shared.canOpenURL(mapsURL!) {
    UIApplication.shared.open(mapsURL!)
    } else {
    &lt;#Handle nonexistant Maps#&gt;
    }</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>