Skip to content

Instantly share code, notes, and snippets.

@berikv
Last active August 29, 2015 14:17
Show Gist options
  • Save berikv/8c3662da3c1d8cc10a0c to your computer and use it in GitHub Desktop.
Save berikv/8c3662da3c1d8cc10a0c to your computer and use it in GitHub Desktop.
Xcode snippet for dispatch_after in Swift. Move this file to ~/Library/Developer/Xcode/UserData/CodeSnippets. Use Finder CMD+Shift+G
<?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>dispatch_after</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>CodeExpression</string>
</array>
<key>IDECodeSnippetContents</key>
<string>let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(&lt;#seconds: Double#&gt; * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) { &lt;#code: dispatch_block_t#&gt; }
</string>
<key>IDECodeSnippetIdentifier</key>
<string>E99271D4-D7FD-4820-A154-210E8E143F00</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Swift</string>
<key>IDECodeSnippetSummary</key>
<string>Swift dispatch after</string>
<key>IDECodeSnippetTitle</key>
<string>Dispatch after</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>0</integer>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment