Immutability

Swift makes it easy to define immutable values--in other words, constants--and empowers FP, as immutability is one of the key concepts in FP. Once constants are initialized, they cannot be altered or mutated. Although it is possible to achieve immutability in languages such as Java, it is not as easy as Swift. To define any immutable type in Swift, the let keyword can be used no matter if it is a custom type, collection type, or a Struct/enum type.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset