/xcode-snippets

My snippets for xCode IDE

Primary LanguageShell

xcode-snippets

Personal snippets for xCode IDE

Description

This repo contains:

  • Code snippets for xCode IDE (*.codesnippet files)
  • Two scripts for moving snippets between cloned repo and xCode folder where snippets are placed:
    • Import: Moves snippets from existing folder to xCode;
    • Export: Moves snippets from xCode to existing folder.

Installation

  1. Clone this repository into any folder;
  2. Run script Import;
  3. Restart xCode.

Snippets


Static let

Prefix Description
sl Creates a static let
Example
static let <#name#> = <#value#>

Static let CGFloat

Prefix Description
slf Creates a static let of CGFloat type
Example
static let <#name#>: CGFloat = <#value#>

Private enum constants

Prefix Description
pec Creates a private enum with name Constants
Example
private enum Constants {
    <#variables#>
}

Private enum layouts

Prefix Description
pel Creates a private enum with name Layouts
Example
private enum Layouts {
    <#variables#>
}

Lazy var

Prefix Description
lv Creates a lazy variable
Example
lazy var <#name#>: <#type#> = {
    <#code#>
}()

Private lazy var

Prefix Description
plv Creates a private lazy variable
Example
private lazy var <#name#>: <#type#> = {
    <#code#>
}()

Class template

Prefix Description
cls Creates a class template with marks
Example
class <#name#>: <#super class#> {

    // MARK: - Variables

    <#private let block#>

    <#private var block#>

    <#public let block#>

    <#public var block#>

    // MARK: - Initializers

    <#initializers block#>

    // MARK: - Overrides

    <#override functions block#>

    // MARK: - Public functions

    <#public functions block#>

    // MARK: - Private functions

    <#private functions block#>
}