| Start |
|---|
Fluent Usage Using natural languageExample: instead of Naming Factory MethodsExample: Naming Parameters in Initializers and Factory MethodsExample: Instead of: Naming according to side effects
Nonmutating functions: Boolean functions or variablesExample: Naming Protocols
Types and PropertiesExample: |
Clear Usage Avoid AmbiguityExample: The function call to this function will then look like this: This way, ambiguity is avoided. If the function call would be just Avoid RedundancyA bad example would be: A call to the function may look like The call to this function looks like this: Naming variables according to their roleHigh coupling between Protocol Name and Variable NamesProvide additional details when using weakly typed parametersto which a call would look like `object.addObserver(self, forKeyPath: path) instead of to which a call would look like |
Capitalization Types & ProtocolsType and protocol names should start with an uppercase letter. Example: Everything else...Variables, constants, functions and enumeration cases should start with a lowercase letter. Example: Camel Case:All naming should use the appropriate camel case. Upper camel case for type/protocol names and lower camel case for everything else. Upper Camel Case: Lower Camel Case: AbbreviationsAbbreviations should be avoided unless commonly used (e.g. URL, ID). If an abbreviation is used, all letters should have the same case. Example: RemarksSwift has an official style guide: Swift.org API Design Guidelines (opens new window). Another popular guide is The Official raywenderlich.com Swift Style Guide. (opens new window) |
Read Article
https://develop.horje.com/learn/1434/reference