Swift TypeAlias

Type alias is technique to provide new name to existing data type without modifying it's original behaviour. That is similar to typedef in C programming language. That are used when simplicity in coding style and that are reliable to provide independence. For example.

typealias shortInt=Int8 

var age:shortInt = 20

print(age)

Output

20

typealias keyword are used to provide a new type alias in Swift programing language. In above example shortInt is a signed 8 bit integer. Once define a aliasing name, and use anywhere within the code.



Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved