Skip to content

Code style

Artem Kalmykov edited this page Mar 24, 2020 · 3 revisions

Code style

Please follow LinkedIn's Swift style guide: https://github.com/linkedin/swift-style-guide

A couple of additions:

  • In closures don't directly use weak reference to self, use this pattern instead:
guard let self = self else { return }
  • For floating-point types append .0:
// PREFERRED
let width: CGFloat = 13.0

// NOT PREFERRED
let width: CGFloat = 13