- Those without side-effects should read as noun phrases, e.g.
x.distance(to: y)
,i.successor()
. - Those with side-effects should read as imperative verb phrases, e.g.,
print(x)
,x.sort()
,x.append(y)
.
https://www.swift.org/documentation/api-design-guidelines/
It depends on whether the function has a side effect.
If it doesn’t have a side effect, use noun phrases.
And also when it has a side effect, usually there could be better alternative word to imply the side effect than “get”