What is Nostr?
Nick Lockwood /
npub13uh…e604
2024-05-20 06:20:45

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.
Author Public Key
npub13uhpwaxxvg6nfeuhsgfst89f6eexdgjlhfk8wtmctck0c42wyafsere604