Type Aliases

typealias Any = protocol<>

The protocol to which all types implicitly conform

typealias AnyClass = AnyObject.Type

The protocol to which all class types implicitly conform.

When used as a concrete type, all known @objc class methods and properties are available, as implicitly-unwrapped-optional methods and properties respectively, on each instance of AnyClass. For example:

class C {
  @objc class var cValue: Int { return 42 }
}

// If x has an @objc cValue: Int, return its value.  
// Otherwise, return nil.
func getCValue(x: AnyClass) -> Int? {
  return **x.cValue**
}

See also: AnyObject

typealias BooleanLiteralType = Bool

The default type for an otherwise-unconstrained boolean literal

typealias CBool = Bool

The C '_Bool' and C++ 'bool' type.

typealias CChar = Int8

The C 'char' type.

This will be the same as either CSignedChar (in the common case) or CUnsignedChar, depending on the platform.

typealias CChar16 = UInt16

The C++11 'char16_t' type, which has UTF-16 encoding.

typealias CChar32 = UnicodeScalar

The C++11 'char32_t' type, which has UTF-32 encoding.

typealias CDouble = Double

The C 'double' type.

typealias CFloat = Float

The C 'float' type.

typealias CInt = Int32

The C 'int' type.

typealias CLong = Int

The C 'long' type.

typealias CLongLong = Int64

The C 'long long' type.

typealias CShort = Int16

The C 'short' type.

typealias CSignedChar = Int8

The C 'signed char' type.

typealias CUnsignedChar = UInt8

The C 'unsigned char' type.

typealias CUnsignedInt = UInt32

The C 'unsigned int' type.

typealias CUnsignedLong = UInt

The C 'unsigned long' type.

typealias CUnsignedLongLong = UInt64

The C 'unsigned long long' type.

typealias CUnsignedShort = UInt16

The C 'unsigned short' type.

typealias CWideChar = UnicodeScalar

The C++ 'wchar_t' type.

typealias ExtendedGraphemeClusterType = String

The default type for an otherwise-unconstrained unicode extended grapheme cluster literal

typealias Float32 = Float

A 32-bit floating point type

typealias Float64 = Double

A 64-bit floating point type

typealias FloatLiteralType = Double

The default type for an otherwise-unconstrained floating point literal

typealias IntMax = Int64

The largest native signed integer type

typealias IntegerLiteralType = Int

The default type for an otherwise-unconstrained integer literal

typealias StringLiteralType = String

The default type for an otherwise-unconstrained string literal

typealias UIntMax = UInt64

The largest native unsigned integer type

typealias UWord = UInt

An unsigned integer type that occupies one machine word

typealias UnicodeScalarType = String

The default type for an otherwise-unconstrained unicode scalar literal

typealias Void = ()

The empty tuple type.

This is the default return type of functions for which no explicit return type is specified.

typealias Word = Int

A signed integer type that occupies one machine word