| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Coding Styles for the Quick & Nimble Projects. Feedback is welcomed as issues and pull requests.
Currently this is under discussion and does not apply to Quick and Nimble. This isn't anywhere near final at the moment.
Methods with braces always open same line. else does not close on a new line:
if expression {
// do something
} else {
// do something else
}This includes if, else, switch, struct, class, while, for, do, closures/blocks. If they span multiple lines, they should still be at the end of the last line:
if expression && other_expression && whoa_I_need_to_wrap {
// do something
}: should have one space to the right:
class Foo: Bar {
}
struct Baz: Laz {
}
var count: Int
func foo<T: Equatable>(value: T) -> All public functions, methods, and types must be documented. As a rule of thumb, documentation comments should:
This doesn't exclude implementation comments that mention a bug or workaround or useful pointers to other parts of related code (such as mentioning files where a type's extensions will be).
Prefer declaring immutable variants over mutables ones when possible.
Use if let to check for optionals if the wrapped value is intended to be used, otherwise use if value != nil.
Avoid using ! optional unwrapping operations. Only use it to describe internal variables that are known to be initialized prior to use.
Using trailing closure syntax whenever applicable. Keep the input arguments on the same line:
map(numbers) { number in
}Avoid passing many arguments into closures.
Avoid $N argument notation unless it can fit in one small operation and be on the same line:
map([1, 2, 3]) { $0 + 1 }TBD
TBD
| Back | FazBrowse Home | New Git URL |