2.9 Summary
That concludes our chapter on variables! To wrap things up: You learned that Swift is a statically typed language with a strong emphasis on type safety. You must declare the type of a variable, and it can’t be changed later. But the option of type inference is also present; if you declare a variable using a value directly, Swift is smart enough to determine the type automatically.
We went over built-in types for Boolean, numeric, text, date/type, and quantity variables, as well as tuples to group variables together. Finally, you learned about type aliases to declare custom names for other types.
This has been the first hands-on chapter on Swift; therefore, extensive details and playground screenshots were shared to get you warmed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access