I have been reading the API Design Guidelines for Swift
and some posts regarding naming those entities I said in the title of the question, but I am still not clear about that.
I am developing in Swift 3
.
is-
, with has-
, or both prefixes are appropriate?Bool
selectors should also be prefixed is
/has
?k
? (for example, kMaxLength
). I think this was a convention for Objective-C
, is it for Swift
as well?@IBAction
selector, should refer to the control that triggers the action, or the task it does? (For example: doneButtonTapped
vs validateInput
)Swift general naming conventions are available here https://swift.org/documentation/api-design-guidelines/#general-conventions
- Uses of Boolean methods and properties should read as assertions about the receiver when the use is nonmutating, e.g.
x.isEmpty
,line1.intersects(line2)
.- The names of other types, properties, variables, and constants should read as nouns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With