Classes marked with final can not be overridden.
Why should one care at all whether class can or can’t be overridden?
There are two things to consider:
- As an API designer/developer, you might have a class in your Framework that can be abused or misused when subclassed.
finalprevents class to be subclassed—mission accomplished. You can also usefinalto mark methods, properties, and even subscripts of non-final classes. This will have same effect, but for particular part of the class. - Marking class as
finalalso tells Swift compiler that method should be called directly (static dispatch) rather than looking up a function from a method table (dynamic dispatch). This reduces function call overhead and gives you extra performance. You can read more on this on Swift Developer Blog.