There are two keywords in Swift to represent the concept of "type scope", which are static and class. Both words indicate a type scope in program world. However, in most languages, including Objective-C, we usually use only one of them. But in earlier versions of Swift, both are regularly used and should not be mixed up.

In non-class type, static refers to a type scope. The most common cases are type methods and variables in enum and struct. In these two value types, we can use store or calculate properties, as well as method in the whole type scope:

struct Point {
    let x: Double
    let y: Double

    // Store property
    static let zero = Point(x: 0, y: 0)

    // Calculate property
    static var ones: [Point] {
        return [Point(x: 1, y: 1),
                Point(x: -1, y: 1),
                Point(x: 1, y: -1),
                Point(x: -1, y: -1)]
    }

    // Type method
    static func add(p1: Point, p2: Point) -> Point {
        return Point(x: p1.x + p2.x, y: p1.y + p2.y)
    }
}

enum is almost the same as struct.

Compared with static, class is just as it sounds like, used in a class context. It can be a modifier to class method and calculate properties. The exception is store properties. You should never use class in a store property. When we write code like this:

class MyClass {
    class var bar: Bar?
}

An error would be thrown when compiling:

class variables not yet supported

In Swift 1.2 and later, we could use static to declare a class constant or variable in class scope. The code like this:

class MyClass {
    static var bar: Bar?
}

is valid now. With this, we can write a singleton simply.

The protocol is a little bit confusing. In Swift, all types (class, struct and enum) could conform to a protocol. If we wish to define a type scope method or calculate property, which keyword should we use? The answer is static. In the type implements it, we could follow these rules: use static in struct or enum, while use either class of static in a class.

protocol MyProtocol {
    static func foo() -> String
}

struct MyStruct: MyProtocol {
    static func foo() -> String {
        return "MyStruct"
    }
}

enum MyEnum: MyProtocol {
    static func foo() -> String {
        return "MyEnum"
    }
}

class MyClass: MyProtocol {
    // We could use `class` in a class type
    class func foo() -> String {
        return "MyClass.foo()"
    }

    // Or we could use `static` as well
    static func bar() -> String {
        return "MyClass.bar()"
    }
}

Before Swift 1.2, class was used as the keyword in protocol, which did not make sense. Apple improved it in Swift 1.2 and 2.0. Right now, the only thing to remember is you could use static and everything should go fine.