Code style - Faifly/xDrip GitHub Wiki
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