Swift Language Typealias typealias for other types


typealias Number = NSNumber

You can also use a type alias to give a type another name to make it easier to remember, or make your code more elegant.

typealias for Tuples

typealias PersonTuple = (name: String, age: Int, address: String)

And this can be used as:

func getPerson(for name: String) -> PersonTuple {
    //fetch from db, etc
    return ("name", 45, "address")