├── README.md ├── Rakefile ├── fuckingBlockMethod.codesnippet ├── fuckingBlockProperty.codesnippet ├── fuckingBlockTypedef.codesnippet ├── fuckingBlockVariable.codesnippet └── tasks └── copy_snippets.rake /README.md: -------------------------------------------------------------------------------- 1 | Fucking Block Syntax Autocompletion 2 | =================================== 3 | 4 | Xcode snippets for [Fucking Block Syntax](http://www.fuckingblocksyntax.com). 5 | 6 | Hopefully this will relieve you of [cheat sheets](http://twobitlabs.com/2012/12/objective-c-ios-blocks-cheat-sheet/). 7 | 8 | ## Installation 9 | 10 | git clone https://github.com/schukin/Fucking-Block-Syntax-Autocompletion.git 11 | cd Fucking-Block-Syntax-Autocompletion 12 | rake 13 | 14 | ## Usage 15 | 16 | Just start typing `fuckingBlock` and Xcode will do the rest (and do its best job at taking scope into account). 17 | 18 | ### Fucking Block Typedef 19 | 20 | ![Fucking block typedef](http://i.imgur.com/octBGuC.gif) 21 | 22 | ### Fucking Block Property 23 | 24 | ![Fucking block property](http://i.imgur.com/HyutIyO.gif) 25 | 26 | ### Fucking Block as method argument 27 | 28 | ![Fucking block as method argument](http://i.imgur.com/dPj1Vtn.gif) 29 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | Dir["#{File.dirname(__FILE__)}/tasks/**/*.rake"].sort.each { |ext| load ext } -------------------------------------------------------------------------------- /fuckingBlockMethod.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | fuckingBlockMethod 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)someMethodThatTakesABlock:(<#returnType#> (^)(<#parameterTypes#>))<#parameterName#> 13 | { 14 | 15 | } 16 | IDECodeSnippetIdentifier 17 | 53CDDB0B-544D-4335-AD0A-103F6C45D41E 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | Declares a method that takes a fucking block as its first parameter 22 | IDECodeSnippetTitle 23 | FuckingBlockMethod 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 0 28 | 29 | 30 | -------------------------------------------------------------------------------- /fuckingBlockProperty.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | fuckingBlockProperty 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassInterfaceMethods 10 | 11 | IDECodeSnippetContents 12 | @property (nonatomic, copy) <#returnType#> (^<#blockName#>)(<#parameterTypes#>); 13 | IDECodeSnippetIdentifier 14 | 8C3FC56B-9DD1-4DE7-90E0-8575D6357648 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Delcares a block as a fucking property 19 | IDECodeSnippetTitle 20 | FuckingBlockProperty 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /fuckingBlockTypedef.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | fuckingBlockTypedef 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | typedef <#returnType#> (^<#TypeName#>)(<#parameterTypes#>); 13 | IDECodeSnippetIdentifier 14 | A271C8AC-E9A4-4D8E-B2DA-3EB1057A2C15 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Typedefs a fucking block 19 | IDECodeSnippetTitle 20 | FuckingBlockTypedef 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 0 25 | 26 | 27 | -------------------------------------------------------------------------------- /fuckingBlockVariable.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | fuckingBlockVariable 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | <#returnType#> (^<#blockName#>)(<#parameterTypes#>) = ^<#returnType#>(<#parameters#>) { 13 | <#code#> 14 | }; 15 | IDECodeSnippetIdentifier 16 | C1E94D80-DBEE-41EF-96D4-164DFF5F123A 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Declares a block as a fucking local variable 21 | IDECodeSnippetTitle 22 | FuckingBlockVariable 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 0 27 | 28 | 29 | -------------------------------------------------------------------------------- /tasks/copy_snippets.rake: -------------------------------------------------------------------------------- 1 | desc 'Copies all the snippets into Xcode' 2 | task :default do 3 | code_snippet_path = File.expand_path('~/Library/Developer/Xcode/UserData/CodeSnippets/') 4 | `mkdir -p '#{code_snippet_path}'` 5 | `cp *.codesnippet '#{code_snippet_path}'` 6 | puts "Fucking block syntax snippets have been copied to #{code_snippet_path}" 7 | 8 | xcode=`ps x -o comm | grep Xcode\\$` 9 | if xcode != '' 10 | puts "Please restart XCode for the changes to take effect."; 11 | end 12 | end 13 | --------------------------------------------------------------------------------