Swift Functional Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

Type aliases

Type aliases define an alternative name for an existing type. We define type aliases with the typealias keyword. Type aliases are useful when we want to refer to an existing type by a name that is contextually more appropriate, such as when working with data of a specific size from an external source. For instance, in the following example, we provide an alias for an unsigned 32-bit integer that can be used later in our code:

typealias UnsignedInteger = UInt32 

The typealias definitions can be used to simplify the closure and function definitions as well.