I would like to know if there is meant to be one or two spaced below a Function/Method when created:
e.g.
func shouldItBeThisWay() {
let choice1: Bool = false
}
or
func thisWay() {
let choice2: Bool = false
}
the second spacing will not be shown here thanks to the way the auto-formatting works, but the "thisWay() function has two carriage spaces
It might seem odd to have two, but at times with immediate For Loops it can be easier to read. I was just unsure if there were specific Swift guidelines on this?
Like your other question, it makes no syntactic difference.
Most style guides would recommend indenting the body of the function:
func mostCommonRecommendation() {
doStuff()
}
But there is almost no agreement on how much vertical space should go where. (Though multiple empty lines in a row is somewhat rare.) I stick empty lines into my code roughly the same as I put paragraph breaks into my prose. They sort of group logically related things, but there isn’t a precise rule and it is somewhat dependent on the context. Some developers think like movers, wanting to have the most possible fit on the screen at a time, disliking “wasted” space. Others think more like composers, making very careful use of the void to frame the content. This one is really up to you to decide for yourself.