What is typealias in Swift


What is type alias? 

  • A type alias allows you to provide a new name for an existing data type into your program.
  • Type alias does not create new types they simply provide a new name to an existing type.
  • The main purpose of type alias is to make our code more readable.

    Example:

       
typealias Name = String 

        
let firstName:Name = "Pawan"
       
 



Thanks for reading, Happy Coding 👨‍💻

Popular posts from this blog

Frame vs bounds in Swift

DateFomatter in Swift

Property wrapper in Swift