O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Types and Type Casting

In the previous chapter, we talked about functions and closures and covered topics such as function types. We know that functions are first-class citizens in Swift and they can be stored and passed around like any type. It is the time to look into types in detail.

This chapter starts with explaining types, touching on the concept of types in the category theory very briefly. Then it explains value and reference types and compares them in detail. Finally, it talks about equality, identity, and type casting.

This chapter will cover the following topics with coding examples:

  • Types
  • Different categories of types
  • Value versus reference types
    • Value and reference type constants
    • Mixing value and reference types
    • Copying
    • Value ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required