src/GeoIP/GeoIP.swift
Function should have at least one blank line after it Open
Open
}
- Read upRead up
- Exclude checks
function-whitespace
Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.
Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Not Preferred
func function1() {
var text = 1
var text = 2
}
function1()
// a comment
func function2() {
// something goes here
}
struct SomeStruct {
func function3() {
// something goes here
}
func function4() {
// something else goes here
};
}
func function5() {
// something goes here
}
Function names should be lowerCamelCase Open
Open
public static func LookUp(_ ipAddress: String) -> MMDBCountry? {
- Read upRead up
- Exclude checks
lower-camel-case
method
and var
names should follow lowerCamelCase naming convention: first letter of the entire word is lowercase, but subsequent first letters are uppercase.
Method and selector names
Preferred
func someMethod() {
// method definition goes here
}
Not Preferred
func some-method() {
// method definition goes here
}
Variable names
Preferred
var someVariable = someValue
Not Preferred
var Some_Var1able = someValue