#CodeSnippets 中文介绍 some code snippets for Xcode, let you code easy
if you want to know more a bout snippets, see Mattt Thompson
's blog: Xcode Snippets
- download CodeSnippets
- run
install_all_snippets.sh
- restart Xcode
code snippets is storage in ~/Library/Developer/Xcode/UserData/CodeSnippets
, if you don't like some snippets, you can delete it
- @pStrong for strong
- @pCopy for copy
- @pWeak for weak
- @pAssign for Assign
- @pRStrong for strong
- @pRCopy for copy
- @pRWeak for weak
- @pRAssign for Assign
- @pButton for button
- @pView for view
- @pImageView for imageView
- @pLabel for label
- @pString for string
- @pURL for URL
- @pArray for array
- @pDictionary for dictionary
- @pMutableArray for mutableArray
- @pMutableDictionary for mutableDictionary
- @pDelegate for delegate
- @pBool for BOOL
- @pFloat for float
- @pInteget for NSInteger
- @pUinteger for NSUInteger
- UIViewCreate: create UIView
- UIButtonCreate: create button
- UIImageViewCreate: create imageView
- UILableCreate: create UILabel
this is a growing repository. code snippets can make coding easily and improving efficiency. but one person's power is weak, if you have some snippets, you can create pull request
to make a contribute
- write down the code, tips: <#placeholder#> can make a placeholder
- drag to Xcode's Code Snippet panel
- edit it use Xcode
- edit it in
~/Library/Developer/Xcode/UserData/CodeSnippets
modify it's name in ~/Library/Developer/Xcode/UserData/CodeSnippets
, make it easy to find. and modify it's identifier, because identifier must be equal to name
then create a new pull request, and commit the code snippet
CodeSnippets is released under the MIT license. See LICENSE file for details.
代码块是Xcode的一个牛逼(装逼)功能,能通过自动补全,让你快速写代码,提高工作效率。
如果你想详细了解代码块,可以看一下这篇文章:Xcode Snippets中文版
- 下载CodeSnippets
- 在终端中运行
install_all_snippets.sh
- 重启Xcode
代码块实际是一个一个的文件,储存在~/Library/Developer/Xcode/UserData/CodeSnippets
,如果你不喜欢哪个代码快,直接在里面把他干掉就是了
- @pStrong: strong类型
- @pCopy: copy类型
- @pWeak: weak类型
- @pAssign: Assign类型
- @pRStrong: readonly strong
- @pRCopy: readonly copy
- @pRWeak: readonly weak
- @pRAssign: readonly Assign
- @pButton for button
- @pView for view
- @pImageView for imageView
- @pLabel for label
- @pString for string
- @pURL for URL
- @pArray for array
- @pDictionary for dictionary
- @pMutableArray for mutableArray
- @pMutableDictionary for mutableDictionary
- @pDelegate for delegate
- @pBool for BOOL
- @pFloat for float
- @pInteget for NSInteger
- @pUinteger for NSUInteger
- UIViewCreate: create UIView
- UIButtonCreate: create button
- UIImageViewCreate: create imageView
- UILableCreate: create UILabel
代码块可以帮助大家提高代码效率,规范代码书写,是一个很好的东西。但是我一个人的力量是有限的,很难做到尽善尽美。所以需要大家共同来维护好这个项目。如果你有常用的代码,可以把他做成代码块,上传上来,提高自己代码效率的同时也可以帮助其他人。
- 写下代码。tips:使用<#placeholder#>可以创建占位符
- 将代码拖到Xcode的代码块栏
- 用Xcode编辑代码块(主要修改title和自动补全符)
- 在
~/Library/Developer/Xcode/UserData/CodeSnippets
里编辑代码块(主要为了更方便查找,默认的代码块名字完全看不懂)
在~/Library/Developer/Xcode/UserData/CodeSnippets
中编辑代码块:
创建完代码块之后,创建一个pull request,把你的代码块提交上来,这样其他人也可以使用了
CodeSnippets 使用 MIT 许可证,详情见 LICENSE 文件。