Maintained by @bryanluby
A repository of useful Swift and Objective-C Xcode snippets.
- Clone this repo.
- Run the install script at the top-level of this repo:
./install.sh - This will copy all of the snippets into the user-level Xcode snippets directory.
- Restart Xcode if it is currently open to use the snippets.
If you have any other Snippets that you would like to share make a Pull Request!
- Follow the directions here for adding a snippet to Xcode.
- Then navigate to
~/Library/Developer/Xcode/UserData/CodeSnippets/and find the.codesnippetfile that was just created (sorting by Date Modified or Date Created helps). - Drag that snippet file into the top-level of this repo folder and rename the file with either the
swift_orobjc_naming scheme similar to the other snippets.
swift_mark:MARK: -convenience snippetswift_private_set_var:private(set) var ...convenience snippetswift_static_date_formatter: Static date formatter snippetswift_tableview_data_source: Bare bones requiredUITableViewDataSourcemethodsswift_collectionview_data_source: Bare bones requiredUICollectionViewDataSourcemethodsswift_swiftlint_disable_enable: Disable/enable a SwiftLint rule for a block of code.swift_swiftlint_disable_this: Disable a SwiftLint rule for the current line of code.swift_swiftlint_disable_next: Disable a SwiftLint rule for the next line of code.swift_swiftlint_disable_previous: Disable a SwiftLint rule for the previous line of code.swift_source_code_tag: Add a tag to link to source code via thex-source-tagURL scheme.swift_source_code_link: Create a link to source code via thex-source-tagURL scheme.
objc_pragma_mark:#pragma mark - ...snippetobjc_weakself:weakSelfsnippetobjc_strongSelf:strongSelfsnippetobjc_static_object_creation:static TYPE *const ...snippetobjc_global_variable_interface:FOUNDATION_EXPORT TYPE *const ...snippet for.hfilesobjc_global_variable_implementation:TYPE *const ...snippet for.mfilesobjc_struct_types_interface: Struct type for grouping constants for.hfilesobjc_struct_types_implementation: Struct type for grouping constants for.mfiles