The typealias declaration allows you to create an alias for a type; it does exactly what it says on the tin. You can specify a name that can be used in place of any given type definition. If this type is quite complex, a typealias can be a useful way to simplify its use.
Changing your name with typealias
How to do it...
Let's take look at the following steps to understand how to use typealias:
- First, let's create something to store in an array--in this instance, a Pug struct:
struct Pug {
let name: String
}
- Now we can create an array that will contain instances of a Pug struct:
let pugs = [Pug]()
As you may or may not know, the collective noun for a group of pugs is called a grumble.
https://www.reference...
https://www.reference...