Introduction
Extensions let you add new features to existing types without changing their original code. This helps keep your code organized and easy to update.
You want to add a new function to a type you did not create, like String or Int.
You want to group related functions together to keep your code clean.
You want to add computed properties to a type without subclassing.
You want to make an existing type conform to a protocol.
You want to add convenience initializers to a type.