Type safety and Type inference in Swift

Swift is a type safe language. It performs type checks while compiling our code and flags of any errors due to mismatched types. We don’t have to specify the type of constants and variables every time. Swift can infer the type of variables and constants when they are assigned with an initial value. This is called type inference. As a result, Swift requires fewer type declarations compared to other languages.

Leave a Reply

%d bloggers like this: