Nick Lockwood on Nostr: I've noticed people tend to use computed properties or functions in Swift pretty ...
I've noticed people tend to use computed properties or functions in Swift pretty arbitrarily - I guess because Apple's guidelines about which to use when aren't clear? (or more likely, because folk don't read the guidelines)
FWIW the simple rule I follow is this: for a noun, use a property; for a verb, use a function.
"Getter" functions aren't really idiomatic in Swift, but if you *have* to use a function to return a noun for some reason, verbify it by prefixing with get, fetch, compute, etc.
FWIW the simple rule I follow is this: for a noun, use a property; for a verb, use a function.
"Getter" functions aren't really idiomatic in Swift, but if you *have* to use a function to return a noun for some reason, verbify it by prefixing with get, fetch, compute, etc.