4 ms·
Coming from the Apple ecosystem, descriptive names are par for the course. Most code I end up with is written by autocomplete anyways, so writability is less re
by arcticbull 11y ago
Coming from the Apple ecosystem, descriptive names are par for the course. Most code I end up with is written by autocomplete anyways, so writability is less relevant to me. However, when I go back and read the code later, I want to know as much of the intent of the piece as possible.
Apple publishes some very good guidelines for Objective-C and Swift, the latter here: https://swift.org/documentation/api-design-guidelines/ https://swift.org/documentation/api-design-guidelines/
Generally, I'd name this method according to the role of the result, and not it's type. While "xxInteger()" isn't good, "numberOfXX()" returning an integer type does improve readability and would still be understandable assigned into an auto.
Remember, you're not writing code for you, you're writing code for future you. Or worse, for the next guy who comes into the codebase. They should be able to derive your intent without having to figure out what each method signature is, and reading all the API docs due to lack of code readability.