├── .gitignore ├── ClearSnippets.command ├── ExportSnippets.command ├── FindNewSnippets.command ├── GitUpdate.command ├── ImportSnippets.command ├── LICENSE ├── README.md ├── SnippetImporter ├── SnippetImporter.xcodeproj │ └── project.pbxproj └── SnippetImporter │ ├── SnippetImporter-Prefix.pch │ ├── SnippetImporter.1 │ ├── SnippetImporter.h │ ├── SnippetImporter.m │ └── main.m ├── Xcode4CodeSnippets.xcworkspace └── contents.xcworkspacedata ├── bin └── snippetimporter ├── snippets.sh ├── sst_animblock.codesnippet ├── sst_animfullblock.codesnippet ├── sst_animspringblock.codesnippet ├── sst_appearance_spelunk_block.codesnippet ├── sst_assert_main_thread.codesnippet ├── sst_block_inline.codesnippet ├── sst_block_named_variable.codesnippet ├── sst_block_peform_after_delay.codesnippet ├── sst_blockmethod.codesnippet ├── sst_blocknoparamsmethod.codesnippet ├── sst_class_extension.codesnippet ├── sst_collectionview_delegate.codesnippet ├── sst_constraints_fill.codesnippet ├── sst_date_is_after.codesnippet ├── sst_debuglog.codesnippet ├── sst_debuglog_method.codesnippet ├── sst_debuglogd.codesnippet ├── sst_define_gcd_run_on_main_queue.codesnippet ├── sst_define_macros.codesnippet ├── sst_define_singleton_macro.codesnippet ├── sst_deprecated.codesnippet ├── sst_directory_exists.codesnippet ├── sst_dl.codesnippet ├── sst_dl_error.codesnippet ├── sst_dl_object.codesnippet ├── sst_document_delete.codesnippet ├── sst_draw_image_method.codesnippet ├── sst_draw_image_with_block.codesnippet ├── sst_error_create.codesnippet ├── sst_file_exists.codesnippet ├── sst_fmtdatetime.codesnippet ├── sst_gcd_async_wait.codesnippet ├── sst_gcd_asyncqueue.codesnippet ├── sst_gcd_default_priority_queue.codesnippet ├── sst_gcd_dispatchafter.codesnippet ├── sst_gcd_getqueuelabel.codesnippet ├── sst_gcd_high_priority_queue.codesnippet ├── sst_gcd_low_priority_queue.codesnippet ├── sst_gcd_main_queue.codesnippet ├── sst_gcd_wait_for_blocks.codesnippet ├── sst_height_for_vc_view.codesnippet ├── sst_height_main_screen.codesnippet ├── sst_image_resize_to_max.codesnippet ├── sst_inline_block_variable.codesnippet ├── sst_is_ios7_or_later.codesnippet ├── sst_isviewcontrollervisible.codesnippet ├── sst_localized_string.codesnippet ├── sst_log.codesnippet ├── sst_log_fonts.codesnippet ├── sst_log_mode.codesnippet ├── sst_maassert.codesnippet ├── sst_maassert_defined.codesnippet ├── sst_method.codesnippet ├── sst_notification_block_observer_property.codesnippet ├── sst_notification_handler.codesnippet ├── sst_notification_named_block.codesnippet ├── sst_notification_observe.codesnippet ├── sst_notification_observer_property.codesnippet ├── sst_notification_observewithblock.codesnippet ├── sst_notification_post.codesnippet ├── sst_notification_post_with_userinfo.codesnippet ├── sst_notification_remove.codesnippet ├── sst_notification_remove_block_observer.codesnippet ├── sst_nsassert.codesnippet ├── sst_nsassert_blocks.codesnippet ├── sst_pragma_unused.codesnippet ├── sst_prepareforsegue.codesnippet ├── sst_prop.codesnippet ├── sst_run_on_main_thread.codesnippet ├── sst_section_header.codesnippet ├── sst_string_constant_header.codesnippet ├── sst_string_constant_implementation.codesnippet ├── sst_string_contains.codesnippet ├── sst_string_height_attributed.codesnippet ├── sst_string_height_regular.codesnippet ├── sst_string_starts_with.codesnippet ├── sst_strong_self.codesnippet ├── sst_suppress_deprecation_warnings.codesnippet ├── sst_tableview_delegates.codesnippet ├── sst_udid_create.codesnippet ├── sst_unwind_segue.codesnippet ├── sst_viewdidappear.codesnippet ├── sst_viewdiddisappear.codesnippet ├── sst_viewdidload.codesnippet ├── sst_viewwillappear.codesnippet ├── sst_viewwilldissappear.codesnippet └── sst_weak_self.codesnippet /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | tmp 3 | 4 | # Generated by http://gitignore.io 5 | 6 | ### Objective-C ### 7 | # Xcode 8 | .DS_Store 9 | */build/* 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | profile 20 | *.moved-aside 21 | DerivedData 22 | .idea/ 23 | *.hmap 24 | -------------------------------------------------------------------------------- /ClearSnippets.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GitRoot="`dirname \"$0\"`" 6 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 7 | 8 | if [ ! -d "${SnippetsDir}" ]; then 9 | mkdir -p "${SnippetsDir}" 10 | fi 11 | 12 | pushd . 13 | cd ${GitRoot} 14 | rm "${SnippetsDir}/sst_*.codesnippet" 15 | popd 16 | -------------------------------------------------------------------------------- /ExportSnippets.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GitRoot="`dirname \"$0\"`" 6 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 7 | 8 | if [ ! -d "${SnippetsDir}" ]; then 9 | mkdir -p "${SnippetsDir}" 10 | fi 11 | 12 | pushd . 13 | cd "${GitRoot}" 14 | cp sst_*.codesnippet "${SnippetsDir}" 15 | popd 16 | -------------------------------------------------------------------------------- /FindNewSnippets.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 6 | 7 | if [ ! -d "${SnippetsDir}" ]; then 8 | mkdir -p "${SnippetsDir}" 9 | fi 10 | 11 | ls "${SnippetsDir}/*.codesnippet" | grep -v sst_ 12 | -------------------------------------------------------------------------------- /GitUpdate.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GitRoot="`dirname \"$0\"`" 6 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 7 | 8 | if [ ! -d "${SnippetsDir}" ]; then 9 | mkdir -p "${SnippetsDir}" 10 | fi 11 | 12 | pushd . 13 | cd ${GitRoot} 14 | git pull 15 | cp sst_*.codesnippet "${SnippetsDir}" 16 | popd 17 | -------------------------------------------------------------------------------- /ImportSnippets.command: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GitRoot="`dirname \"$0\"`" 6 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 7 | 8 | if [ ! -d "${SnippetsDir}" ]; then 9 | mkdir -p "${SnippetsDir}" 10 | fi 11 | 12 | pushd . 13 | cd "${GitRoot}" 14 | cp "${SnippetsDir}/sst_*.codesnippet" . 15 | popd 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Brennan Stehling 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Xcode Code Snippets 2 | 3 | I've created or collected the following code snippets to speed up my work. My snippets focus on a few areas. 4 | 5 | * animation 6 | * blocks 7 | * async (GCD and queues) 8 | * notifications 9 | * debugging 10 | * formatting 11 | 12 | To use the snippets you will want to place them in the following folder. 13 | 14 | ~/Library/Developer/Xcode/UserData/CodeSnippets 15 | 16 | There is an import and export script which can be used to handle putting these files in place. 17 | 18 | You will need to restart Xcode to see the change. 19 | 20 | I am open to feedback on improving this code or adding more code snippets which would compliment them. 21 | 22 | ## Filename Prefix 23 | 24 | The filenames have a prefix of SST for SmallSharpTools, which is my company. This is done to make it easier to use these snippets alongside other snippets you may want to use either that you created or another GitHub repo. A script named GitUpdate.command is included which will pull the latest from GitHub and copy the code snippets in place. If you were to automate this script you could automatically stay current with these snippets. Updates are made periodically to add new snippets or to adjust snippets due to a bug or changes to iOS/Mac APIs. 25 | 26 | ## Snippet Importer 27 | 28 | Managing snippets has been a bit of a manual process. When a new snippet is created with Xcode a new file is added to the working folder with a long name which is not descriptive. The name which is used to name each file within this collection includes the collection prefix, the snippet completion prefix and the file extension. Renaming the automatic names to use this convention was a bit of copy/paste work which has not been eliminated with the Snippet Importer project which builds a command-line utility which is used to copy new files from the working folder to the managed Git folder with a filename using the naming convention and then copied to the working folder again where Xcode will pick it up the next time it is relaunched. This command-line utility takes 3 parameters and also has the help switch (-?) like most utilities. The script snippets.sh uses it in the import option to import newly created snippets to the managed Git folder where the changes can be added and committed to the repository. 29 | 30 | This project and the new importer script are built to help with anyone manage their collection with their own prefix. 31 | 32 | ## Caveat 33 | 34 | I found that copying a snippet to create a modified version without changing the Guid value causes Xcode to crash. I expect a conflicting keyword would also be a problem. The import/export process to sync snippet collections should handle these details to ensure different files do not cause conflicts. This would likely require a command-line utility or a more advanced shell script. 35 | 36 | ## License 37 | 38 | Xcode Code Snippets are available under the MIT license. See the LICENSE file for more info. 39 | 40 | ## Contact 41 | 42 | Brennan Stehling 43 | [SmallSharpTools](http://www.smallsharptools.com/) 44 | [@smallsharptools](https://twitter.com/smallsharptools) (Twitter) 45 | 46 | -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 26862E761780CEEF001330C8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26862E751780CEEF001330C8 /* Foundation.framework */; }; 11 | 26862E791780CEEF001330C8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 26862E781780CEEF001330C8 /* main.m */; }; 12 | 26862E7D1780CEEF001330C8 /* SnippetImporter.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 26862E7C1780CEEF001330C8 /* SnippetImporter.1 */; }; 13 | 26862E851780CF0E001330C8 /* SnippetImporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 26862E841780CF0E001330C8 /* SnippetImporter.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXCopyFilesBuildPhase section */ 17 | 26862E701780CEEF001330C8 /* CopyFiles */ = { 18 | isa = PBXCopyFilesBuildPhase; 19 | buildActionMask = 2147483647; 20 | dstPath = /usr/share/man/man1/; 21 | dstSubfolderSpec = 0; 22 | files = ( 23 | 26862E7D1780CEEF001330C8 /* SnippetImporter.1 in CopyFiles */, 24 | ); 25 | runOnlyForDeploymentPostprocessing = 1; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 26862E721780CEEF001330C8 /* snippetimporter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = snippetimporter; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 26862E751780CEEF001330C8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 32 | 26862E781780CEEF001330C8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 26862E7B1780CEEF001330C8 /* SnippetImporter-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SnippetImporter-Prefix.pch"; sourceTree = ""; }; 34 | 26862E7C1780CEEF001330C8 /* SnippetImporter.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = SnippetImporter.1; sourceTree = ""; }; 35 | 26862E831780CF0E001330C8 /* SnippetImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetImporter.h; sourceTree = ""; }; 36 | 26862E841780CF0E001330C8 /* SnippetImporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SnippetImporter.m; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 26862E6F1780CEEF001330C8 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | 26862E761780CEEF001330C8 /* Foundation.framework in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 26862E691780CEEF001330C8 = { 52 | isa = PBXGroup; 53 | children = ( 54 | 26862E771780CEEF001330C8 /* SnippetImporter */, 55 | 26862E741780CEEF001330C8 /* Frameworks */, 56 | 26862E731780CEEF001330C8 /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | 26862E731780CEEF001330C8 /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 26862E721780CEEF001330C8 /* snippetimporter */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | 26862E741780CEEF001330C8 /* Frameworks */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 26862E751780CEEF001330C8 /* Foundation.framework */, 72 | ); 73 | name = Frameworks; 74 | sourceTree = ""; 75 | }; 76 | 26862E771780CEEF001330C8 /* SnippetImporter */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 26862E7A1780CEEF001330C8 /* Supporting Files */, 80 | 26862E781780CEEF001330C8 /* main.m */, 81 | 26862E7C1780CEEF001330C8 /* SnippetImporter.1 */, 82 | 26862E831780CF0E001330C8 /* SnippetImporter.h */, 83 | 26862E841780CF0E001330C8 /* SnippetImporter.m */, 84 | ); 85 | path = SnippetImporter; 86 | sourceTree = ""; 87 | }; 88 | 26862E7A1780CEEF001330C8 /* Supporting Files */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 26862E7B1780CEEF001330C8 /* SnippetImporter-Prefix.pch */, 92 | ); 93 | name = "Supporting Files"; 94 | sourceTree = ""; 95 | }; 96 | /* End PBXGroup section */ 97 | 98 | /* Begin PBXNativeTarget section */ 99 | 26862E711780CEEF001330C8 /* SnippetImporter */ = { 100 | isa = PBXNativeTarget; 101 | buildConfigurationList = 26862E801780CEEF001330C8 /* Build configuration list for PBXNativeTarget "SnippetImporter" */; 102 | buildPhases = ( 103 | 26862E6E1780CEEF001330C8 /* Sources */, 104 | 26862E6F1780CEEF001330C8 /* Frameworks */, 105 | 26862E701780CEEF001330C8 /* CopyFiles */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = SnippetImporter; 112 | productName = SnippetImporter; 113 | productReference = 26862E721780CEEF001330C8 /* snippetimporter */; 114 | productType = "com.apple.product-type.tool"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | 26862E6A1780CEEF001330C8 /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | LastUpgradeCheck = 0460; 123 | ORGANIZATIONNAME = "SmallSharpTools LLC"; 124 | }; 125 | buildConfigurationList = 26862E6D1780CEEF001330C8 /* Build configuration list for PBXProject "SnippetImporter" */; 126 | compatibilityVersion = "Xcode 3.2"; 127 | developmentRegion = English; 128 | hasScannedForEncodings = 0; 129 | knownRegions = ( 130 | en, 131 | ); 132 | mainGroup = 26862E691780CEEF001330C8; 133 | productRefGroup = 26862E731780CEEF001330C8 /* Products */; 134 | projectDirPath = ""; 135 | projectRoot = ""; 136 | targets = ( 137 | 26862E711780CEEF001330C8 /* SnippetImporter */, 138 | ); 139 | }; 140 | /* End PBXProject section */ 141 | 142 | /* Begin PBXSourcesBuildPhase section */ 143 | 26862E6E1780CEEF001330C8 /* Sources */ = { 144 | isa = PBXSourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | 26862E791780CEEF001330C8 /* main.m in Sources */, 148 | 26862E851780CF0E001330C8 /* SnippetImporter.m in Sources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXSourcesBuildPhase section */ 153 | 154 | /* Begin XCBuildConfiguration section */ 155 | 26862E7E1780CEEF001330C8 /* Debug */ = { 156 | isa = XCBuildConfiguration; 157 | buildSettings = { 158 | ALWAYS_SEARCH_USER_PATHS = NO; 159 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 160 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 161 | CLANG_CXX_LIBRARY = "libc++"; 162 | CLANG_ENABLE_OBJC_ARC = YES; 163 | CLANG_WARN_CONSTANT_CONVERSION = YES; 164 | CLANG_WARN_EMPTY_BODY = YES; 165 | CLANG_WARN_ENUM_CONVERSION = YES; 166 | CLANG_WARN_INT_CONVERSION = YES; 167 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 168 | COPY_PHASE_STRIP = NO; 169 | GCC_C_LANGUAGE_STANDARD = gnu99; 170 | GCC_DYNAMIC_NO_PIC = NO; 171 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 172 | GCC_OPTIMIZATION_LEVEL = 0; 173 | GCC_PREPROCESSOR_DEFINITIONS = ( 174 | "DEBUG=1", 175 | "$(inherited)", 176 | ); 177 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 178 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 179 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 180 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 181 | GCC_WARN_UNUSED_VARIABLE = YES; 182 | MACOSX_DEPLOYMENT_TARGET = 10.8; 183 | ONLY_ACTIVE_ARCH = YES; 184 | SDKROOT = macosx; 185 | }; 186 | name = Debug; 187 | }; 188 | 26862E7F1780CEEF001330C8 /* Release */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | ALWAYS_SEARCH_USER_PATHS = NO; 192 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 193 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 194 | CLANG_CXX_LIBRARY = "libc++"; 195 | CLANG_ENABLE_OBJC_ARC = YES; 196 | CLANG_WARN_CONSTANT_CONVERSION = YES; 197 | CLANG_WARN_EMPTY_BODY = YES; 198 | CLANG_WARN_ENUM_CONVERSION = YES; 199 | CLANG_WARN_INT_CONVERSION = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | COPY_PHASE_STRIP = YES; 202 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 203 | GCC_C_LANGUAGE_STANDARD = gnu99; 204 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 205 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 206 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 207 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 208 | GCC_WARN_UNUSED_VARIABLE = YES; 209 | MACOSX_DEPLOYMENT_TARGET = 10.8; 210 | SDKROOT = macosx; 211 | }; 212 | name = Release; 213 | }; 214 | 26862E811780CEEF001330C8 /* Debug */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 218 | GCC_PREFIX_HEADER = "SnippetImporter/SnippetImporter-Prefix.pch"; 219 | PRODUCT_NAME = snippetimporter; 220 | }; 221 | name = Debug; 222 | }; 223 | 26862E821780CEEF001330C8 /* Release */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 227 | GCC_PREFIX_HEADER = "SnippetImporter/SnippetImporter-Prefix.pch"; 228 | PRODUCT_NAME = snippetimporter; 229 | }; 230 | name = Release; 231 | }; 232 | /* End XCBuildConfiguration section */ 233 | 234 | /* Begin XCConfigurationList section */ 235 | 26862E6D1780CEEF001330C8 /* Build configuration list for PBXProject "SnippetImporter" */ = { 236 | isa = XCConfigurationList; 237 | buildConfigurations = ( 238 | 26862E7E1780CEEF001330C8 /* Debug */, 239 | 26862E7F1780CEEF001330C8 /* Release */, 240 | ); 241 | defaultConfigurationIsVisible = 0; 242 | defaultConfigurationName = Release; 243 | }; 244 | 26862E801780CEEF001330C8 /* Build configuration list for PBXNativeTarget "SnippetImporter" */ = { 245 | isa = XCConfigurationList; 246 | buildConfigurations = ( 247 | 26862E811780CEEF001330C8 /* Debug */, 248 | 26862E821780CEEF001330C8 /* Release */, 249 | ); 250 | defaultConfigurationIsVisible = 0; 251 | }; 252 | /* End XCConfigurationList section */ 253 | }; 254 | rootObject = 26862E6A1780CEEF001330C8 /* Project object */; 255 | } 256 | -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter/SnippetImporter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SnippetImporter' target in the 'SnippetImporter' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | 9 | // Disables log messages when debugging is turned off 10 | #ifndef NDEBUG 11 | 12 | #define DebugLog(message, ...) NSLog(@"%s: " message, __PRETTY_FUNCTION__, ##__VA_ARGS__) 13 | 14 | #else 15 | 16 | #define DebugLog(message, ...) 17 | 18 | #endif 19 | 20 | #ifndef NS_BLOCK_ASSERTIONS 21 | 22 | // Credit: http://sstools.co/maassert 23 | #define MAAssert(expression, ...) \ 24 | do { \ 25 | if(!(expression)) { \ 26 | NSLog(@"Assertion failure: %s in %s on line %s:%d. %@", #expression, __func__, __FILE__, __LINE__, [NSString stringWithFormat: @"" __VA_ARGS__]); \ 27 | abort(); \ 28 | } \ 29 | } while(0) 30 | 31 | #else 32 | 33 | #define MAAssert(expression, ...) 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter/SnippetImporter.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 6/30/13 \" DATE 7 | .Dt SnippetImporter 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm SnippetImporter, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter/SnippetImporter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SnippetImporter.h 3 | // SnippetImporter 4 | // 5 | // Created by Brennan Stehling on 6/30/13. 6 | // Copyright (c) 2013 SmallSharpTools LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SnippetImporter : NSObject 12 | 13 | - (void)importSnippetsWithSourcePath:(NSString *)sourcePath destinationPath:(NSString *)destinationPath prefix:(NSString *)prefix; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter/SnippetImporter.m: -------------------------------------------------------------------------------- 1 | // 2 | // SnippetImporter.m 3 | // SnippetImporter 4 | // 5 | // Created by Brennan Stehling on 6/30/13. 6 | // Copyright (c) 2013 SmallSharpTools LLC. All rights reserved. 7 | // 8 | 9 | #import "SnippetImporter.h" 10 | 11 | #import 12 | 13 | @implementation SnippetImporter 14 | 15 | - (void)importSnippetsWithSourcePath:(NSString *)sourcePath destinationPath:(NSString *)destinationPath prefix:(NSString *)prefix { 16 | 17 | NSURL *sourceURL = [NSURL URLWithString:[self resolvePath:sourcePath]]; 18 | NSURL *destinationURL = [NSURL URLWithString:[self resolvePath:destinationPath]]; 19 | 20 | // DebugLog(@"source: %@", sourceURL.absoluteString); 21 | // DebugLog(@"destination: %@", destinationURL.absoluteString); 22 | // for (NSString *path in @[@"~/", @".", @"..", sourceURL.absoluteString, destinationURL.absoluteString]) { 23 | // DebugLog(@"Resolved Path: %@", [self resolvePath:path]); 24 | // } 25 | 26 | BOOL isDirectory = TRUE; 27 | if (![[NSFileManager defaultManager] fileExistsAtPath:sourceURL.absoluteString isDirectory:&isDirectory]) { 28 | printf("Source Path does not exist: %s\n", [sourceURL.absoluteString UTF8String]); 29 | return; 30 | } 31 | else if (![[NSFileManager defaultManager] fileExistsAtPath:destinationURL.absoluteString isDirectory:&isDirectory]) { 32 | printf("Destination Path does not exist: %s\n", [destinationURL.absoluteString UTF8String]); 33 | return; 34 | } 35 | else if (!prefix.length) { 36 | printf("Prefix must be defined\n"); 37 | return; 38 | } 39 | 40 | // return; 41 | 42 | NSError *error = nil; 43 | NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:sourceURL.absoluteString error:&error]; 44 | if (error ) { 45 | printf("Error: %s\n", [error.description UTF8String]); 46 | } 47 | else { 48 | for (NSString *filename in directoryContents) { 49 | if (![filename hasPrefix:prefix] && [filename rangeOfString:@".codesnippet"].location != NSNotFound) { 50 | NSURL *fileURL = [sourceURL URLByAppendingPathComponent:filename]; 51 | 52 | NSDictionary *plist = [[NSDictionary alloc] initWithContentsOfFile:fileURL.absoluteString]; 53 | NSString *completionPrefix = plist[@"IDECodeSnippetCompletionPrefix"]; 54 | 55 | if (!completionPrefix.length) { 56 | printf("Snippet needs a completion prefix: %s\n", [fileURL.lastPathComponent UTF8String]); 57 | } 58 | else { 59 | NSString *newName = [NSString stringWithFormat:@"%@%@.codesnippet", prefix, completionPrefix]; 60 | NSURL *newURL = [destinationURL URLByAppendingPathComponent:newName]; 61 | if ([[NSFileManager defaultManager] fileExistsAtPath:newURL.absoluteString]) { 62 | printf("Snippet named '%s' already exists\n", [newName UTF8String]); 63 | } 64 | else { 65 | // do the move and copy operations 66 | NSError *error = nil; 67 | printf("Renaming %s to %s\n", [fileURL.lastPathComponent UTF8String], [newURL.lastPathComponent UTF8String]); 68 | [[NSFileManager defaultManager] moveItemAtPath:fileURL.absoluteString toPath:newURL.absoluteString error:&error]; 69 | if (error) { 70 | printf("Error: %s\n", [error.description UTF8String]); 71 | } 72 | else { 73 | MAAssert(![[NSFileManager defaultManager] fileExistsAtPath:fileURL.absoluteString], @"Source file must not exist anymore"); 74 | MAAssert([[NSFileManager defaultManager] fileExistsAtPath:newURL.absoluteString], @"Destination file must exist"); 75 | 76 | NSURL *copyURL = [sourceURL URLByAppendingPathComponent:newName]; 77 | 78 | if (![[NSFileManager defaultManager] fileExistsAtPath:copyURL.path]) { 79 | [[NSFileManager defaultManager] copyItemAtPath:newURL.absoluteString toPath:copyURL.absoluteString error:&error]; 80 | if (error) { 81 | printf("Error: %s\n", [error.description UTF8String]); 82 | } 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | } 90 | } 91 | 92 | - (NSString *)resolvePath:(NSString *)path { 93 | NSString *expandedPath = [[path stringByExpandingTildeInPath] stringByStandardizingPath]; 94 | const char *cpath = [expandedPath cStringUsingEncoding:NSUTF8StringEncoding]; 95 | char *resolved = NULL; 96 | char *returnValue = realpath(cpath, resolved); 97 | 98 | if (returnValue == NULL && resolved != NULL) { 99 | printf("Error with path: %s\n", resolved); 100 | // if there is an error then resolved is set with the path which caused the issue 101 | // returning nil will prevent further action on this path 102 | return nil; 103 | } 104 | 105 | // DebugLog(@"resolved: %s", resolved); 106 | // DebugLog(@"returnValue: %s", returnValue); 107 | 108 | return [NSString stringWithCString:returnValue encoding:NSUTF8StringEncoding]; 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /SnippetImporter/SnippetImporter/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SnippetImporter 4 | // 5 | // Created by Brennan Stehling on 6/30/13. 6 | // Copyright (c) 2013 SmallSharpTools LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SnippetImporter.h" 12 | 13 | int main(int argc, const char * argv[]) 14 | { 15 | 16 | @autoreleasepool { 17 | NSArray *arguments = [[NSProcessInfo processInfo] arguments]; 18 | // DebugLog(@"arguments: %@", arguments); 19 | 20 | // DebugLog(@"environment: %@", [[NSProcessInfo processInfo] environment]); 21 | 22 | if (arguments.count < 4 || (arguments.count >= 2 && [@"-?" isEqualToString:arguments[1]])) { 23 | printf("%s \n", [[[NSProcessInfo processInfo] processName] UTF8String]); 24 | } 25 | else if (arguments.count >= 4) { 26 | SnippetImporter *importer = [[SnippetImporter alloc] init]; 27 | [importer importSnippetsWithSourcePath:arguments[1] destinationPath:arguments[2] prefix:arguments[3]]; 28 | } 29 | } 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Xcode4CodeSnippets.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 | 27 | 28 | 30 | 31 | 32 | 35 | 37 | 38 | 40 | 41 | 43 | 44 | 46 | 47 | 49 | 50 | 52 | 53 | 55 | 56 | 58 | 59 | 61 | 62 | 64 | 65 | 67 | 68 | 70 | 71 | 73 | 74 | 76 | 77 | 79 | 80 | 82 | 83 | 85 | 86 | 88 | 89 | 91 | 92 | 94 | 95 | 97 | 98 | 100 | 101 | 103 | 104 | 106 | 107 | 109 | 110 | 112 | 113 | 115 | 116 | 118 | 119 | 121 | 122 | 124 | 125 | 127 | 128 | 130 | 131 | 133 | 134 | 136 | 137 | 139 | 140 | 142 | 143 | 145 | 146 | 148 | 149 | 151 | 152 | 154 | 155 | 157 | 158 | 160 | 161 | 163 | 164 | 166 | 167 | 169 | 170 | 172 | 173 | 175 | 176 | 178 | 179 | 181 | 182 | 184 | 185 | 187 | 188 | 190 | 191 | 193 | 194 | 196 | 197 | 199 | 200 | 202 | 203 | 205 | 206 | 208 | 209 | 211 | 212 | 214 | 215 | 217 | 218 | 220 | 221 | 223 | 224 | 226 | 227 | 229 | 230 | 232 | 233 | 235 | 236 | 237 | 238 | -------------------------------------------------------------------------------- /bin/snippetimporter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brennanMKE/XcodeCodeSnippets/373618f0a9eab5f63933ebc7e9d8bfd222c1c712/bin/snippetimporter -------------------------------------------------------------------------------- /snippets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GitRoot="`dirname \"$0\"`" 6 | Prefix="sst_" 7 | SnippetsDir="${HOME}/Library/Developer/Xcode/UserData/CodeSnippets" 8 | 9 | if [ ! -d "${SnippetsDir}" ]; then 10 | mkdir -p "${SnippetsDir}" 11 | fi 12 | 13 | case "$1" in 14 | update) 15 | echo Updating... 16 | pushd . 17 | cd ${GitRoot} 18 | git pull 19 | cp ${Prefix}*.codesnippet "${SnippetsDir}" 20 | popd 21 | ;; 22 | list) 23 | echo Listing... 24 | ls "${SnippetsDir}"/${Prefix}*.codesnippet 25 | ;; 26 | find) 27 | echo Finding... 28 | ls "${SnippetsDir}/*.codesnippet" | grep -v ${Prefix} 29 | ;; 30 | import) 31 | echo Importing... 32 | pushd . 33 | cd ${GitRoot} 34 | cp "${SnippetsDir}/${Prefix}*.codesnippet" . 35 | ./bin/snippetimporter "${SnippetsDir}" . ${Prefix} 36 | popd 37 | ;; 38 | export) 39 | echo Exporting... 40 | cp ${GitRoot}/${Prefix}*.codesnippet "${SnippetsDir}" 41 | ;; 42 | clear) 43 | echo Clearing... 44 | pushd . 45 | cd ${GitRoot} 46 | rm "${SnippetsDir}/${Prefix}*.codesnippet" 47 | popd 48 | ;; 49 | *) 50 | echo "Usage: `basename $0` { update | list | find | import | export | clear }" 51 | ;; 52 | esac 53 | 54 | -------------------------------------------------------------------------------- /sst_animblock.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | animblock 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [UIView animateWithDuration:<#secs#> animations:^{ 13 | <#code#> 14 | } completion:^(BOOL finished) { 15 | }]; 16 | IDECodeSnippetIdentifier 17 | A858B244-50CD-40EE-AA15-BCE28179F6DB 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | Use a block to animate values 22 | IDECodeSnippetTitle 23 | Animation Block 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /sst_animfullblock.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | animfullblock 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState; 13 | [UIView animateWithDuration:<#duration#> delay:<#delay#> options:options animations:^{ 14 | <#code#> 15 | } completion:^(BOOL finished) { 16 | }]; 17 | IDECodeSnippetIdentifier 18 | 37E53BB3-2CE0-4F0F-93D7-8CE9D5B062E5 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Animation block with all parameters 23 | IDECodeSnippetTitle 24 | Animation Block with Options 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_animspringblock.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | animspringblock 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState; 13 | [UIView animateWithDuration:<#duration#> delay:<#delay#> usingSpringWithDamping:<#damping#> initialSpringVelocity:<#velocity#> options:options animations:^{ 14 | <#code#> 15 | } completion:^(BOOL finished) { 16 | if (finished) { 17 | 18 | } 19 | }]; 20 | IDECodeSnippetIdentifier 21 | B3F59F46-E439-468F-A459-69FDCF4CCA7C 22 | IDECodeSnippetLanguage 23 | Xcode.SourceCodeLanguage.Objective-C 24 | IDECodeSnippetSummary 25 | Animation block with Springing 26 | IDECodeSnippetTitle 27 | Animation Block with Springing 28 | IDECodeSnippetUserSnippet 29 | 30 | IDECodeSnippetVersion 31 | 2 32 | 33 | 34 | -------------------------------------------------------------------------------- /sst_appearance_spelunk_block.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | appearance_spelunk_block 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | 13 | - (void)spelunk:(UIView *)view depth:(NSUInteger)depth withAppearanceBlock:(void (^)(UIView *view, NSUInteger depth))appearanceBlock { 14 | DebugLog(@"%i: %@", depth, NSStringFromClass([view class])); 15 | 16 | if (appearanceBlock) { 17 | appearanceBlock(view, depth); 18 | } 19 | 20 | for (UIView *subview in view.subviews) { 21 | [self spelunk:subview depth:depth+1 withAppearanceBlock:appearanceBlock]; 22 | } 23 | } 24 | IDECodeSnippetIdentifier 25 | F878FE21-D8BB-46C0-A3D3-FB4E69219353 26 | IDECodeSnippetLanguage 27 | Xcode.SourceCodeLanguage.Objective-C 28 | IDECodeSnippetSummary 29 | Appearance splunking with a block 30 | IDECodeSnippetTitle 31 | Spelunk with Appearance Block 32 | IDECodeSnippetUserSnippet 33 | 34 | IDECodeSnippetVersion 35 | 2 36 | 37 | 38 | -------------------------------------------------------------------------------- /sst_assert_main_thread.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | main_thread_assert 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | MAAssert([NSThread isMainThread], @"Must be main thread"); 13 | IDECodeSnippetIdentifier 14 | 777D162A-E617-40C6-9EA0-B6F2D5A34657 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Assert the current thread is the main thread 19 | IDECodeSnippetTitle 20 | Main Thread Assertion 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_block_inline.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | block_inline 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | // return_type (^blockName)(var_type) = ^return_type (var_type varName) 13 | <#returnType#> (^<#blockName#>)(<#varType#>) = ^<#returnType#> (<#varType#> <#varName#>) { 14 | return <#code#>; 15 | }; 16 | 17 | // <#blockName#>(<#variable#>); 18 | 19 | IDECodeSnippetIdentifier 20 | 798E6B0A-8771-4405-9E71-0ABDBA13F1D4 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.Objective-C 23 | IDECodeSnippetSummary 24 | Declare an inline block (anonymous function) 25 | IDECodeSnippetTitle 26 | Inline Block 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /sst_block_named_variable.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | block_named_variable 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | void (^<#blockName#>)(NSData *data) = ^void (NSData *data, NSError *error) { 13 | }; 14 | IDECodeSnippetIdentifier 15 | D88E94F8-5D69-436B-B4A5-744E0BE9C7AA 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Block variable with name 20 | IDECodeSnippetTitle 21 | Block Variable with Name 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_block_peform_after_delay.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | block_peform_after_delay 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | 13 | - (void)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay { 14 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_main_queue(), block); 15 | } 16 | IDECodeSnippetIdentifier 17 | 851D7157-973A-4DA0-B7EE-8C30EBBA1F3B 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | Executes a block after a delay 22 | IDECodeSnippetTitle 23 | Perform Block After Delay 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /sst_blockmethod.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | blockmethod 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)<#methodName#>WithCompletionBlock:(void (^)(NSString *message, NSError *error))completionBlock { 13 | NSString *message = nil; 14 | NSError *error = nil; 15 | 16 | if (completionBlock) { 17 | completionBlock(message, error); 18 | } 19 | } 20 | 21 | IDECodeSnippetIdentifier 22 | 03E04BF1-75FA-4BE8-888C-2D6D761A1FD6 23 | IDECodeSnippetLanguage 24 | Xcode.SourceCodeLanguage.Objective-C 25 | IDECodeSnippetSummary 26 | Method using block callback 27 | IDECodeSnippetTitle 28 | Block: Method with parameters 29 | IDECodeSnippetUserSnippet 30 | 31 | IDECodeSnippetVersion 32 | 2 33 | 34 | 35 | -------------------------------------------------------------------------------- /sst_blocknoparamsmethod.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | blocknoparamsmethod 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)<#methodName#>WithCompletionBlock:(void (^)())completionBlock { 13 | 14 | if (completionBlock) { 15 | completionBlock(); 16 | } 17 | } 18 | 19 | IDECodeSnippetIdentifier 20 | F7C9BFB4-0432-412D-B466-8C17119D8BBC 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.Objective-C 23 | IDECodeSnippetSummary 24 | Method using block feature 25 | IDECodeSnippetTitle 26 | Block: Method with no parameters 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /sst_class_extension.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | class_extension 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | #pragma mark - Class Extension 13 | #pragma mark - 14 | 15 | @interface <#Class Name#> () 16 | 17 | @end 18 | IDECodeSnippetIdentifier 19 | 36B81452-9984-4004-87E0-E21C18AF7D4E 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.Objective-C 22 | IDECodeSnippetSummary 23 | Creates an empty class extension 24 | IDECodeSnippetTitle 25 | Class Extension 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /sst_collectionview_delegate.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | collectionview_delegate 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | #pragma mark - UICollectionViewDataSource 13 | #pragma mark - 14 | 15 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 16 | return <#number#>; 17 | } 18 | 19 | // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: 20 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 21 | // dequeue named cell template 22 | return nil; 23 | } 24 | 25 | #pragma mark - UICollectionViewDelegate 26 | #pragma mark - 27 | 28 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { 29 | NSLog(@"Selected item!"); 30 | } 31 | 32 | IDECodeSnippetIdentifier 33 | 0D871A54-996B-4016-ACB8-09631B50F5F5 34 | IDECodeSnippetLanguage 35 | Xcode.SourceCodeLanguage.Objective-C 36 | IDECodeSnippetSummary 37 | Collection view data source and delegate methods 38 | IDECodeSnippetTitle 39 | UICollectionView Delegates 40 | IDECodeSnippetUserSnippet 41 | 42 | IDECodeSnippetVersion 43 | 2 44 | 45 | 46 | -------------------------------------------------------------------------------- /sst_constraints_fill.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | constraints_fill 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | UIView *view = <#view#>; 13 | NSDictionary *views = NSDictionaryOfVariableBindings(view); 14 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:0 metrics:nil views:views]]; 15 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:0 metrics:nil views:views]]; 16 | 17 | IDECodeSnippetIdentifier 18 | 25F5BF09-24C0-49D7-9869-9E40A8D08DC5 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Set constraints to fill container view 23 | IDECodeSnippetTitle 24 | Fill container with view with constraints 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_date_is_after.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | date_is_after 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | BOOL isAfter = [[NSDate distantFuture] compare:[NSDate distantPast]] == NSOrderedDescending; 14 | IDECodeSnippetIdentifier 15 | 1B0DC3C5-80DC-4A75-9239-BD77476A6868 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Date comparison logic 20 | IDECodeSnippetTitle 21 | Is date after other date 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_debuglog.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | dl_object 7 | IDECodeSnippetCompletionScopes 8 | 9 | StringOrComment 10 | 11 | IDECodeSnippetContents 12 | DebugLog(@"%@", <#object#>); 13 | IDECodeSnippetIdentifier 14 | 28C73FC1-6D93-4C81-B20D-90456F0AFD4F 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Log a message when Debug is defined 19 | IDECodeSnippetTitle 20 | DebugLog with object 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_debuglog_method.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | dl_method 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | DebugLog(@"%@", NSStringFromSelector(_cmd)); 13 | IDECodeSnippetIdentifier 14 | 671BAB24-7AD8-45F5-B4AF-ED9A3E82A8F3 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Logs the name of the current method 19 | IDECodeSnippetTitle 20 | Debug Log Method 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_debuglogd.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | debuglogd 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | // Make sure NDEBUG is defined on Release 13 | #ifndef NDEBUG 14 | #define DebugLog(message, ...) NSLog(@"%s: " message, __PRETTY_FUNCTION__, ##__VA_ARGS__) 15 | #else 16 | #define DebugLog(message, ...) 17 | #endif 18 | 19 | IDECodeSnippetIdentifier 20 | E2F44991-FFC7-4DCD-9AC6-72FCBCAEEB79 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.Objective-C 23 | IDECodeSnippetSummary 24 | Macro defined in .pch file 25 | IDECodeSnippetTitle 26 | DebugLog Defined 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /sst_define_gcd_run_on_main_queue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | define_gcd_run_on_main_queue 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | #define gcd_run_on_main_queue(block) \ 13 | if ([NSThread isMainThread]) \ 14 | block(); \ 15 | else \ 16 | dispatch_sync(dispatch_get_main_queue(), block); \ 17 | 18 | IDECodeSnippetIdentifier 19 | E0ED4CE8-5755-4F3F-B698-F1F0426B1A35 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.Objective-C 22 | IDECodeSnippetSummary 23 | Macro to run block safely on main queue (put in .pch) 24 | IDECodeSnippetTitle 25 | GCD: Run on Main Queue 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /sst_define_macros.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | define_macros 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 13 | 14 | #define isiOS7OrLater floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 15 | 16 | #define LOG_FRAME(label, frame) DebugLog(@"%@: %f, %f, %f, %f", label, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height) 17 | #define LOG_SIZE(label, size) DebugLog(@"%@, %f, %f", label, size.width, size.height) 18 | #define LOG_POINT(label, point) DebugLog(@"%@: %f, %f", label, point.x, point.y) 19 | #define LOG_OFFSET(label, offset) DebugLog(@"%@: %f, %f", label, offset.x, offset.y) 20 | #define LOG_INSET(label, inset) DebugLog(@"%@: %f, %f, %f, %f", label, inset.top, inset.left, inset.bottom, inset.right) 21 | #define LOG_INDEXPATH(label, indexPath) DebugLog(@"%@: %li, %li", label, indexPath.section, indexPath.row) 22 | #define LOG_INDEXPATH2(label, indexPath) DebugLog(@"%@: %li, %li", label, indexPath.section, indexPath.item) 23 | IDECodeSnippetIdentifier 24 | B04E18FF-467E-409B-9902-ABF9321F90E3 25 | IDECodeSnippetLanguage 26 | Xcode.SourceCodeLanguage.Objective-C 27 | IDECodeSnippetSummary 28 | Defines macros with various uses 29 | IDECodeSnippetTitle 30 | Define Macros 31 | IDECodeSnippetUserSnippet 32 | 33 | IDECodeSnippetVersion 34 | 2 35 | 36 | 37 | -------------------------------------------------------------------------------- /sst_define_singleton_macro.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | define_singleton_macro 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | // Adapted to ARC from Matt Gallagher of CocoaWithLove 13 | // Insert into in .pch to use in a project 14 | #define SYNTHESIZE_SINGLETON_FOR_HEADER(classname) \ 15 | + (classname *)sharedInstance; 16 | 17 | #define SYNTHESIZE_SINGLETON_FOR_CLASS(classname) \ 18 | \ 19 | static classname *sharedInstance = nil; \ 20 | static dispatch_once_t onceToken; \ 21 | \ 22 | + (classname *)sharedInstance \ 23 | { \ 24 | dispatch_once(&onceToken, ^{ \ 25 | sharedInstance = [[classname alloc] init]; \ 26 | }); \ 27 | \ 28 | return sharedInstance; \ 29 | } \ 30 | \ 31 | IDECodeSnippetIdentifier 32 | 95A017B9-D632-4E2C-8E19-A54D758299CF 33 | IDECodeSnippetLanguage 34 | Xcode.SourceCodeLanguage.Objective-C 35 | IDECodeSnippetSummary 36 | Creates a macro to generate a singleton instance 37 | IDECodeSnippetTitle 38 | Define Singleton Macro 39 | IDECodeSnippetUserSnippet 40 | 41 | IDECodeSnippetVersion 42 | 2 43 | 44 | 45 | -------------------------------------------------------------------------------- /sst_deprecated.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | deprecated 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | __deprecated 13 | IDECodeSnippetIdentifier 14 | 7C9D3872-0D01-4D11-ADFC-5E857E3E7840 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C-Plus-Plus 17 | IDECodeSnippetSummary 18 | Place at the end of a function definition. 19 | IDECodeSnippetTitle 20 | Deprecated 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_directory_exists.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | directory_exists 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | BOOL isDirectory = TRUE; 13 | BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:url.path isDirectory:&isDirectory]; 14 | IDECodeSnippetIdentifier 15 | 4F948707-0C37-40F0-A273-F978027AEF43 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Directory Exists 20 | IDECodeSnippetTitle 21 | Directory Exists 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_dl.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | dl 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | DebugLog(@"<#message#>"); 13 | IDECodeSnippetIdentifier 14 | 11742D90-89B8-4020-9B2B-390E743E1177 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Write to the console if debug is enabled 19 | IDECodeSnippetTitle 20 | DebugLog with string 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_dl_error.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | dl_error 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | DebugLog(@"Error: %@", error); 13 | IDECodeSnippetIdentifier 14 | EC4D33F2-99BE-434C-BB06-4F978AD0CD5D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Log Error in Debug Mode 19 | IDECodeSnippetTitle 20 | Log Error in Debug Mode 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_dl_object.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | dl_object 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | DebugLog(@"<#name#>: %@", <#name#>); 13 | IDECodeSnippetIdentifier 14 | 91F856F9-591E-400A-9715-82B56B975104 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | DebugLog an Object 19 | IDECodeSnippetTitle 20 | DebugLog an Object 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_document_delete.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | document_delete 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)deleteDocument:(UIDocument *)document withCompletionBlock:(void (^)())completionBlock { 13 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ 14 | 15 | NSError *fileCoordinatorError = nil; 16 | 17 | [[[NSFileCoordinator alloc] initWithFilePresenter:nil] coordinateWritingItemAtURL:document.fileURL options:NSFileCoordinatorWritingForDeleting error:&fileCoordinatorError byAccessor:^(NSURL *newURL) { 18 | 19 | // extra check to ensure coordinator is not running on main thread 20 | NSAssert(![NSThread isMainThread], @"Must be not be on main thread"); 21 | 22 | // create a fresh instance of NSFileManager since it is not thread-safe 23 | NSFileManager *fileManager = [[NSFileManager alloc] init]; 24 | NSError *error = nil; 25 | if (![fileManager removeItemAtURL:newURL error:&error]) { 26 | NSLog(@"Error: %@", error); 27 | // TODO handle the error 28 | } 29 | 30 | if (completionBlock) { 31 | completionBlock(); 32 | } 33 | }]; 34 | }); 35 | } 36 | IDECodeSnippetIdentifier 37 | 67823B27-1A69-4AB1-B341-7830FBA0FD62 38 | IDECodeSnippetLanguage 39 | Xcode.SourceCodeLanguage.Objective-C 40 | IDECodeSnippetSummary 41 | Delete Document 42 | IDECodeSnippetTitle 43 | Delete Document 44 | IDECodeSnippetUserSnippet 45 | 46 | IDECodeSnippetVersion 47 | 2 48 | 49 | 50 | -------------------------------------------------------------------------------- /sst_draw_image_method.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | draw_image_method 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (UIImage *)<#method name#> { 13 | static UIImage *image = nil; 14 | static dispatch_once_t onceToken; 15 | dispatch_once(&onceToken, ^{ 16 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(<#width#>, <#height#>), NO, 0.0f); 17 | 18 | // START DRAWING 19 | { 20 | // insert code from PaintCode here 21 | <#code#> 22 | } 23 | // END DRAWING 24 | 25 | image = UIGraphicsGetImageFromCurrentImageContext(); 26 | UIGraphicsEndImageContext(); 27 | 28 | }); 29 | return image; 30 | } 31 | IDECodeSnippetIdentifier 32 | 2ECC9396-0D80-4CA8-A4AE-D65874684D35 33 | IDECodeSnippetLanguage 34 | Xcode.SourceCodeLanguage.Objective-C 35 | IDECodeSnippetSummary 36 | Returns an image drawn with code 37 | IDECodeSnippetTitle 38 | Draw Image Method 39 | IDECodeSnippetUserSnippet 40 | 41 | IDECodeSnippetVersion 42 | 2 43 | 44 | 45 | -------------------------------------------------------------------------------- /sst_draw_image_with_block.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | draw_image 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | UIGraphicsBeginImageContextWithOptions(CGSizeMake(<#width#>, <#height#>), NO, 0.0f); 13 | 14 | // insert code from PaintCode here 15 | <#code#> 16 | 17 | image = UIGraphicsGetImageFromCurrentImageContext(); 18 | UIGraphicsEndImageContext(); 19 | //use image 20 | IDECodeSnippetIdentifier 21 | 801AC0C2-656A-4E2B-86AD-474643176268 22 | IDECodeSnippetLanguage 23 | Xcode.SourceCodeLanguage.Objective-C 24 | IDECodeSnippetSummary 25 | Returns image from drawing code 26 | IDECodeSnippetTitle 27 | Image Draw 28 | IDECodeSnippetUserSnippet 29 | 30 | IDECodeSnippetVersion 31 | 2 32 | 33 | 34 | -------------------------------------------------------------------------------- /sst_error_create.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | error_create 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"<#error description#>"}; 13 | NSError *error = [NSError errorWithDomain:@"<#domain#>" code:<#errorcode#> userInfo:userInfo]; 14 | IDECodeSnippetIdentifier 15 | 2BEFBCF2-40F5-4679-A1A7-850EC9942B3E 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Creates an NSError instance with User Info dictionary 20 | IDECodeSnippetTitle 21 | Error creation 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_file_exists.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | file_exists 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | [[NSFileManager defaultManager] fileExistsAtPath:<#path#>] 13 | IDECodeSnippetIdentifier 14 | CD5427A1-3F45-4023-BC9B-6AC66320D83D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | File Exists 19 | IDECodeSnippetTitle 20 | File Exists 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_fmtdatetime.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | fmtdatetime 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 13 | [formatter setDateStyle:NSDateFormatterNoStyle]; 14 | [formatter setTimeStyle:NSDateFormatterShortStyle]; 15 | NSLog(@"Date: %@", [formatter stringFromDate:[NSDate date]]); 16 | 17 | IDECodeSnippetIdentifier 18 | 345A7C6C-A624-49B4-9295-859B9C4DE7BD 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Format Date and Time 23 | IDECodeSnippetTitle 24 | Format Date and Time 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_gcd_async_wait.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_async_wait 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | // do not use 14 | dispatch_queue_t <#queue#> = dispatch_queue_create("<#queue#>", NULL); 15 | dispatch_async(queue, ^ { 16 | // do async work 17 | }); 18 | 19 | // do more work concurrently 20 | dispatch_sync(<#queue#>, ^{}); // wait for async block to finish 21 | //dispatch_release(<#queue#>); // not needed for ARC 22 | 23 | IDECodeSnippetIdentifier 24 | 5A610228-3FC0-46B5-AFF0-5B601ED03F68 25 | IDECodeSnippetLanguage 26 | Xcode.SourceCodeLanguage.Objective-C 27 | IDECodeSnippetSummary 28 | Runs async block and waits before continuing 29 | IDECodeSnippetTitle 30 | GCD: Run Async and Wait 31 | IDECodeSnippetUserSnippet 32 | 33 | IDECodeSnippetVersion 34 | 2 35 | 36 | 37 | -------------------------------------------------------------------------------- /sst_gcd_asyncqueue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_asyncqueue 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | dispatch_queue_t callerQueue = dispatch_get_current_queue(); 14 | dispatch_queue_t <#queueName#> = dispatch_queue_create("<#queueLabel#>", NULL); 15 | dispatch_async(<#queueName#>, ^{ 16 | 17 | // Do async work 18 | 19 | dispatch_async(callerQueue, ^{ 20 | 21 | // Finish work on the caller's queue 22 | 23 | }); 24 | }); 25 | dispatch_release(<#queueName#>); 26 | 27 | IDECodeSnippetIdentifier 28 | 0CB5B30F-E8C4-46CE-A599-00C4BCEF8A22 29 | IDECodeSnippetLanguage 30 | Xcode.SourceCodeLanguage.Objective-C 31 | IDECodeSnippetSummary 32 | Runs an async queue 33 | IDECodeSnippetTitle 34 | GCD: Async Queue 35 | IDECodeSnippetUserSnippet 36 | 37 | IDECodeSnippetVersion 38 | 2 39 | 40 | 41 | -------------------------------------------------------------------------------- /sst_gcd_default_priority_queue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_default_priority_queue 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 13 | <#code#> 14 | }); 15 | IDECodeSnippetIdentifier 16 | 267FDAC5-B716-4C0E-A460-9170E2A86857 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Run code on global queue with default priority 21 | IDECodeSnippetTitle 22 | GCD: Default priority queue 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_gcd_dispatchafter.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_dispatchafter 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, <#ms#> * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 13 | <#code#> 14 | }); 15 | IDECodeSnippetIdentifier 16 | 458B72CD-628B-4627-8676-6E374EEBA82C 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Run some code ater a delay 21 | IDECodeSnippetTitle 22 | GCD: Dispatch After 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_gcd_getqueuelabel.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_getqueuelabel 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSString *queueLabel = [NSString stringWithCString: dispatch_queue_get_label(dispatch_get_current_queue())encoding:NSUTF8StringEncoding]; 13 | IDECodeSnippetIdentifier 14 | 127FE5AA-5D33-4920-925A-DCD0F1847C78 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Gets the label of the current queue 19 | IDECodeSnippetTitle 20 | GCD: Get Queue Label 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_gcd_high_priority_queue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_high_priority_queue 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0),^{ 13 |  14 | }); 15 | IDECodeSnippetIdentifier 16 | 432C611D-CC3F-453A-BAB6-F999BED7A2AE 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Run code on a high priority queue 21 | IDECodeSnippetTitle 22 | GCD: Run with high priority queue 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_gcd_low_priority_queue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_low_priority_queue 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ 13 |  14 | }); 15 | IDECodeSnippetIdentifier 16 | 5FB04847-43C5-4EFA-A5E9-B86AD9D9E0F3 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Run code on a low priority queue 21 | IDECodeSnippetTitle 22 | GCD: Run with low priority queue 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_gcd_main_queue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_main_queue 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | dispatch_async(dispatch_get_main_queue(), ^{ 13 | <#code#> 14 | }); 15 | IDECodeSnippetIdentifier 16 | 0DE52AD8-28D1-4049-AA34-93466A930ED6 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Runs queue on main queue (thread) 21 | IDECodeSnippetTitle 22 | GCD: Main Queue 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_gcd_wait_for_blocks.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | gcd_wait_for_blocks 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | @autoreleasepool { 13 | dispatch_queue_t queue = dispatch_queue_create("<#queue name#>", 0); 14 | dispatch_sync(queue, ^(){ 15 | // insert sync code 16 | }); 17 | dispatch_async(queue, ^(){ 18 | // insert async code 19 | }); 20 | // wait for queue 21 | dispatch_barrier_sync(queue, ^(){ 22 | // insert completion code 23 | }); 24 | } 25 | IDECodeSnippetIdentifier 26 | BB991218-28E1-4ED5-BEB5-5D086001A01F 27 | IDECodeSnippetLanguage 28 | Xcode.SourceCodeLanguage.Objective-C 29 | IDECodeSnippetSummary 30 | GCD: Wait for Blocks 31 | IDECodeSnippetTitle 32 | GCD: Wait for Blocks 33 | IDECodeSnippetUserSnippet 34 | 35 | IDECodeSnippetVersion 36 | 2 37 | 38 | 39 | -------------------------------------------------------------------------------- /sst_height_for_vc_view.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | height_for_vc_view 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | CGRectGetHeight(self.view.frame) 13 | IDECodeSnippetIdentifier 14 | 847B2AC0-06F9-4C19-A83A-B8B952062E71 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Height for View Controller's View 19 | IDECodeSnippetTitle 20 | Height for View Controller's View 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_height_main_screen.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | height_main_screen 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | CGRectGetHeight([[UIScreen mainScreen] bounds]) 13 | IDECodeSnippetIdentifier 14 | 6839ECCB-9B00-4417-9763-3A5780CA25A8 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Height for main screen 19 | IDECodeSnippetTitle 20 | Height for main screen 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_image_resize_to_max.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | image_resize_to_max 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (UIImage *)resizeImage:(UIImage *)image toMaximumSize:(CGSize)maxSize { 13 | CGFloat widthRatio = maxSize.width / image.size.width; 14 | CGFloat heightRatio = maxSize.height / image.size.height; 15 | CGFloat scaleRatio = widthRatio < heightRatio ? widthRatio : heightRatio; 16 | CGSize newSize = CGSizeMake(image.size.width * scaleRatio, image.size.height * scaleRatio); 17 | 18 | UIGraphicsBeginImageContextWithOptions(newSize, NO, image.scale); 19 | [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; 20 | UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext(); 21 | UIGraphicsEndImageContext(); 22 | 23 | return resizedImage; 24 | } 25 | IDECodeSnippetIdentifier 26 | E059CA93-2052-458B-AAFD-D98DD539954C 27 | IDECodeSnippetLanguage 28 | Xcode.SourceCodeLanguage.Objective-C 29 | IDECodeSnippetSummary 30 | Image Resize to Max 31 | IDECodeSnippetTitle 32 | Image Resize to Max 33 | IDECodeSnippetUserSnippet 34 | 35 | IDECodeSnippetVersion 36 | 2 37 | 38 | 39 | -------------------------------------------------------------------------------- /sst_inline_block_variable.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | inline_block_variable 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | void (^<#variable name#>)(void) = ^void() { 14 | <#insert code here#> 15 | }; 16 | 17 | IDECodeSnippetIdentifier 18 | 0FB81DB7-B864-420D-B95A-FD1B1519C1EE 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Create an inline block variable which is reusable 23 | IDECodeSnippetTitle 24 | Inline completion block variable 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_is_ios7_or_later.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | is_ios7_or_later 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | #define RUNNING_IOS_7_OR_LATER (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) 13 | IDECodeSnippetIdentifier 14 | 39A6417C-1EFF-4A80-8ADC-5024EB51027B 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Determines if the iOS version is 7 or later 19 | IDECodeSnippetTitle 20 | Is Running iOS 7 or Later 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_isviewcontrollervisible.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | isviewcontrollervisible 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | if (self.isViewLoaded && self.view.window) { 13 | // viewController is visible 14 | } 15 | IDECodeSnippetIdentifier 16 | 723109C5-8693-4086-B0BE-41EAC0331B7A 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | Is View Controller Visible 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_localized_string.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | localized_string 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | NSLocalizedString(@"<#value#>", <#comment string or nil#>) 13 | IDECodeSnippetIdentifier 14 | 078B198D-8C36-4B3C-84F5-575228F37494 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Localized String 19 | IDECodeSnippetTitle 20 | Localized String 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_log.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | log 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSLog(@"<#message#>"); 13 | IDECodeSnippetIdentifier 14 | BAAD8FA7-ACC0-4246-B95D-9B09E049F2A3 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Logs a message 19 | IDECodeSnippetTitle 20 | NSLog 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_log_fonts.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | log_fonts 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)logFonts { 13 | for (id familyName in [UIFont familyNames]) { 14 | DebugLog(@"Family Name: %@", familyName); 15 | for (id fontName in [UIFont fontNamesForFamilyName:familyName]) { 16 | DebugLog(@"Font Name: %@", fontName); 17 | } 18 | } 19 | } 20 | IDECodeSnippetIdentifier 21 | 436C122E-A1F9-4AB6-966A-34B63D05664B 22 | IDECodeSnippetLanguage 23 | Xcode.SourceCodeLanguage.Objective-C 24 | IDECodeSnippetSummary 25 | Log Fonts 26 | IDECodeSnippetTitle 27 | Log Fonts 28 | IDECodeSnippetUserSnippet 29 | 30 | IDECodeSnippetVersion 31 | 2 32 | 33 | 34 | -------------------------------------------------------------------------------- /sst_log_mode.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | log_mode 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | #ifndef NDEBUG 13 | NSLog(@"Debug Mode"); 14 | #else 15 | NSLog(@"Release Mode"); 16 | #endif 17 | IDECodeSnippetIdentifier 18 | DA053719-F198-4193-BD6F-0213D25DD5D2 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Logs out if the mode is Debug or Release 23 | IDECodeSnippetTitle 24 | Log Debug Mode 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_maassert.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | maassert 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | MAAssert(<#condition#>, @"<#failure message#>"); 13 | IDECodeSnippetIdentifier 14 | F7A2B7BA-126D-456A-9C73-3A4439171694 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | MAAssert 19 | IDECodeSnippetTitle 20 | MAAssert 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_maassert_defined.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | maassert_defined 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | #ifndef NS_BLOCK_ASSERTIONS 13 | 14 | // Credit: http://sstools.co/maassert 15 | #define MAAssert(expression, ...) \ 16 | do { \ 17 | if(!(expression)) { \ 18 | NSLog(@"Assertion failure: %s in %s on line %s:%d. %@", #expression, __func__, __FILE__, __LINE__, [NSString stringWithFormat: @"" __VA_ARGS__]); \ 19 | abort(); \ 20 | } \ 21 | } while(0) 22 | 23 | #else 24 | 25 | #define MAAssert(expression, ...) 26 | 27 | #endif 28 | 29 | 30 | IDECodeSnippetIdentifier 31 | 3C64FD23-12DC-409B-BDE5-C85F9892442E 32 | IDECodeSnippetLanguage 33 | Xcode.SourceCodeLanguage.Objective-C 34 | IDECodeSnippetSummary 35 | MAAssert Defined 36 | IDECodeSnippetTitle 37 | MAAssert Defined 38 | IDECodeSnippetUserSnippet 39 | 40 | IDECodeSnippetVersion 41 | 2 42 | 43 | 44 | -------------------------------------------------------------------------------- /sst_method.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | method 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)<#methodName#> { 13 | // TODO: implement 14 | } 15 | IDECodeSnippetIdentifier 16 | 576C72F9-38CC-48C4-B6F5-34B5FABC1A09 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Create a method 21 | IDECodeSnippetTitle 22 | Method 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_notification_block_observer_property.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_block_observer_property 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassInterfaceMethods 10 | 11 | IDECodeSnippetContents 12 | 13 | // observers are retained by the system 14 | @property (assign, nonatomic) id <#notification name#>Observer; 15 | IDECodeSnippetIdentifier 16 | 1E756922-6251-4288-AF57-7B78D6B2BD01 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Property for observing a block notification 21 | IDECodeSnippetTitle 22 | Notification: Block Observer Property 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_notification_handler.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_handler 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)<#method name#>:(NSNotification *)notification { 13 | } 14 | IDECodeSnippetIdentifier 15 | 62B53CE0-2BBE-44B3-9CC8-040F2216B85A 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Method to handle a notification 20 | IDECodeSnippetTitle 21 | Notication: Handler 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_notification_named_block.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_named_block 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | void (^<#blockName#>)(NSNotification *notification) = ^void (NSNotification *notification) { 13 | }; 14 | IDECodeSnippetIdentifier 15 | 96D5B1DB-E592-4BF5-816C-5C62C4EA57F2 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Notification block 20 | IDECodeSnippetTitle 21 | Notification: Named Block 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_notification_observe.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_observe 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [[NSNotificationCenter defaultCenter] addObserver:self 13 | selector:@selector(<#selector#>) 14 | name:<#notification name#> 15 | object:nil]; 16 | IDECodeSnippetIdentifier 17 | 2E7C3EB7-D6FE-4352-9CAD-C411DC3BB553 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | Attach a notification to a selector 22 | IDECodeSnippetTitle 23 | Notification: Add Observer 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /sst_notification_observer_property.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_observer_property 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassInterfaceMethods 10 | 11 | IDECodeSnippetContents 12 | 13 | // observers are retained by the system 14 | @property (assign, nonatomic) id <#name#>Observer; 15 | IDECodeSnippetIdentifier 16 | E7F23134-E708-43E9-95D2-76952C2FD3E0 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Property to observe a notification 21 | IDECodeSnippetTitle 22 | Notification: Observer Property 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_notification_observewithblock.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_observewithblock 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | self.<#name#>Observer = [[NSNotificationCenter defaultCenter] addObserverForName:<#name#> 14 | object:nil 15 | queue:[NSOperationQueue mainQueue] 16 | usingBlock:^(NSNotification *notification) { 17 | <#code#> 18 | }]; 19 | IDECodeSnippetIdentifier 20 | 0BAEB827-439A-4989-BD78-784E6F7FCA6F 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.Objective-C 23 | IDECodeSnippetSummary 24 | Observe a named notification using a block 25 | IDECodeSnippetTitle 26 | Notification: Observe by Name with Block 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /sst_notification_post.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_post 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [[NSNotificationCenter defaultCenter] postNotificationName:<#notification name#> object:<#nil or userInfo dictionary#>]; 13 | IDECodeSnippetIdentifier 14 | 425207C2-4AF9-42C7-A302-DFF77399B2B8 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Send a notification with an optional object 19 | IDECodeSnippetTitle 20 | Notification: Post 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_notification_post_with_userinfo.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_post_with_userinfo 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | 13 | NSDictionary *userInfo = @{<#key#> : <#value#>}; 14 | [[NSNotificationCenter defaultCenter] postNotificationName:<#name#> 15 | object:nil 16 | userInfo:userInfo]; 17 | IDECodeSnippetIdentifier 18 | 4A5786A5-922A-4F23-9AF9-C574CB143D90 19 | IDECodeSnippetLanguage 20 | Xcode.SourceCodeLanguage.Objective-C 21 | IDECodeSnippetSummary 22 | Send a notification with an optional object and user info dictionary 23 | IDECodeSnippetTitle 24 | Notification: Post with User Info 25 | IDECodeSnippetUserSnippet 26 | 27 | IDECodeSnippetVersion 28 | 2 29 | 30 | 31 | -------------------------------------------------------------------------------- /sst_notification_remove.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_remove 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | [[NSNotificationCenter defaultCenter] removeObserver:self 13 | name:<#notification name#> 14 | object:nil]; 15 | IDECodeSnippetIdentifier 16 | 0AAF1B34-8096-4F9B-946C-ED9A3FB6BDA0 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Detach observer 21 | IDECodeSnippetTitle 22 | Notification: Remove Observer 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_notification_remove_block_observer.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | notification_remove_block_observer 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | 13 | [[NSNotificationCenter defaultCenter] removeObserver:self.<#observer property#> 14 | name:<#notification name#> 15 | object:nil]; 16 | IDECodeSnippetIdentifier 17 | 121D9BAB-12C3-4AC6-BEFF-5A753532251A 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | Removes a block observer 22 | IDECodeSnippetTitle 23 | Notification: Remove Block Observer 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /sst_nsassert.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | nsassert 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSAssert(<# assertion #>, @"<# error #>"); 13 | IDECodeSnippetIdentifier 14 | 1E284288-C791-4DDA-A542-D04C999BD91D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Assertion 19 | IDECodeSnippetTitle 20 | NSAssert 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_nsassert_blocks.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | nsassert_blocks 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSCAssert(<# assertion #>), @"<# error #>"); 13 | IDECodeSnippetIdentifier 14 | FF000C7C-5FCE-4960-9ABB-51507F2CC240 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Safely run NSAssert inside a Block (self retain cycle) 19 | IDECodeSnippetTitle 20 | NSAssert for Blocks 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_pragma_unused.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | pragma_unused 7 | IDECodeSnippetCompletionScopes 8 | 9 | Preprocessor 10 | 11 | IDECodeSnippetContents 12 | #pragma unused (<#variable#>) 13 | IDECodeSnippetIdentifier 14 | 3160023D-82AB-42B9-9D67-AC358B38EF5C 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Ignore an unsed varable 19 | IDECodeSnippetTitle 20 | Pragma Unused 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_prepareforsegue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | prepareforsegue 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 13 | DebugLog(@"segue: %@", segue.identifier); 14 | } 15 | 16 | IDECodeSnippetIdentifier 17 | EBDD1F6A-F972-48CD-8F2B-4FB8192ED7E4 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetTitle 21 | Prepare for Segue 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_prop.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | prop 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassInterfaceMethods 10 | 11 | IDECodeSnippetContents 12 | @property (weak, nonatomic) IBOutlet <#type#> *<#name#>; 13 | 14 | IDECodeSnippetIdentifier 15 | D91CEB20-5E84-4ADE-B491-52C72E524A4A 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Defines a property 20 | IDECodeSnippetTitle 21 | Property 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_run_on_main_thread.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | run_on_main_thread 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | void runOnMainQueueWithoutDeadlocking(void (^block)(void)) 13 | { 14 | if ([NSThread isMainThread]) 15 | { 16 | block(); 17 | } 18 | else 19 | { 20 | dispatch_sync(dispatch_get_main_queue(), block); 21 | } 22 | } 23 | IDECodeSnippetIdentifier 24 | C7381FC6-95D1-466C-AA14-0C18EE7EF5C0 25 | IDECodeSnippetLanguage 26 | Xcode.SourceCodeLanguage.Objective-C 27 | IDECodeSnippetSummary 28 | Run on Main Thread 29 | IDECodeSnippetTitle 30 | Run on Main Thread 31 | IDECodeSnippetUserSnippet 32 | 33 | IDECodeSnippetVersion 34 | 2 35 | 36 | 37 | -------------------------------------------------------------------------------- /sst_section_header.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | section_header 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | #pragma mark - <#Section Name#> 13 | #pragma mark - 14 | IDECodeSnippetIdentifier 15 | F2939C78-FBD4-47C8-8FE2-D6BA2C5EC29B 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | Pragma marker for a section header 20 | IDECodeSnippetTitle 21 | Section Header 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_string_constant_header.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_constant_header 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | extern NSString * const <#name#>; 13 | IDECodeSnippetIdentifier 14 | 90B067CC-D547-476A-B96F-D7F1AE5B1125 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | String Constant Header 19 | IDECodeSnippetTitle 20 | String Constant Header 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_string_constant_implementation.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_constant_implementation 7 | IDECodeSnippetCompletionScopes 8 | 9 | TopLevel 10 | 11 | IDECodeSnippetContents 12 | NSString * const <#name#> = @"<#value#>"; 13 | IDECodeSnippetIdentifier 14 | BE56C7F0-7CBD-424C-856F-DDCFA5BB8CA7 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | String Constant Implementation 19 | IDECodeSnippetTitle 20 | String Constant Implementation 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_string_contains.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_contains 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | [<#string#> rangeOfString:@"<#match#>"].location != NSNotFound 13 | IDECodeSnippetIdentifier 14 | 4398F559-46FA-4C05-BB96-ABD0256519A9 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | String Contains 19 | IDECodeSnippetTitle 20 | String Contains 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_string_height_attributed.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_height_attributed 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | CGRect rect = [<#attributed string#> boundingRectWithSize:CGSizeMake(<#max width#>, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil]; 13 | CGFloat height = CGRectGetHeight(rect); 14 | IDECodeSnippetIdentifier 15 | 7484A877-5452-4241-9116-1423B122EC67 16 | IDECodeSnippetLanguage 17 | Xcode.SourceCodeLanguage.Objective-C 18 | IDECodeSnippetSummary 19 | String Height Attributed 20 | IDECodeSnippetTitle 21 | String Height Attributed 22 | IDECodeSnippetUserSnippet 23 | 24 | IDECodeSnippetVersion 25 | 2 26 | 27 | 28 | -------------------------------------------------------------------------------- /sst_string_height_regular.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_height_regular 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading; 13 | NSDictionary *attributes = @{ NSFontAttributeName : <#font#> }; 14 | CGSize size = [<#text#> boundingRectWithSize:CGSizeMake(<#max width#>, CGFLOAT_MAX) options:options attributes:attributes context:nil].size; 15 | CGFloat height = size.height; 16 | IDECodeSnippetIdentifier 17 | DEB1804D-42AF-4CD4-9338-7A160C9CA5D7 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Objective-C 20 | IDECodeSnippetSummary 21 | String Height Regular 22 | IDECodeSnippetTitle 23 | String Height Regular 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /sst_string_starts_with.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | string_starts_with 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | [<#string#> hasPrefix:@"<#match#>"] 13 | IDECodeSnippetIdentifier 14 | 1C2F9CE0-6310-49F6-8213-976AC802DECF 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | String Starts With 19 | IDECodeSnippetTitle 20 | String Starts With 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_strong_self.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | strong_self 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | <# class #> *strongSelf = weakSelf; 13 | IDECodeSnippetIdentifier 14 | 95ABB256-A4B8-4A97-8049-5873AB0A1E7B 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Create a strong reference to self for blocks 19 | IDECodeSnippetTitle 20 | Strong Self 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_suppress_deprecation_warnings.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | suppress_deprecation_warnings 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 13 | // deprecated method call 14 | #pragma GCC diagnostic warning "-Wdeprecated-declarations" 15 | IDECodeSnippetIdentifier 16 | AAFB25DE-FE39-4159-BFC4-296E93A2E7B2 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Suppresses deprecation warning 21 | IDECodeSnippetTitle 22 | Suppress deprecation warning 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_tableview_delegates.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | tableview_delegate 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | 13 | #pragma mark - UITableViewDataSource 14 | #pragma mark - 15 | 16 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 17 | return <#number#>; 18 | } 19 | 20 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 21 | return <#number#>; 22 | } 23 | 24 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 25 | static NSString *CellIdentifier = @"<#identifier#>"; 26 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 27 | 28 | return cell; 29 | } 30 | 31 | #pragma mark - UITableViewDelegate 32 | #pragma mark - 33 | 34 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 35 | } 36 | 37 | 38 | IDECodeSnippetIdentifier 39 | 51A6820E-A13F-4577-A2CB-E96533CC41B7 40 | IDECodeSnippetLanguage 41 | Xcode.SourceCodeLanguage.Objective-C 42 | IDECodeSnippetSummary 43 | Table view data source and delegate methods 44 | IDECodeSnippetTitle 45 | UITableView Delegates 46 | IDECodeSnippetUserSnippet 47 | 48 | IDECodeSnippetVersion 49 | 2 50 | 51 | 52 | -------------------------------------------------------------------------------- /sst_udid_create.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | udid_create 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | CFUUIDRef uuid = CFUUIDCreate(NULL); 13 | CFStringRef uuidStr = CFUUIDCreateString(NULL, uuid); 14 | NSString *uniqueIdentifier = [NSString stringWithFormat:@"%@", uuidStr]; 15 | IDECodeSnippetIdentifier 16 | 54F818EF-98D5-4C17-8779-AEAE16B1FFF8 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Created a unique identifier 21 | IDECodeSnippetTitle 22 | UDID Generator 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_unwind_segue.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | unwind_segue 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (IBAction)<#method#>:(UIStoryboardSegue *)segue { 13 | <#code#> 14 | } 15 | IDECodeSnippetIdentifier 16 | ED729240-63C4-4AB1-B411-F7FAAFEDF543 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetSummary 20 | Unwind Segue 21 | IDECodeSnippetTitle 22 | Unwind Segue 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /sst_viewdidappear.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | viewdidappear 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)viewDidAppear:(BOOL)animated { 13 | [super viewDidAppear:animated]; 14 | } 15 | IDECodeSnippetIdentifier 16 | 627CA440-A730-40A4-BD25-07EB06FAE71D 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | View Did Appear 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_viewdiddisappear.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | viewdiddisappear 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)viewDidDisappear:(BOOL)animated { 13 | [super viewDidDisappear:animated]; 14 | } 15 | IDECodeSnippetIdentifier 16 | 0F6D999A-9BCF-45FA-A3AC-63782D9B858A 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | View Did Disappear 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_viewdidload.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | viewdidload 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)viewDidLoad { 13 | [super viewDidLoad]; 14 | } 15 | IDECodeSnippetIdentifier 16 | B41ED4F7-CB1D-4F42-9B51-081FA053AA41 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | View Did Load 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_viewwillappear.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | viewwillappear 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)viewWillAppear:(BOOL)animated { 13 | [super viewWillAppear:animated]; 14 | } 15 | IDECodeSnippetIdentifier 16 | 8B1BC981-A05D-4520-B25E-089D8F5813AF 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | View Will Appear 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_viewwilldissappear.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | viewwilldissappear 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | - (void)viewWillDisappear:(BOOL)animated { 13 | [super viewWillDisappear:animated]; 14 | } 15 | IDECodeSnippetIdentifier 16 | CC87858D-0DFD-4197-91E1-554A5B44C584 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Objective-C 19 | IDECodeSnippetTitle 20 | View Will Disappear 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /sst_weak_self.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | weak_self 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeBlock 10 | 11 | IDECodeSnippetContents 12 | __weak <# class #> *weakSelf = self; 13 | IDECodeSnippetIdentifier 14 | 9A9E0F11-79DD-419C-A716-E7055DD40599 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Objective-C 17 | IDECodeSnippetSummary 18 | Create a weak reference for self 19 | IDECodeSnippetTitle 20 | Weak Self 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | --------------------------------------------------------------------------------