首页 > 解决方案 > 在命名类、函数和变量时使用冠词 (the/a/an) (Swift)

问题描述

英语不是我的母语,我有一个关于 Swift 命名的问题。命名任何对象或函数时是否需要使用冠词(the/a/an)?例子:

func saveObject() or saveAnObject() or saveTheObject()

最佳做法是什么?

标签: iosswiftnaming-conventions

解决方案


The first way, saveObject(), is the best practice. The other names are unnecessarily long.


推荐阅读