Skip to content

Latest commit

 

History

History
178 lines (119 loc) · 2.62 KB

File metadata and controls

178 lines (119 loc) · 2.62 KB

Xcode Snippets

#FN - UIView inits override with setup

Inits override for UIView with a setup method

Keyword: setupview

Snippet code
// MARK: - Life cycle

override init(frame: CGRect) {
    super.init(frame: frame)
    setup()
}

required init?(coder: NSCoder) {
    super.init(coder: coder)
    setup()
}

// MARK: - Private

private func setup() {
    <#code#>
}

#FN - guard let self = self

A guard to get a strong self

Keyword: gself

Snippet code
guard let self = self else { return }

#FN - Mark

A section indicator comment

Keyword: m

Snippet code
// MARK: - <#comment#>

#FN - Private function

A private function

Keyword: pfunc

Snippet code
private func <#funcName#>() {
    <#code#>
}

#FN - Autolayout pin

The verbose code to pin a view with autolayout

Snippet code
<#SubView#>.translatesAutoresizingMaskIntoConstraints = false
<#SubView#>.topAnchor.constraint(equalTo: <#SubViewContainerView#>.topAnchor).isActive = true
<#SubView#>.bottomAnchor.constraint(equalTo: <#SubViewContainerView#>.bottomAnchor).isActive = true
<#SubView#>.leadingAnchor.constraint(equalTo: <#SubViewContainerView#>.leadingAnchor).isActive = true
<#SubView#>.trailingAnchor.constraint(equalTo: <#SubViewContainerView#>.trailingAnchor).isActive = true

#FN - MARK Private

A private indicator comment

Keyword: mp

Snippet code
// MARK: - Private

#FN - Swiftlint ignore comment

A comment to disable locally swiftlint rules

Keyword: swiftlint

Snippet code
// swiftlint:disable:<#this/next#> <#disabled_warning#>

#FN - MARK Public

A public indicator comment

Keyword: mpu

Snippet code
// MARK: - Public

#FN - Constants

A constants enum snippet following Fabernovel coding style

Keyword: cst

Snippet code
private enum Constants {
    static let <#constantName#>: <#constantType#> = <#constantValue#>
}

#FN - private let

A private constant

Keyword: plet

Snippet code
private let <#name#> = <#value#>

#FN - Private var

A private variable

Keyword: pvar

Snippet code
private var <#variable#>: <#Type#>