Github’s Swift Style guide

Github has published a Swift Style Guide:

When you have to meet certain criteria to continue execution, try to exit early. So, instead of this:

if n.isNumber {
// Use n here

} else { return }

use this:

guard n.isNumber else {
return

} // Use n here

Feels very Go-like.

Roberto Selbach
Roberto Selbach
Software Engineer

Ever-learning gopher at HashiCorp.