Typealias in swift

http://artsy.github.io/blog/2016/06/24/typealias-for-great-good/

TODO

Developers use typealias to create a new type identifier that’s a synonym for another type.

You can use typealias for most any type: classes, enums, structs, tuples, closures, etc.

For example:

JWT is basically a base64 encoded string of JSON.

Clients don’t need to verify the JWT in order to use them, and in fact when Orta and I began using them, we treated them only as strings retrieved from one API and sent to another (like an access token). However, instead of using the String type, I decided to define a JWT type alias.

I used the new JWT type throughout the code as a hint to other developers about what kind of string it is. This gave it some semantic meaning on top of being a string. Neat. Only later, when we needed to start decoding the JWT itself did this really come in handy.