Tsallaka zuwa abun ciki
Justice Tech School

Type Aliases and Constants

typealias gives a type a new name. Use static let in a type for constants.

Example
typealias ID = Int
let id: ID = 5
enum Limits { static let max = 100 }
print(id, Limits.max)

Exercise

Alias keyword.

 ID = Int

Quiz Test

What does typealias create?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.